1 |
C $Header: /u/gcmpack/MITgcm/pkg/exf/exf_adjoint_snapshots__g.F,v 1.6 2012/08/29 01:59:36 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "EXF_OPTIONS.h" |
5 |
#include "AD_CONFIG.h" |
6 |
|
7 |
CBOP |
8 |
C !ROUTINE: g_exf_adjoint_snapshots |
9 |
C !INTERFACE: |
10 |
SUBROUTINE g_exf_adjoint_snapshots( |
11 |
& iwhen, myTime, myIter, myThid ) |
12 |
|
13 |
C !DESCRIPTION: \bv |
14 |
C *==========================================================* |
15 |
C | SUBROUTINE g_exf_adjoint_snapshots | |
16 |
C *==========================================================* |
17 |
C Extract tangent linear variable from TAMC/TAF-generated |
18 |
C tangent linear common blocks, contained in g_common.h |
19 |
C and write fields to file; |
20 |
C Make sure common blocks in g_common.h are up-to-date |
21 |
C w.r.t. current adjoint code. |
22 |
C *==========================================================* |
23 |
C | SUBROUTINE g_exf_adjoint_snapshots | |
24 |
C *==========================================================* |
25 |
C \ev |
26 |
|
27 |
C !USES: |
28 |
IMPLICIT NONE |
29 |
|
30 |
C == Global variables === |
31 |
#include "SIZE.h" |
32 |
#include "EEPARAMS.h" |
33 |
#include "PARAMS.h" |
34 |
#include "EXF_PARAM.h" |
35 |
#ifdef ALLOW_AUTODIFF_MONITOR |
36 |
# include "g_common.h" |
37 |
#endif |
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 iwhen |
45 |
_RL myTime |
46 |
INTEGER myIter |
47 |
INTEGER myThid |
48 |
|
49 |
#ifdef ALLOW_TANGENTLINEAR_RUN |
50 |
#ifdef ALLOW_AUTODIFF_MONITOR |
51 |
|
52 |
C !FUNCTIONS: |
53 |
LOGICAL DIFFERENT_MULTIPLE |
54 |
EXTERNAL DIFFERENT_MULTIPLE |
55 |
|
56 |
C !LOCAL VARIABLES: |
57 |
C == local variables == |
58 |
C suff :: Hold suffix part of a filename |
59 |
C msgBuf :: Error message buffer |
60 |
CHARACTER*(10) suff |
61 |
c CHARACTER*(MAX_LEN_MBUF) msgBuf |
62 |
CEOP |
63 |
|
64 |
IF (useEXF) THEN |
65 |
IF ( |
66 |
& DIFFERENT_MULTIPLE(adjDumpFreq,myTime,deltaTClock) |
67 |
& ) THEN |
68 |
|
69 |
CALL TIMER_START('I/O (WRITE) [TLM LOOP]', myThid ) |
70 |
|
71 |
C-- Set suffix for this set of data files. |
72 |
IF ( rwSuffixType.EQ.0 ) THEN |
73 |
WRITE(suff,'(I10.10)') myIter |
74 |
ELSE |
75 |
CALL RW_GET_SUFFIX( suff, myTime, myIter, myThid ) |
76 |
ENDIF |
77 |
C ==>> Resetting run-time parameter writeBinaryPrec in the middle of a run |
78 |
C ==>> is very very very nasty !!! |
79 |
c writeBinaryPrec = writeStatePrec |
80 |
C <<== If you really want to mess-up with this at your own risk, |
81 |
C <<== uncomment the line above |
82 |
|
83 |
IF ( iwhen .EQ.1 ) THEN |
84 |
|
85 |
CALL WRITE_FLD_XY_RL ( 'G_Justress.', |
86 |
& suff, g_ustress, myIter, myThid ) |
87 |
CALL WRITE_FLD_XY_RL ( 'G_Jvstress.', |
88 |
& suff, g_vstress, myIter, myThid ) |
89 |
CALL WRITE_FLD_XY_RL ( 'G_Jhflux.', |
90 |
& suff, g_hflux, myIter, myThid ) |
91 |
CALL WRITE_FLD_XY_RL ( 'G_Jsflux.', |
92 |
& suff, g_sflux, myIter, myThid ) |
93 |
|
94 |
ELSEIF ( iwhen .EQ.2 ) THEN |
95 |
|
96 |
# ifdef ALLOW_ATM_TEMP |
97 |
CALL WRITE_FLD_XY_RL ( 'G_Jatemp.', |
98 |
& suff, g_atemp, myIter, myThid ) |
99 |
CALL WRITE_FLD_XY_RL ( 'G_Jaqh.', |
100 |
& suff, g_aqh, myIter, myThid ) |
101 |
CALL WRITE_FLD_XY_RL ( 'G_Jprecip.', |
102 |
& suff, g_precip, myIter, myThid ) |
103 |
# endif |
104 |
IF ( useAtmWind ) THEN |
105 |
CALL WRITE_FLD_XY_RL ( 'G_Juwind.', |
106 |
& suff, g_uwind, myIter, myThid ) |
107 |
CALL WRITE_FLD_XY_RL ( 'G_Jvwind.', |
108 |
& suff, g_vwind, myIter, myThid ) |
109 |
ENDIF |
110 |
# ifdef ALLOW_DOWNWARD_RADIATION |
111 |
CALL WRITE_FLD_XY_RL ( 'G_Jswdown.', |
112 |
& suff, g_swdown, myIter, myThid ) |
113 |
# endif |
114 |
# ifdef ALLOW_CLIMSST_RELAXATION |
115 |
CALL WRITE_FLD_XY_RL ( 'G_Jclimsst.', |
116 |
& suff, g_climsst, myIter, myThid ) |
117 |
# endif |
118 |
# ifdef ALLOW_CLIMSSS_RELAXATION |
119 |
CALL WRITE_FLD_XY_RL ( 'G_Jclimsss.', |
120 |
& suff, g_climsss, myIter, myThid ) |
121 |
# endif |
122 |
|
123 |
ENDIF |
124 |
|
125 |
CALL TIMER_STOP( 'I/O (WRITE) [TLM LOOP]', myThid ) |
126 |
|
127 |
ENDIF |
128 |
ENDIF |
129 |
|
130 |
#endif /* ALLOW_AUTODIFF_MONITOR */ |
131 |
#endif /* ALLOW_TANGENTLINEAR_RUN */ |
132 |
|
133 |
RETURN |
134 |
END |