1 |
C $Header: $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "EXF_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
C !ROUTINE: g_exf_adjoint_snapshots |
8 |
C !INTERFACE: |
9 |
subroutine g_exf_adjoint_snapshots( |
10 |
& iwhen, mytime, myiter, myThid ) |
11 |
|
12 |
C !DESCRIPTION: \bv |
13 |
C *==========================================================* |
14 |
C | SUBROUTINE g_exf_adjoint_snapshots | |
15 |
C *==========================================================* |
16 |
C Extract tangent linear variable from TAMC/TAF-generated |
17 |
C tangent linear common blocks, contained in g_common.h |
18 |
C and write fields to file; |
19 |
C Make sure common blocks in g_common.h are up-to-date |
20 |
C w.r.t. current adjoint code. |
21 |
C *==========================================================* |
22 |
C | SUBROUTINE g_exf_adjoint_snapshots | |
23 |
C *==========================================================* |
24 |
C \ev |
25 |
|
26 |
C !USES: |
27 |
IMPLICIT NONE |
28 |
|
29 |
C == Global variables === |
30 |
#include "SIZE.h" |
31 |
#include "EEPARAMS.h" |
32 |
#include "PARAMS.h" |
33 |
#ifdef ALLOW_AUTODIFF_MONITOR |
34 |
# include "g_common.h" |
35 |
#endif |
36 |
|
37 |
LOGICAL DIFFERENT_MULTIPLE |
38 |
EXTERNAL DIFFERENT_MULTIPLE |
39 |
INTEGER IO_ERRCOUNT |
40 |
EXTERNAL IO_ERRCOUNT |
41 |
|
42 |
C !INPUT/OUTPUT PARAMETERS: |
43 |
C == Routine arguments == |
44 |
C myIter - iteration counter for this thread |
45 |
C myTime - time counter for this thread |
46 |
C myThid - Thread number for this instance of the routine. |
47 |
integer iwhen |
48 |
integer myThid |
49 |
integer myiter |
50 |
_RL mytime |
51 |
|
52 |
#ifdef ALLOW_TANGENTLINEAR_RUN |
53 |
#ifdef ALLOW_AUTODIFF_MONITOR |
54 |
|
55 |
C !LOCAL VARIABLES: |
56 |
c == local variables == |
57 |
C suff - Hold suffix part of a filename |
58 |
C beginIOErrCount - Begin and end IO error counts |
59 |
C endIOErrCount |
60 |
C msgBuf - Error message buffer |
61 |
CHARACTER*(MAX_LEN_FNAM) suff |
62 |
INTEGER beginIOErrCount |
63 |
INTEGER endIOErrCount |
64 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
65 |
|
66 |
c == end of interface == |
67 |
CEOP |
68 |
|
69 |
call TIMER_START('I/O (WRITE) [TLM LOOP]', myThid ) |
70 |
|
71 |
IF (useEXF) THEN |
72 |
|
73 |
IF ( |
74 |
& DIFFERENT_MULTIPLE(adjDumpFreq,mytime,deltaTClock) |
75 |
& ) THEN |
76 |
|
77 |
_BEGIN_MASTER( myThid ) |
78 |
|
79 |
C-- Set suffix for this set of data files. |
80 |
WRITE(suff,'(I10.10)') myIter |
81 |
writeBinaryPrec = writeStatePrec |
82 |
|
83 |
C-- Read IO error counter |
84 |
beginIOErrCount = IO_ERRCOUNT(myThid) |
85 |
|
86 |
IF ( iwhen .EQ.1 ) THEN |
87 |
|
88 |
CALL WRITE_FLD_XY_RL ( 'G_Justress.', |
89 |
& suff, g_ustress, myIter, myThid) |
90 |
CALL WRITE_FLD_XY_RL ( 'G_Jvstress.', |
91 |
& suff, g_vstress, myIter, myThid) |
92 |
CALL WRITE_FLD_XY_RL ( 'G_Jhflux.', |
93 |
& suff, g_hflux, myIter, myThid) |
94 |
CALL WRITE_FLD_XY_RL ( 'G_Jsflux.', |
95 |
& suff, g_sflux, myIter, myThid) |
96 |
|
97 |
ELSEIF ( iwhen .EQ.2 ) THEN |
98 |
|
99 |
# ifdef ALLOW_ATM_TEMP |
100 |
CALL WRITE_FLD_XY_RL ( 'G_Jatemp.', |
101 |
& suff, g_atemp, myIter, myThid) |
102 |
CALL WRITE_FLD_XY_RL ( 'G_Jaqh.', |
103 |
& suff, g_aqh, myIter, myThid) |
104 |
CALL WRITE_FLD_XY_RL ( 'G_Jprecip.', |
105 |
& suff, g_precip, myIter, myThid) |
106 |
# endif |
107 |
# ifdef ALLOW_ATM_WIND |
108 |
CALL WRITE_FLD_XY_RL ( 'G_Juwind.', |
109 |
& suff, g_uwind, myIter, myThid) |
110 |
CALL WRITE_FLD_XY_RL ( 'G_Jvwind.', |
111 |
& suff, g_vwind, myIter, myThid) |
112 |
# endif |
113 |
# ifdef ALLOW_DOWNWARD_RADIATION |
114 |
CALL WRITE_FLD_XY_RL ( 'G_Jswdown.', |
115 |
& suff, g_swdown, myIter, myThid) |
116 |
# endif |
117 |
# ifdef ALLOW_CLIMSST_RELAXATION |
118 |
CALL WRITE_FLD_XY_RL ( 'G_Jclimsst.', |
119 |
& suff, g_climsst, myIter, myThid) |
120 |
# endif |
121 |
# ifdef ALLOW_CLIMSSS_RELAXATION |
122 |
CALL WRITE_FLD_XY_RL ( 'G_Jclimsss.', |
123 |
& suff, g_climsss, myIter, myThid) |
124 |
# endif |
125 |
|
126 |
ENDIF |
127 |
|
128 |
_END_MASTER( myThid ) |
129 |
_BARRIER |
130 |
|
131 |
|
132 |
ENDIF |
133 |
|
134 |
ENDIF |
135 |
|
136 |
call TIMER_STOP( 'I/O (WRITE) [TLM LOOP]', myThid ) |
137 |
|
138 |
#endif /* ALLOW_AUTODIFF_MONITOR */ |
139 |
#endif /* ALLOW_TANGENTLINEAR_RUN */ |
140 |
|
141 |
end |
142 |
|
143 |
|
144 |
|
145 |
|
146 |
|
147 |
|
148 |
|
149 |
|
150 |
|