1 |
dgoldberg |
1.5 |
C $Header: /u/gcmpack/MITgcm/pkg/streamice/streamice_dump_ad.F,v 1.2 2014/05/25 08:16:14 dgoldberg Exp $ |
2 |
heimbach |
1.1 |
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "AD_CONFIG.h" |
5 |
|
|
#include "PACKAGES_CONFIG.h" |
6 |
|
|
#include "STREAMICE_OPTIONS.h" |
7 |
|
|
|
8 |
|
|
CBOP |
9 |
|
|
C !ROUTINE: adstreamice_dump |
10 |
|
|
C !INTERFACE: |
11 |
|
|
subroutine adstreamice_dump( mytime, myiter, myThid ) |
12 |
|
|
|
13 |
|
|
C !DESCRIPTION: \bv |
14 |
|
|
C *==========================================================* |
15 |
|
|
C | SUBROUTINE adstreamice_dump | |
16 |
|
|
C *==========================================================* |
17 |
|
|
C Extract adjoint variable from TAMC/TAF-generated |
18 |
|
|
C adjoint common blocks, contained in adcommon.h |
19 |
|
|
C and write fields to file; |
20 |
|
|
C Make sure common blocks in adcommon.h are up-to-date |
21 |
|
|
C w.r.t. current adjoint code. |
22 |
|
|
C *==========================================================* |
23 |
|
|
C \ev |
24 |
|
|
|
25 |
|
|
C !USES: |
26 |
|
|
IMPLICIT NONE |
27 |
|
|
|
28 |
|
|
C == Global variables === |
29 |
|
|
#include "SIZE.h" |
30 |
|
|
#include "EEPARAMS.h" |
31 |
|
|
#include "PARAMS.h" |
32 |
|
|
#include "STREAMICE.h" |
33 |
|
|
#include "GRID.h" |
34 |
|
|
#ifdef ALLOW_AUTODIFF_MONITOR |
35 |
|
|
# include "adcommon.h" |
36 |
|
|
#endif |
37 |
|
|
|
38 |
|
|
LOGICAL DIFFERENT_MULTIPLE |
39 |
|
|
EXTERNAL DIFFERENT_MULTIPLE |
40 |
|
|
INTEGER IO_ERRCOUNT |
41 |
|
|
EXTERNAL IO_ERRCOUNT |
42 |
|
|
|
43 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
44 |
|
|
C == Routine arguments == |
45 |
|
|
C myIter - iteration counter for this thread |
46 |
|
|
C myTime - time counter for this thread |
47 |
|
|
C myThid - Thread number for this instance of the routine. |
48 |
|
|
integer myThid |
49 |
|
|
integer myiter |
50 |
|
|
_RL mytime |
51 |
|
|
|
52 |
|
|
#if (defined (ALLOW_ADJOINT_RUN) || defined (ALLOW_ADMTLM)) |
53 |
|
|
|
54 |
|
|
C !LOCAL VARIABLES: |
55 |
|
|
c == local variables == |
56 |
|
|
C suff - Hold suffix part of a filename |
57 |
|
|
C beginIOErrCount - Begin and end IO error counts |
58 |
|
|
C endIOErrCount |
59 |
|
|
C msgBuf - Error message buffer |
60 |
|
|
CHARACTER*(MAX_LEN_FNAM) suff |
61 |
|
|
INTEGER beginIOErrCount |
62 |
|
|
INTEGER endIOErrCount |
63 |
|
|
CHARACTER*(MAX_LEN_MBUF) msgBuf |
64 |
|
|
|
65 |
dgoldberg |
1.5 |
double precision :: area_shelf_streamice_ad(1-olx:snx+olx,1-oly: |
66 |
|
|
$sny+oly,nsx,nsy) |
67 |
|
|
double precision :: b_glen_ad(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
68 |
|
|
double precision :: bdot_streamice_ad(1-olx:snx+olx,1-oly:sny+oly, |
69 |
|
|
$nsx,nsy) |
70 |
|
|
double precision :: c_basal_friction_ad(1-olx:snx+olx,1-oly:sny+ |
71 |
|
|
$oly,nsx,nsy) |
72 |
|
|
double precision :: float_frac_streamice_ad(1-olx:snx+olx,1-oly: |
73 |
|
|
$sny+oly,nsx,nsy) |
74 |
|
|
double precision :: h_streamice_ad(1-olx:snx+olx,1-oly:sny+oly, |
75 |
|
|
$nsx,nsy) |
76 |
|
|
double precision :: surf_el_streamice_ad(1-olx:snx+olx,1-oly:sny+ |
77 |
heimbach |
1.1 |
$oly,nsx,nsy) |
78 |
dgoldberg |
1.5 |
double precision :: tau_beta_eff_streamice_ad(1-olx:snx+olx,1-oly: |
79 |
|
|
$sny+oly,nsx,nsy) |
80 |
|
|
double precision :: u_streamice_ad(1-olx:snx+olx,1-oly:sny+oly, |
81 |
|
|
$nsx,nsy) |
82 |
|
|
double precision :: v_streamice_ad(1-olx:snx+olx,1-oly:sny+oly, |
83 |
heimbach |
1.1 |
$nsx,nsy) |
84 |
dgoldberg |
1.5 |
double precision :: visc_streamice_ad(1-olx:snx+olx,1-oly:sny+oly, |
85 |
heimbach |
1.1 |
$nsx,nsy) |
86 |
dgoldberg |
1.5 |
common /streamice_fields_rl_ad/ h_streamice_ad, u_streamice_ad, |
87 |
|
|
$v_streamice_ad, visc_streamice_ad, tau_beta_eff_streamice_ad, |
88 |
|
|
$float_frac_streamice_ad, surf_el_streamice_ad, |
89 |
|
|
$area_shelf_streamice_ad, c_basal_friction_ad, b_glen_ad, |
90 |
|
|
$bdot_streamice_ad |
91 |
|
|
|
92 |
dgoldberg |
1.3 |
#ifdef USE_ALT_RLOW |
93 |
dgoldberg |
1.5 |
double precision :: r_low_si_ad(1-olx:snx+olx,1-oly:sny+oly,nsx, |
94 |
dgoldberg |
1.3 |
$nsy) |
95 |
dgoldberg |
1.5 |
common /streamice_rlow_ad/ r_low_si_ad |
96 |
dgoldberg |
1.3 |
#endif |
97 |
heimbach |
1.1 |
|
98 |
|
|
c == end of interface == |
99 |
|
|
CEOP |
100 |
|
|
|
101 |
|
|
IF ( |
102 |
|
|
& DIFFERENT_MULTIPLE(streamice_adjDump,mytime,deltaTClock) |
103 |
|
|
& ) THEN |
104 |
|
|
|
105 |
|
|
C-- Set suffix for this set of data files. |
106 |
|
|
WRITE(suff,'(I10.10)') myIter |
107 |
|
|
writeBinaryPrec = writeStatePrec |
108 |
|
|
|
109 |
|
|
C-- Read IO error counter |
110 |
|
|
beginIOErrCount = IO_ERRCOUNT(myThid) |
111 |
|
|
|
112 |
|
|
CALL WRITE_REC_3D_RL( |
113 |
|
|
& 'ADJc_basal_friction.'//suff, writeBinaryPrec, |
114 |
dgoldberg |
1.5 |
& 1, c_basal_friction_ad, 1, myIter, myThid ) |
115 |
heimbach |
1.1 |
CALL WRITE_REC_3D_RL( |
116 |
|
|
& 'ADJh_streamice.'//suff, writeBinaryPrec, |
117 |
dgoldberg |
1.5 |
& 1, h_streamice_ad, 1, myIter, myThid ) |
118 |
dgoldberg |
1.3 |
#ifdef USE_ALT_RLOW |
119 |
|
|
CALL WRITE_REC_3D_RL( |
120 |
|
|
& 'ADJr_low.'//suff, writeBinaryPrec, |
121 |
dgoldberg |
1.5 |
& 1, r_low_si_ad, 1, myIter, myThid ) |
122 |
dgoldberg |
1.3 |
#endif |
123 |
dgoldberg |
1.2 |
CALL WRITE_REC_3D_RL( |
124 |
dgoldberg |
1.4 |
& 'ADJb_glen.'//suff, writeBinaryPrec, |
125 |
dgoldberg |
1.5 |
& 1, b_glen_ad, 1, myIter, myThid ) |
126 |
dgoldberg |
1.2 |
CALL WRITE_REC_3D_RL( |
127 |
|
|
& 'ADJbdot.'//suff, writeBinaryPrec, |
128 |
dgoldberg |
1.5 |
& 1, bdot_streamice_ad, 1, myIter, myThid ) |
129 |
heimbach |
1.1 |
|
130 |
|
|
ENDIF |
131 |
|
|
|
132 |
|
|
#endif /* ALLOW_ADJOINT_RUN */ |
133 |
|
|
|
134 |
|
|
RETURN |
135 |
|
|
END |