1 |
C $Header: /u/gcmpack/MITgcm/pkg/ocn_compon_interf/cpl_export_import_data.F,v 1.3 2015/11/12 20:04:16 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "OCN_CPL_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
C !ROUTINE: CPL_EXPORT_IMPORT_DATA |
8 |
|
9 |
C !INTERFACE: |
10 |
SUBROUTINE CPL_EXPORT_IMPORT_DATA( |
11 |
I myTime, myIter, myThid ) |
12 |
|
13 |
C !DESCRIPTION: \bv |
14 |
C *==========================================================* |
15 |
C | SUBROUTINE CPL_EXPORT_IMPORT_DATA |
16 |
C | o Routine for controlling |
17 |
C | - export of coupling data to coupler layer AND |
18 |
C | - import of coupling data from coupler layer. |
19 |
C *==========================================================* |
20 |
C | This version talks to the MIT Coupler. It uses the MIT |
21 |
C | Coupler "checkpoint1" library calls. |
22 |
C *==========================================================* |
23 |
C \ev |
24 |
|
25 |
C !USES |
26 |
IMPLICIT NONE |
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 msgBuf :: Informational/error message buffer |
46 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
47 |
|
48 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
49 |
C Note MIT Coupler checkpoint1 does not allow asynchronous posting of |
50 |
C data, so ordering has to be consistent with coupling layer ordering. |
51 |
C-------------------------------------------------------------------------- |
52 |
C Synchronous coupling: Send data to coupling layer |
53 |
|
54 |
IF ( .NOT.ocn_cplSequential ) THEN |
55 |
IF ( debugMode ) THEN |
56 |
_BEGIN_MASTER( myThid ) |
57 |
WRITE(msgBuf,'(A,I10)') |
58 |
& ' Exporting oceanic surface fields at iter=', myIter |
59 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
60 |
& SQUEEZE_RIGHT, myThid ) |
61 |
_END_MASTER( myThid ) |
62 |
ENDIF |
63 |
|
64 |
CALL OCN_STORE_MY_DATA( |
65 |
I myTime, myIter, myThid ) |
66 |
|
67 |
CALL OCN_EXPORT_FIELDS ( myIter, myThid ) |
68 |
|
69 |
ENDIF |
70 |
|
71 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
72 |
C- Fetch data from coupling layer. |
73 |
|
74 |
IF ( .TRUE. ) THEN |
75 |
IF ( debugMode ) THEN |
76 |
_BEGIN_MASTER( myThid ) |
77 |
WRITE(msgBuf,'(A,I10)') |
78 |
& ' Importing atmospheric surf fluxes at iter=', myIter |
79 |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
80 |
& SQUEEZE_RIGHT, myThid ) |
81 |
_END_MASTER( myThid ) |
82 |
ENDIF |
83 |
|
84 |
CALL OCN_IMPORT_FIELDS ( myIter, myThid ) |
85 |
|
86 |
C Fill diagnostics with updated coupling fields just received from Coupler |
87 |
CALL CPL_DIAGNOSTICS_FILL( myTime, myIter, myThid ) |
88 |
|
89 |
ENDIF |
90 |
|
91 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
92 |
|
93 |
#ifndef ALLOW_THSICE |
94 |
C Sequential coupling: Send data to coupling layer |
95 |
C call also OCN_CPL_DIAGS (to cumulate cpl time-ave) in both cases |
96 |
C (Synchronous or Sequential coupling) |
97 |
CALL OCN_EXPORT_DATA( myTime, myIter, myThid ) |
98 |
#endif /* ndef ALLOW_THSICE */ |
99 |
|
100 |
C If compiling pkg/thsice, do it later by calling the same S/R |
101 |
C directly from DO_OCEANIC_PHYS, just after SEAICE_MODEL call. |
102 |
|
103 |
#endif /* COMPONENT_MODULE */ |
104 |
|
105 |
RETURN |
106 |
END |