1 |
C $Header: /u/gcmpack/MITgcm/pkg/ptracers/ptracers_ad_dump.F,v 1.3 2012/07/06 23:03:40 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "PTRACERS_OPTIONS.h" |
5 |
#include "AD_CONFIG.h" |
6 |
|
7 |
CBOP |
8 |
C !ROUTINE: ptracers_ad_dump |
9 |
C !INTERFACE: |
10 |
subroutine ptracers_ad_dump( myTime, myIter, myThid ) |
11 |
|
12 |
C !DESCRIPTION: \bv |
13 |
C *==========================================================* |
14 |
C | SUBROUTINE ptracers_ad_dump |
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 ptracers_ad_dump |
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 |
#include "PTRACERS_SIZE.h" |
34 |
#include "PTRACERS_PARAMS.h" |
35 |
#ifdef ALLOW_AUTODIFF_MONITOR |
36 |
# include "ptracers_adcommon.h" |
37 |
#endif |
38 |
|
39 |
C !INPUT/OUTPUT PARAMETERS: |
40 |
C == Routine arguments == |
41 |
C myTime :: time counter for this thread |
42 |
C myIter :: iteration counter for this thread |
43 |
C myThid :: Thread number for this instance of the routine. |
44 |
_RL myTime |
45 |
INTEGER myIter |
46 |
INTEGER myThid |
47 |
|
48 |
#if (defined (ALLOW_ADJOINT_RUN) || defined (ALLOW_ADMTLM)) |
49 |
#ifdef ALLOW_AUTODIFF_MONITOR |
50 |
|
51 |
C !FUNCTIONS: |
52 |
LOGICAL DIFFERENT_MULTIPLE |
53 |
EXTERNAL DIFFERENT_MULTIPLE |
54 |
|
55 |
C !LOCAL VARIABLES: |
56 |
c == local variables == |
57 |
C suff :: Hold suffix part of a filename |
58 |
C msgBuf :: Error message buffer |
59 |
INTEGER ip |
60 |
CHARACTER*(MAX_LEN_FNAM) suff1,suff2 |
61 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
62 |
CEOP |
63 |
|
64 |
IF ( |
65 |
& DIFFERENT_MULTIPLE(adjDumpFreq,myTime,deltaTClock) |
66 |
& ) THEN |
67 |
|
68 |
CALL TIMER_START('I/O (WRITE) [ADJOINT LOOP]', myThid ) |
69 |
|
70 |
C-- Set suffix for this set of data files. |
71 |
WRITE(suff1,'(I10.10)') myIter |
72 |
C ==>> Resetting run-time parameter writeBinaryPrec in the middle of a run |
73 |
C ==>> is very very very nasty !!! |
74 |
c writeBinaryPrec = writeStatePrec |
75 |
C <<== If you really want to mess-up with this at your own risk, |
76 |
C <<== uncomment the line above |
77 |
|
78 |
DO ip = 1, PTRACERS_numInUse |
79 |
WRITE(suff2,'(A10,A2,A1)') |
80 |
& 'ADJptracer',PTRACERS_ioLabel(ip),'.' |
81 |
|
82 |
CALL WRITE_FLD_XYZ_RL( |
83 |
& suff2,suff1, |
84 |
& adptracer(1-OLx,1-OLy,1,1,1,ip), 1, myThid ) |
85 |
|
86 |
ENDDO |
87 |
|
88 |
CALL TIMER_STOP( 'I/O (WRITE) [ADJOINT LOOP]', myThid ) |
89 |
|
90 |
ENDIF |
91 |
|
92 |
#endif /* ALLOW_AUTODIFF_MONITOR */ |
93 |
#endif /* ALLOW_ADJOINT_RUN */ |
94 |
|
95 |
RETURN |
96 |
END |