/[MITgcm]/MITgcm_contrib/dgoldberg/streamice/streamice_dump_ad.F
ViewVC logotype

Annotation of /MITgcm_contrib/dgoldberg/streamice/streamice_dump_ad.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (hide annotations) (download)
Thu Sep 27 20:29:00 2012 UTC (12 years, 9 months ago) by dgoldberg
Branch: MAIN
Changes since 1.2: +16 -1 lines
various changes

1 dgoldberg 1.3 C $Header: /u/gcmpack/MITgcm_contrib/dgoldberg/streamice/streamice_dump_ad.F,v 1.2 2012/09/04 21:11:44 dgoldberg Exp $
2 heimbach 1.1 C $Name: $
3    
4     #include "AD_CONFIG.h"
5     #include "PACKAGES_CONFIG.h"
6     #include "STREAMICE_OPTIONS.h"
7    
8     CBOP
9     C !ROUTINE: adstreamice_dump
10     C !INTERFACE:
11     subroutine adstreamice_dump( mytime, myiter, myThid )
12    
13     C !DESCRIPTION: \bv
14     C *==========================================================*
15     C | SUBROUTINE adstreamice_dump |
16     C *==========================================================*
17     C Extract adjoint variable from TAMC/TAF-generated
18     C adjoint common blocks, contained in adcommon.h
19     C and write fields to file;
20     C Make sure common blocks in adcommon.h are up-to-date
21     C w.r.t. current adjoint code.
22     C *==========================================================*
23     C \ev
24    
25     C !USES:
26     IMPLICIT NONE
27    
28     C == Global variables ===
29     #include "SIZE.h"
30     #include "EEPARAMS.h"
31     #include "PARAMS.h"
32     #include "STREAMICE.h"
33     #include "GRID.h"
34     #ifdef ALLOW_AUTODIFF_MONITOR
35     # include "adcommon.h"
36     #endif
37    
38     LOGICAL DIFFERENT_MULTIPLE
39     EXTERNAL DIFFERENT_MULTIPLE
40     INTEGER IO_ERRCOUNT
41     EXTERNAL IO_ERRCOUNT
42    
43     C !INPUT/OUTPUT PARAMETERS:
44     C == Routine arguments ==
45     C myIter - iteration counter for this thread
46     C myTime - time counter for this thread
47     C myThid - Thread number for this instance of the routine.
48     integer myThid
49     integer myiter
50     _RL mytime
51    
52     #if (defined (ALLOW_ADJOINT_RUN) || defined (ALLOW_ADMTLM))
53    
54     C !LOCAL VARIABLES:
55     c == local variables ==
56     C suff - Hold suffix part of a filename
57     C beginIOErrCount - Begin and end IO error counts
58     C endIOErrCount
59     C msgBuf - Error message buffer
60     CHARACTER*(MAX_LEN_FNAM) suff
61     INTEGER beginIOErrCount
62     INTEGER endIOErrCount
63     CHARACTER*(MAX_LEN_MBUF) msgBuf
64    
65 dgoldberg 1.2 double precision ada_glen(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)
66 heimbach 1.1 double precision adarea_shelf_streamice(1-olx:snx+olx,1-oly:sny+
67     $oly,nsx,nsy)
68 dgoldberg 1.2 double precision adbdot_streamice(1-olx:snx+olx,1-oly:sny+oly,nsx,
69     $nsy)
70 heimbach 1.1 double precision adc_basal_friction(1-olx:snx+olx,1-oly:sny+oly,
71     $nsx,nsy)
72     double precision adh_streamice(1-olx:snx+olx,1-oly:sny+oly,nsx,
73     $nsy)
74     double precision adsurf_el_streamice(1-olx:snx+olx,1-oly:sny+oly,
75     $nsx,nsy)
76     double precision adtau_beta_eff_streamice(1-olx:snx+olx,1-oly:sny+
77     $oly,nsx,nsy)
78     double precision adu_streamice(1-olx:snx+olx,1-oly:sny+oly,nsx,
79     $nsy)
80     double precision adv_streamice(1-olx:snx+olx,1-oly:sny+oly,nsx,
81     $nsy)
82     double precision advisc_streamice(1-olx:snx+olx,1-oly:sny+oly,nsx,
83     $nsy)
84 dgoldberg 1.3 #ifdef USE_ALT_RLOW
85     double precision adr_low_si(1-olx:snx+olx,1-oly:sny+oly,nsx,
86     $nsy)
87     common /adstreamice_fields_rl/ adh_streamice, adu_streamice,
88     $adv_streamice, advisc_streamice, adtau_beta_eff_streamice,
89     $adsurf_el_streamice, adarea_shelf_streamice, adc_basal_friction,
90     $ada_glen, adbdot_streamice, adr_low_si
91     #else
92 dgoldberg 1.2 common /adstreamice_fields_rl/ adh_streamice, adu_streamice,
93     $adv_streamice, advisc_streamice, adtau_beta_eff_streamice,
94     $adsurf_el_streamice, adarea_shelf_streamice, adc_basal_friction,
95     $ada_glen, adbdot_streamice
96 heimbach 1.1 c
97     double precision adr_low(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy)
98     common /adgrid_rs/ adr_low
99 dgoldberg 1.3 #endif
100 heimbach 1.1
101     c == end of interface ==
102     CEOP
103    
104     IF (
105     & DIFFERENT_MULTIPLE(streamice_adjDump,mytime,deltaTClock)
106     & ) THEN
107    
108     C-- Set suffix for this set of data files.
109     WRITE(suff,'(I10.10)') myIter
110     writeBinaryPrec = writeStatePrec
111    
112     C-- Read IO error counter
113     beginIOErrCount = IO_ERRCOUNT(myThid)
114    
115     CALL WRITE_REC_3D_RL(
116     & 'ADJc_basal_friction.'//suff, writeBinaryPrec,
117     & 1, adc_basal_friction, 1, myIter, myThid )
118     CALL WRITE_REC_3D_RL(
119     & 'ADJh_streamice.'//suff, writeBinaryPrec,
120     & 1, adh_streamice, 1, myIter, myThid )
121 dgoldberg 1.3 #ifdef USE_ALT_RLOW
122     CALL WRITE_REC_3D_RL(
123     & 'ADJr_low.'//suff, writeBinaryPrec,
124     & 1, adr_low_si, 1, myIter, myThid )
125     #else
126 heimbach 1.1 CALL WRITE_REC_3D_RL(
127     & 'ADJr_low.'//suff, writeBinaryPrec,
128     & 1, adr_low, 1, myIter, myThid )
129 dgoldberg 1.3 #endif
130 dgoldberg 1.2 CALL WRITE_REC_3D_RL(
131     & 'ADJa_glen.'//suff, writeBinaryPrec,
132     & 1, ada_glen, 1, myIter, myThid )
133     CALL WRITE_REC_3D_RL(
134     & 'ADJbdot.'//suff, writeBinaryPrec,
135     & 1, adbdot_streamice, 1, myIter, myThid )
136 heimbach 1.1
137     ENDIF
138    
139     #endif /* ALLOW_ADJOINT_RUN */
140    
141     RETURN
142     END

  ViewVC Help
Powered by ViewVC 1.1.22