1 |
C $Header: /u/gcmpack/MITgcm/pkg/atm_compon_interf/cpl_exch_configs.F,v 1.3 2009/12/24 16:49:08 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "CPP_OPTIONS.h" |
5 |
|
6 |
CBOP 0 |
7 |
C !ROUTINE: CPL_EXCH_CONFIGS |
8 |
|
9 |
C !INTERFACE: |
10 |
SUBROUTINE CPL_EXCH_CONFIGS( myThid ) |
11 |
|
12 |
C !DESCRIPTION: |
13 |
C *==========================================================* |
14 |
C | SUBROUTINE CPL_EXCH_CONFIGS |
15 |
C | o Controlling routine for initial config exchange between |
16 |
C | component models and atmosphere component. |
17 |
C | - Atmospheric version - |
18 |
C *==========================================================* |
19 |
C | Controls the import of configuration information |
20 |
C | (grid/topography,etc...) from other components and the |
21 |
C | export of configuration information from this component. |
22 |
C | The routine does some basic checking on consistency |
23 |
C | components and summarizes the information that has been |
24 |
C | imported. |
25 |
C | The routine will need to be customised for different |
26 |
C | styles of coupled run. The coupler requires consistency |
27 |
C | between sending and receiving operations posted by |
28 |
C | various components. Therefore changes in one component |
29 |
C | model CPL_EXCH_CONFIG may require changes in other |
30 |
C | component models CPL_EXCH_CONFIG routines as well |
31 |
C | as in the coupler EXCH_COMPONENT_CONFIG routine. |
32 |
C *==========================================================* |
33 |
|
34 |
C !USES: |
35 |
IMPLICIT NONE |
36 |
C == Global variables == |
37 |
#include "SIZE.h" |
38 |
#include "EEPARAMS.h" |
39 |
#include "PARAMS.h" |
40 |
#include "GRID.h" |
41 |
#include "ATMCPL.h" |
42 |
|
43 |
C !INPUT/OUTPUT PARAMETERS: |
44 |
C myThid :: Thread number for this instance of the routine |
45 |
INTEGER myThid |
46 |
|
47 |
C !LOCAL VARIABLES: |
48 |
INTEGER i, j, bi, bj |
49 |
LOGICAL errFlag |
50 |
CHARACTER*70 errMsg |
51 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
52 |
_RL atm_waterOnly, atm_landOnly, mxlD_noWater |
53 |
C-- local variable in common block |
54 |
_RL landMask_loc(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
55 |
COMMON / CPL_EXCH_CONFIGS_LOC / landMask_loc |
56 |
CEOP |
57 |
|
58 |
errFlag = .FALSE. |
59 |
|
60 |
C Get configuration information (=land/sea mask) from other pkg |
61 |
CALL ATM_GET_ATMCONFIG( |
62 |
O landMask_loc, |
63 |
I myThid ) |
64 |
|
65 |
C Post my configuration information to the coupler "layer". |
66 |
CALL ATM_EXPORT_ATMCONFIG( |
67 |
U errFlag, |
68 |
I landMask_loc, myThid ) |
69 |
|
70 |
C Import other component model(s) configuration(s) from the coupler "layer" |
71 |
C o Get ocean model configuration |
72 |
CALL ATM_IMPORT_OCNCONFIG( myThid ) |
73 |
|
74 |
C Summarise fields that were imported. |
75 |
C o Plot ocean depths |
76 |
IF ( debugLevel.GE.debLevB ) THEN |
77 |
CALL WRITE_FLD_XY_RL( 'Ocn_MxlD', ' ', ocMxlD, 0, myThid ) |
78 |
ENDIF |
79 |
IF ( debugLevel.GE.debLevC ) THEN |
80 |
CALL PLOT_FIELD_XYRL( ocMxlD, |
81 |
& 'Ocean mixed-layer depth on atmos grid', |
82 |
& 1, myThid ) |
83 |
ENDIF |
84 |
|
85 |
C Do consistency checks on imported fields. |
86 |
C o Check that: |
87 |
C a) where land/sea mask is "water-only", this should be a wet ocean pts |
88 |
C b) where land/sea mask has "no water", this should be a dry ocean pts |
89 |
_BARRIER |
90 |
_BEGIN_MASTER( myThid ) |
91 |
atm_waterOnly = 0. _d 0 |
92 |
atm_landOnly = 1. _d 0 |
93 |
mxlD_noWater = 0. _d 0 |
94 |
DO bj=1,nSy |
95 |
DO bi=1,nSx |
96 |
DO j=1,sNy |
97 |
DO i=1,sNx |
98 |
IF ( ( landMask_loc(i,j,bi,bj) .EQ. atm_waterOnly |
99 |
& .AND. ocMxlD(i,j,bi,bj) .EQ. mxlD_noWater ) |
100 |
& .OR. ( landMask_loc(i,j,bi,bj) .EQ. atm_landOnly |
101 |
& .AND. ocMxlD(i,j,bi,bj) .NE. mxlD_noWater ) ) THEN |
102 |
errFlag = .TRUE. |
103 |
WRITE(msgBuf,'(2(A,I6),2(A,I4),A)') |
104 |
& 'Inconsistent land/sea mask @ (i=', i, ',j=', j, |
105 |
& ',bi=', bi, ',bj=', bj, ')' |
106 |
CALL PRINT_ERROR( msgBuf, myThid ) |
107 |
WRITE(msgBuf,'(A,E30.15)') |
108 |
& 'Land (atmosphere) ==', landMask_loc(i,j,bi,bj) |
109 |
CALL PRINT_ERROR( msgBuf, myThid ) |
110 |
WRITE(msgBuf,'(A,E30.15)') |
111 |
& 'Mxl-Depth (ocean) ==', ocMxlD(i,j,bi,bj) |
112 |
CALL PRINT_ERROR( msgBuf, myThid ) |
113 |
ENDIF |
114 |
ENDDO |
115 |
ENDDO |
116 |
ENDDO |
117 |
ENDDO |
118 |
|
119 |
errMsg = ' ' |
120 |
IF ( errFlag ) WRITE(errMsg,'(A)') |
121 |
& 'ATM_EXCH_CONFIGS: Oce & Atm configs are inconsistent' |
122 |
|
123 |
C-- All procs in World check for error and stop if any |
124 |
CALL MITCPLR_ALL_CHECK( errFlag, errMsg ) |
125 |
|
126 |
_END_MASTER( myThid ) |
127 |
_BARRIER |
128 |
|
129 |
RETURN |
130 |
END |