1 |
C $Header: /u/gcmpack/MITgcm/pkg/autodiff/addummy_in_dynamics.F,v 1.2 2011/08/17 15:01:18 heimbach Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "PACKAGES_CONFIG.h" |
5 |
#include "AUTODIFF_OPTIONS.h" |
6 |
|
7 |
CBOP |
8 |
C !ROUTINE: addummy_in_stepping |
9 |
C !INTERFACE: |
10 |
subroutine addummy_in_dynamics( mytime, myiter, myThid ) |
11 |
|
12 |
C !DESCRIPTION: \bv |
13 |
C *==========================================================* |
14 |
C | SUBROUTINE addummy_in_stepping | |
15 |
C *==========================================================* |
16 |
C Extract adjoint variable from TAMC/TAF-generated |
17 |
C adjoint common blocks, contained in adcommon.h |
18 |
C and write fields to file; |
19 |
C Make sure common blocks in adcommon.h are up-to-date |
20 |
C w.r.t. current adjoint code. |
21 |
C *==========================================================* |
22 |
C | SUBROUTINE addummy_in_stepping | |
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_MNC |
34 |
#include "MNC_PARAMS.h" |
35 |
#endif |
36 |
#include "GRID.h" |
37 |
#ifdef ALLOW_AUTODIFF_MONITOR |
38 |
# include "adcommon.h" |
39 |
#endif |
40 |
|
41 |
LOGICAL DIFFERENT_MULTIPLE |
42 |
EXTERNAL DIFFERENT_MULTIPLE |
43 |
INTEGER IO_ERRCOUNT |
44 |
EXTERNAL IO_ERRCOUNT |
45 |
|
46 |
C !INPUT/OUTPUT PARAMETERS: |
47 |
C == Routine arguments == |
48 |
C myIter - iteration counter for this thread |
49 |
C myTime - time counter for this thread |
50 |
C myThid - Thread number for this instance of the routine. |
51 |
integer myThid |
52 |
integer myiter |
53 |
_RL mytime |
54 |
|
55 |
#if (defined (ALLOW_ADJOINT_RUN) || defined (ALLOW_ADMTLM)) |
56 |
#ifdef ALLOW_AUTODIFF_MONITOR |
57 |
|
58 |
C !LOCAL VARIABLES: |
59 |
c == local variables == |
60 |
C suff - Hold suffix part of a filename |
61 |
C beginIOErrCount - Begin and end IO error counts |
62 |
C endIOErrCount |
63 |
C msgBuf - Error message buffer |
64 |
CHARACTER*(MAX_LEN_FNAM) suff |
65 |
INTEGER beginIOErrCount |
66 |
INTEGER endIOErrCount |
67 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
68 |
|
69 |
c == end of interface == |
70 |
CEOP |
71 |
|
72 |
call TIMER_START('I/O (WRITE) [ADJOINT LOOP]', myThid ) |
73 |
|
74 |
IF ( |
75 |
& DIFFERENT_MULTIPLE(adjDumpFreq,mytime,deltaTClock) |
76 |
& ) THEN |
77 |
|
78 |
#ifdef AUTODIFF_TAMC_COMPATIBILITY |
79 |
C |
80 |
# else /* ndfef AUTODIFF_TAMC_COMPATIBILITY */ |
81 |
# ifdef ALLOW_AUTODIFF_MONITOR_DIAG |
82 |
call adexch_xyz_rl( adrhoinsitu, mythid ) |
83 |
call adexch_xyz_rl( adtotphihyd, mythid ) |
84 |
# endif |
85 |
#endif /* AUTODIFF_TAMC_COMPATIBILITY */ |
86 |
|
87 |
C-- Set suffix for this set of data files. |
88 |
WRITE(suff,'(I10.10)') myIter |
89 |
writeBinaryPrec = writeStatePrec |
90 |
|
91 |
C-- Read IO error counter |
92 |
beginIOErrCount = IO_ERRCOUNT(myThid) |
93 |
|
94 |
#ifdef ALLOW_AUTODIFF_MONITOR_DIAG |
95 |
CALL WRITE_FLD_XYZ_RL( |
96 |
& 'ADJrhoinsitu.',suff, adrhoinsitu, myIter, myThid) |
97 |
cph( is set to zero in addiags_phi_hyd |
98 |
c CALL WRITE_FLD_XYZ_RL( |
99 |
c & 'ADJtotphihyd.',suff, adtotphihyd, myIter, myThid) |
100 |
cph) |
101 |
#endif |
102 |
|
103 |
ENDIF |
104 |
|
105 |
call TIMER_STOP( 'I/O (WRITE) [ADJOINT LOOP]', myThid ) |
106 |
|
107 |
#endif /* ALLOW_AUTODIFF_MONITOR */ |
108 |
#endif /* ALLOW_ADJOINT_RUN */ |
109 |
|
110 |
RETURN |
111 |
END |
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|