| 1 |
heimbach |
1.1 |
C $Header: /u/gcmpack/MITgcm/pkg/streamice/streamice_ad_dump.F,v 1.6 2009/08/27 18:00:01 jmc Exp $ |
| 2 |
|
|
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 |
|
|
double precision adarea_shelf_streamice(1-olx:snx+olx,1-oly:sny+ |
| 66 |
|
|
$oly,nsx,nsy) |
| 67 |
|
|
double precision adc_basal_friction(1-olx:snx+olx,1-oly:sny+oly, |
| 68 |
|
|
$nsx,nsy) |
| 69 |
|
|
double precision adh_streamice(1-olx:snx+olx,1-oly:sny+oly,nsx, |
| 70 |
|
|
$nsy) |
| 71 |
|
|
double precision adsurf_el_streamice(1-olx:snx+olx,1-oly:sny+oly, |
| 72 |
|
|
$nsx,nsy) |
| 73 |
|
|
double precision adtau_beta_eff_streamice(1-olx:snx+olx,1-oly:sny+ |
| 74 |
|
|
$oly,nsx,nsy) |
| 75 |
|
|
double precision adu_streamice(1-olx:snx+olx,1-oly:sny+oly,nsx, |
| 76 |
|
|
$nsy) |
| 77 |
|
|
double precision adv_streamice(1-olx:snx+olx,1-oly:sny+oly,nsx, |
| 78 |
|
|
$nsy) |
| 79 |
|
|
double precision advisc_streamice(1-olx:snx+olx,1-oly:sny+oly,nsx, |
| 80 |
|
|
$nsy) |
| 81 |
|
|
common /adstreamice_fields_rl/ adh_streamice, adu_streamice, |
| 82 |
|
|
$adv_streamice, advisc_streamice, adtau_beta_eff_streamice, |
| 83 |
|
|
$adsurf_el_streamice, adarea_shelf_streamice, adc_basal_friction |
| 84 |
|
|
c |
| 85 |
|
|
double precision adr_low(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
| 86 |
|
|
common /adgrid_rs/ adr_low |
| 87 |
|
|
|
| 88 |
|
|
c == end of interface == |
| 89 |
|
|
CEOP |
| 90 |
|
|
|
| 91 |
|
|
IF ( |
| 92 |
|
|
& DIFFERENT_MULTIPLE(streamice_adjDump,mytime,deltaTClock) |
| 93 |
|
|
& ) THEN |
| 94 |
|
|
|
| 95 |
|
|
C-- Set suffix for this set of data files. |
| 96 |
|
|
WRITE(suff,'(I10.10)') myIter |
| 97 |
|
|
writeBinaryPrec = writeStatePrec |
| 98 |
|
|
|
| 99 |
|
|
C-- Read IO error counter |
| 100 |
|
|
beginIOErrCount = IO_ERRCOUNT(myThid) |
| 101 |
|
|
|
| 102 |
|
|
CALL WRITE_REC_3D_RL( |
| 103 |
|
|
& 'ADJc_basal_friction.'//suff, writeBinaryPrec, |
| 104 |
|
|
& 1, adc_basal_friction, 1, myIter, myThid ) |
| 105 |
|
|
CALL WRITE_REC_3D_RL( |
| 106 |
|
|
& 'ADJh_streamice.'//suff, writeBinaryPrec, |
| 107 |
|
|
& 1, adh_streamice, 1, myIter, myThid ) |
| 108 |
|
|
CALL WRITE_REC_3D_RL( |
| 109 |
|
|
& 'ADJr_low.'//suff, writeBinaryPrec, |
| 110 |
|
|
& 1, adr_low, 1, myIter, myThid ) |
| 111 |
|
|
|
| 112 |
|
|
ENDIF |
| 113 |
|
|
|
| 114 |
|
|
#endif /* ALLOW_ADJOINT_RUN */ |
| 115 |
|
|
|
| 116 |
|
|
RETURN |
| 117 |
|
|
END |