1 |
heimbach |
1.1 |
|
2 |
edhill |
1.3 |
#include "AUTODIFF_OPTIONS.h" |
3 |
heimbach |
1.1 |
|
4 |
|
|
CBOP |
5 |
|
|
C !ROUTINE: g_dummy_in_stepping |
6 |
|
|
C !INTERFACE: |
7 |
|
|
subroutine g_dummy_in_stepping( mytime, myiter, myThid ) |
8 |
|
|
|
9 |
|
|
C !DESCRIPTION: \bv |
10 |
|
|
C *==========================================================* |
11 |
|
|
C | SUBROUTINE g_dummy_in_stepping | |
12 |
|
|
C *==========================================================* |
13 |
|
|
C Extract tangent linear variable from TAMC/TAF-generated |
14 |
|
|
C tangent linear common blocks, contained in g_common.h |
15 |
|
|
C and write fields to file; |
16 |
|
|
C Make sure common blocks in g_common.h are up-to-date |
17 |
|
|
C w.r.t. current adjoint code. |
18 |
|
|
C *==========================================================* |
19 |
|
|
C | SUBROUTINE g_dummy_in_stepping | |
20 |
|
|
C *==========================================================* |
21 |
|
|
C \ev |
22 |
|
|
|
23 |
|
|
C !USES: |
24 |
|
|
IMPLICIT NONE |
25 |
|
|
|
26 |
|
|
C == Global variables === |
27 |
|
|
#include "SIZE.h" |
28 |
|
|
#include "EEPARAMS.h" |
29 |
|
|
#include "PARAMS.h" |
30 |
heimbach |
1.2 |
#ifdef ALLOW_AUTODIFF_MONITOR |
31 |
|
|
# include "g_common.h" |
32 |
|
|
#endif |
33 |
heimbach |
1.1 |
|
34 |
|
|
LOGICAL DIFFERENT_MULTIPLE |
35 |
|
|
EXTERNAL DIFFERENT_MULTIPLE |
36 |
|
|
INTEGER IO_ERRCOUNT |
37 |
|
|
EXTERNAL IO_ERRCOUNT |
38 |
|
|
|
39 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
40 |
|
|
C == Routine arguments == |
41 |
|
|
C myIter - iteration counter for this thread |
42 |
|
|
C myTime - time counter for this thread |
43 |
|
|
C myThid - Thread number for this instance of the routine. |
44 |
|
|
integer myThid |
45 |
|
|
integer myiter |
46 |
heimbach |
1.2 |
_RL mytime |
47 |
|
|
|
48 |
|
|
#ifdef ALLOW_AUTODIFF_MONITOR |
49 |
heimbach |
1.1 |
|
50 |
|
|
C !LOCAL VARIABLES: |
51 |
|
|
c == local variables == |
52 |
|
|
C suff - Hold suffix part of a filename |
53 |
|
|
C beginIOErrCount - Begin and end IO error counts |
54 |
|
|
C endIOErrCount |
55 |
|
|
C msgBuf - Error message buffer |
56 |
|
|
CHARACTER*(MAX_LEN_FNAM) suff |
57 |
|
|
INTEGER beginIOErrCount |
58 |
|
|
INTEGER endIOErrCount |
59 |
|
|
CHARACTER*(MAX_LEN_MBUF) msgBuf |
60 |
|
|
|
61 |
|
|
c == end of interface == |
62 |
|
|
CEOP |
63 |
|
|
|
64 |
|
|
call TIMER_START('I/O (WRITE) [ADJOINT LOOP]', myThid ) |
65 |
|
|
|
66 |
|
|
IF ( |
67 |
|
|
& DIFFERENT_MULTIPLE(dumpFreq,mytime, |
68 |
|
|
& mytime-deltaTClock) |
69 |
|
|
& ) THEN |
70 |
|
|
|
71 |
|
|
write(*,*) 'myIter= ',myiter |
72 |
|
|
|
73 |
|
|
_BARRIER |
74 |
|
|
_BEGIN_MASTER( myThid ) |
75 |
|
|
|
76 |
|
|
C-- Set suffix for this set of data files. |
77 |
|
|
WRITE(suff,'(I10.10)') myIter |
78 |
|
|
writeBinaryPrec = writeStatePrec |
79 |
|
|
|
80 |
|
|
C-- Read IO error counter |
81 |
|
|
beginIOErrCount = IO_ERRCOUNT(myThid) |
82 |
|
|
|
83 |
|
|
CALL WRITE_FLD_XY_RL ( 'G_Jtaux.',suff, g_fu, myIter, myThid) |
84 |
|
|
CALL WRITE_FLD_XY_RL ( 'G_Jtauy.',suff, g_fv, myIter, myThid) |
85 |
|
|
CALL WRITE_FLD_XY_RL ( 'G_Jqnet.',suff, g_qnet, myIter, myThid) |
86 |
|
|
CALL WRITE_FLD_XY_RL ( 'G_Jempr.',suff, g_empmr, myIter, myThid) |
87 |
|
|
c |
88 |
|
|
CALL WRITE_FLD_XYZ_RL( |
89 |
|
|
& 'G_Jgtnm1.',suff, g_gtnm1, myIter, myThid) |
90 |
|
|
CALL WRITE_FLD_XYZ_RL( |
91 |
|
|
& 'G_Jgsnm1.',suff, g_gsnm1, myIter, myThid) |
92 |
|
|
CALL WRITE_FLD_XYZ_RL( |
93 |
|
|
& 'G_Jgunm1.',suff, g_gunm1, myIter, myThid) |
94 |
|
|
CALL WRITE_FLD_XYZ_RL( |
95 |
|
|
& 'G_Jgvnm1.',suff, g_gvnm1, myIter, myThid) |
96 |
|
|
#ifdef ALLOW_PASSIVE_TRACER |
97 |
|
|
CALL WRITE_FLD_XYZ_RL( |
98 |
|
|
& 'G_Jgtr1nm1. ',suff, g_gtr1nm1, myIter, myThid) |
99 |
|
|
#endif |
100 |
|
|
c |
101 |
|
|
CALL WRITE_FLD_XYZ_RL( |
102 |
|
|
& 'G_Jtheta.',suff, g_theta, myIter, myThid) |
103 |
|
|
CALL WRITE_FLD_XYZ_RL( |
104 |
|
|
& 'G_Jsalt.',suff, g_salt, myIter, myThid) |
105 |
|
|
CALL WRITE_FLD_XYZ_RL( |
106 |
|
|
& 'G_Juvel.',suff, g_uvel, myIter, myThid) |
107 |
|
|
CALL WRITE_FLD_XYZ_RL( |
108 |
|
|
& 'G_Jvvel.',suff, g_vvel, myIter, myThid) |
109 |
|
|
|
110 |
|
|
#ifdef ALLOW_PASSIVE_TRACER |
111 |
|
|
CALL WRITE_FLD_XYZ_RL( |
112 |
|
|
& 'G_Jtr1. ',suff, g_tr1, myIter, myThid) |
113 |
|
|
#endif |
114 |
|
|
#ifdef ALLOW_DIFFKR_CONTROL |
115 |
|
|
CALL WRITE_FLD_XYZ_RL ( 'G_Jdiffkr.',suff, g_diffkr, |
116 |
|
|
& myIter, myThid) |
117 |
|
|
#endif |
118 |
|
|
#ifdef ALLOW_KAPGM_CONTROL |
119 |
|
|
CALL WRITE_FLD_XYZ_RL ( 'G_Jkagm.',suff, g_kapgm, |
120 |
|
|
& myIter, myThid) |
121 |
|
|
#endif |
122 |
|
|
|
123 |
|
|
cph CALL WRITE_FLD_XY_RL( 'G_J_sst.',suff, g_sst, myIter, myThid) |
124 |
|
|
cph CALL WRITE_FLD_XY_RL( 'G_J_sss.',suff, g_sss, myIter, myThid) |
125 |
|
|
|
126 |
|
|
C-- Reread IO error counter |
127 |
|
|
endIOErrCount = IO_ERRCOUNT(myThid) |
128 |
|
|
|
129 |
|
|
C-- Check for IO errors |
130 |
|
|
IF ( endIOErrCount .NE. beginIOErrCount ) THEN |
131 |
|
|
WRITE(msgBuf,'(A)') 'S/R WRITE_STATE' |
132 |
|
|
CALL PRINT_ERROR( msgBuf, 1 ) |
133 |
|
|
WRITE(msgBuf,'(A)') 'Error writing out model state' |
134 |
|
|
CALL PRINT_ERROR( msgBuf, 1 ) |
135 |
|
|
WRITE(msgBuf,'(A,I10)') 'Timestep ',myIter |
136 |
|
|
CALL PRINT_ERROR( msgBuf, 1 ) |
137 |
|
|
ELSE |
138 |
|
|
WRITE(msgBuf,'(A,I10)') |
139 |
|
|
& '// Model state written, timestep', myIter |
140 |
|
|
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
141 |
|
|
& SQUEEZE_RIGHT, 1 ) |
142 |
|
|
WRITE(msgBuf,'(A)') ' ' |
143 |
|
|
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
144 |
|
|
& SQUEEZE_RIGHT, 1 ) |
145 |
|
|
ENDIF |
146 |
|
|
|
147 |
|
|
_END_MASTER( myThid ) |
148 |
|
|
_BARRIER |
149 |
|
|
|
150 |
|
|
ENDIF |
151 |
|
|
|
152 |
|
|
call TIMER_STOP( 'I/O (WRITE) [ADJOINT LOOP]', myThid ) |
153 |
heimbach |
1.2 |
|
154 |
|
|
#endif /* ALLOW_AUTODIFF_MONITOR */ |
155 |
|
|
|
156 |
heimbach |
1.1 |
end |
157 |
|
|
|
158 |
|
|
|
159 |
|
|
|
160 |
|
|
|
161 |
|
|
|
162 |
|
|
|
163 |
|
|
|
164 |
|
|
|
165 |
|
|
|