1 |
C $Header: /u/gcmpack/MITgcm/pkg/atm_compon_interf/cpl_export_import_data.F,v 1.4 2015/12/31 21:20:25 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "ATM_CPL_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
C !ROUTINE: CPL_EXPORT_IMPORT_DATA |
8 |
C !INTERFACE: |
9 |
SUBROUTINE CPL_EXPORT_IMPORT_DATA( |
10 |
I myTime, myIter, myThid ) |
11 |
|
12 |
C !DESCRIPTION: \bv |
13 |
C *==========================================================* |
14 |
C | SUBROUTINE CPL_EXPORT_IMPORT_DATA |
15 |
C | o Routine for controlling |
16 |
C | - export of coupling data to coupler layer AND |
17 |
C | - import of coupling data from coupler layer. |
18 |
C *==========================================================* |
19 |
C | This version talks to the MIT Coupler. It uses the MIT |
20 |
C | Coupler "checkpoint1" library calls. |
21 |
C *==========================================================* |
22 |
C \ev |
23 |
|
24 |
C !USES: |
25 |
IMPLICIT NONE |
26 |
|
27 |
C == Global variables == |
28 |
#include "SIZE.h" |
29 |
#include "EEPARAMS.h" |
30 |
#include "PARAMS.h" |
31 |
#include "CPL_PARAMS.h" |
32 |
|
33 |
C !INPUT/OUTPUT PARAMETERS: |
34 |
C == Routine arguments == |
35 |
C myTime :: Current time in simulation. |
36 |
C myIter :: Current timestep number. |
37 |
C myThid :: Thread number for this instance of the routine. |
38 |
_RL myTime |
39 |
INTEGER myIter |
40 |
INTEGER myThid |
41 |
CEOP |
42 |
|
43 |
#ifdef COMPONENT_MODULE |
44 |
C !LOCAL VARIABLES: |
45 |
C == Local variables == |
46 |
C bi, bj :: Tile indices |
47 |
C msgBuf :: Informational/error message buffer |
48 |
INTEGER bi, bj |
49 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
50 |
|
51 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
52 |
C Note MIT Coupler checkpoint1 does not allow asynchronous posting of |
53 |
C data, so ordering has to be consistent with coupling layer ordering. |
54 |
C-------------------------------------------------------------------------- |
55 |
C- Send data to coupling layer |
56 |
|
57 |
IF ( MOD(myIter,cplSendFrq_iter).EQ.0 ) THEN |
58 |
_BEGIN_MASTER( myThid ) |
59 |
IF ( debugMode .OR. countPrtExp.LT.maxNumberPrint ) THEN |
60 |
WRITE(msgBuf,'(A,I10)') |
61 |
& ' Exporting atmospheric surf fluxes at iter=', myIter |
62 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
63 |
& SQUEEZE_RIGHT, myThid ) |
64 |
countPrtExp = countPrtExp + 1 |
65 |
ENDIF |
66 |
_END_MASTER( myThid ) |
67 |
|
68 |
C- Store state variables (without averaging over cplSendFrq_iter time-steps) |
69 |
DO bj=myByLo(myThid),myByHi(myThid) |
70 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
71 |
c CALL ATM_STORE_DYNVARS( bi, bj, myTime, myIter, myThid ) |
72 |
IF ( useThSIce ) THEN |
73 |
CALL ATM_STORE_THSICE( bi, bj, myTime, myIter, myThid ) |
74 |
ENDIF |
75 |
ENDDO |
76 |
ENDDO |
77 |
|
78 |
C- Send data to coupler |
79 |
CALL ATM_EXPORT_FIELDS( myIter, myThid ) |
80 |
|
81 |
ENDIF |
82 |
|
83 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
84 |
C- Fetch data from coupling layer. |
85 |
|
86 |
IF ( MOD(myIter,cplSendFrq_iter).EQ.0 ) THEN |
87 |
_BEGIN_MASTER( myThid ) |
88 |
IF ( debugMode .OR. countPrtImp.LT.maxNumberPrint ) THEN |
89 |
WRITE(msgBuf,'(A,I10)') |
90 |
& ' Importing oceanic surface fields at iter=', myIter |
91 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
92 |
& SQUEEZE_RIGHT, myThid ) |
93 |
countPrtImp = countPrtImp + 1 |
94 |
ENDIF |
95 |
_END_MASTER( myThid ) |
96 |
|
97 |
CALL ATM_IMPORT_FIELDS( myIter, myThid ) |
98 |
|
99 |
C Fill diagnostics with updated coupling fields just received from Coupler |
100 |
CALL CPL_DIAGNOSTICS_FILL( myTime, myIter, myThid ) |
101 |
|
102 |
ENDIF |
103 |
|
104 |
#endif /* COMPONENT_MODULE */ |
105 |
|
106 |
RETURN |
107 |
END |