/[MITgcm]/MITgcm/pkg/atm_ocn_coupler/cpl_check_cplconfig.F
ViewVC logotype

Annotation of /MITgcm/pkg/atm_ocn_coupler/cpl_check_cplconfig.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (hide annotations) (download)
Thu Nov 12 00:49:04 2015 UTC (8 years, 7 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, HEAD
Changes since 1.1: +19 -9 lines
Start a new way to set-up optionally-exchanged variables (previously, only
 there for exchange_DIC): switch on/off from 1 place, at run-time, in coupler
 data.cpl (new) instead of at compile time in ATMIDS.h & OCNIDS.h :
- change parameter file from "data" to "data.cpl" (in cpl_read_params.F),
  and read namelist directly (without eessup S/R calls) instead of
  in the very un-flexible old way, 1 param per line, in fixed order;
- add error-counter to track errors (e.g., missing "data.cpl") and to stop
  cleanly in CPL_CHECK_CPLCONFIG
- add new coupling-exchange selectors (some not yet active) including
  cpl_exchange_DIC (to set to 3 to replace atmCpl_exchange_DIC=T in ATMIDS.h
                                       and ocnCpl_exchange_DIC=T in OCNIDS.h);
- add 2 new S/R (CPL_SEND_ATM/OCN_CPLPARMS) to send coupler-params to each
  component ; called directly from coupler.F, after comp. registrations;

1 jmc 1.2 C $Header: /u/gcmpack/MITgcm/pkg/atm_ocn_coupler/cpl_check_cplconfig.F,v 1.1 2013/12/02 23:25:38 jmc Exp $
2 jmc 1.1 C $Name: $
3    
4     #include "CPP_OPTIONS.h"
5    
6     CBOP 0
7     C !ROUTINE: CPL_CHECK_CPLCONFIG
8    
9     C !INTERFACE:
10     SUBROUTINE CPL_CHECK_CPLCONFIG(
11     I msgUnit,
12     U errFlag, errMsg )
13    
14     C !DESCRIPTION:
15     C *==========================================================*
16     C | SUBROUTINE CPL_CHECK_CPLCONFIG
17     C | o Routine to check Coupler config
18     C *==========================================================*
19     C | This routine also set the number of coupler time-step
20     C | to run
21     C *==========================================================*
22    
23     C !USES:
24     IMPLICIT NONE
25     C == Global variables ==
26     #include "ATMSIZE.h"
27     #include "OCNSIZE.h"
28     #include "ATMVARS.h"
29     #include "OCNVARS.h"
30     #include "CPL_PARAMS.h"
31     #include "CPL_MAP2GRIDS.h"
32    
33     C !INPUT/OUTPUT PARAMETERS:
34     C msgUnit :: log-file I/O unit
35     C errFlag :: logical flag to report an error
36 jmc 1.2 C errMsg :: error message to print to clog file
37 jmc 1.1 INTEGER msgUnit
38     LOGICAL errFlag
39     CHARACTER*(*) errMsg
40    
41     C !LOCAL VARIABLES:
42     INTEGER i, j, n
43     INTEGER ijo, ija
44     LOGICAL tmpVar(Nx_atm,Ny_atm)
45     CEOP
46    
47 jmc 1.2 C-- Report previously found errors
48     IF ( cplErrorCount.NE.0 ) THEN
49     errFlag = .TRUE.
50     WRITE(msgUnit,'(2A,I4,A)')
51     & ' *** ERROR *** CPL_CHECK_CPLCONFIG: ',
52     & ' cplErrorCount=', cplErrorCount, ' (from previous error)'
53     ENDIF
54    
55 jmc 1.1 C-- Define length of the run (number of coupler time-step)
56     WRITE(msgUnit,'(2A,I9)') ' CPL_CHECK_CPLCONFIG: ',
57     & 'Nb of time-steps to run (ATM) =', nSteps_atm
58     WRITE(msgUnit,'(2A,I9)') ' CPL_CHECK_CPLCONFIG: ',
59     & 'Nb of time-steps to run (OCN) =', nSteps_ocn
60     IF ( nSteps_atm .EQ. nSteps_ocn ) THEN
61     nCouplingSteps = nSteps_ocn
62     WRITE(msgUnit,'(2A,I9)') ' CPL_CHECK_CPLCONFIG: ',
63     & 'Nb of time-steps to run (CPL) =', nCouplingSteps
64     ELSE
65     errFlag = .TRUE.
66     nCouplingSteps = 0
67     WRITE(msgUnit,'(2A)') ' *** ERROR *** CPL_CHECK_CPLCONFIG: ',
68     & ' wrong Nb of time-steps to run'
69     ENDIF
70    
71     C-- Check for consistent RunOff mapping regarding Land/Sea mask:
72     DO j=1,Ny_atm
73     DO i=1,Nx_atm
74     tmpVar(i,j) = landMask_atm(i,j) .EQ. 1. _d 0
75     ENDDO
76     ENDDO
77     DO n=1,nROmap
78     C a) check that RunOff drain a land point
79     ija = ijROatm(n) - 1
80     i = 1 + MOD(ija,Nx_atm)
81     j = 1 + ija/Nx_atm
82     IF ( landMask_atm(i,j).EQ.0. ) THEN
83     errFlag = .TRUE.
84     WRITE(msgUnit,'(A,2I8,A)')
85     & ' *** ERROR *** RunOff Mapp: i,j=', i, j, ' not Land point'
86     ENDIF
87     tmpVar(i,j) = .FALSE.
88     C b) and supply an ocean point
89     ijo = ijROocn(n) - 1
90     i = 1 + MOD(ijo,Nx_ocn)
91     j = 1 + ijo/Nx_ocn
92     IF ( OcMxlD_ocn(i,j).EQ.0. ) THEN
93     errFlag = .TRUE.
94     WRITE(msgUnit,'(A,2I8,A)')
95     & ' *** ERROR *** RunOff Mapp: i,j=', i, j, ' not Oce point'
96     ENDIF
97     ENDDO
98     C c) check that all land-points are drained,
99     C note: would need to know ATM grid-cell area to check that
100     C RunOff Mapping conserve water.
101 jmc 1.2 IF ( cplErrorCount.EQ.0 ) THEN
102     DO j=1,Ny_atm
103     DO i=1,Nx_atm
104     IF ( tmpVar(i,j) ) THEN
105     WRITE(msgUnit,'(A,2I8,A)')
106 jmc 1.1 & ' ** WARNING ** Land point: i,j=', i, j, ' not drained'
107 jmc 1.2 ENDIF
108     ENDDO
109 jmc 1.1 ENDDO
110 jmc 1.2 ENDIF
111 jmc 1.1
112     IF ( errFlag ) THEN
113 jmc 1.2 errMsg = 'CPL_CHECK_CPLCONFIG: inconsistent CPL/ATM/OCN config'
114 jmc 1.1 ELSE
115     WRITE(msgUnit,'(2A)') ' CPL_CHECK_CPLCONFIG: ','done'
116     ENDIF
117    
118     RETURN
119     END

  ViewVC Help
Powered by ViewVC 1.1.22