1 |
C $Header: /u/gcmpack/MITgcm/model/src/load_fields_driver.F,v 1.23 2017/09/11 17:29:59 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "PACKAGES_CONFIG.h" |
5 |
#include "CPP_OPTIONS.h" |
6 |
#ifdef ALLOW_AUTODIFF |
7 |
# include "AUTODIFF_OPTIONS.h" |
8 |
#endif |
9 |
#ifdef ALLOW_COST |
10 |
# include "COST_OPTIONS.h" |
11 |
#endif |
12 |
#ifdef ALLOW_CTRL |
13 |
# include "CTRL_OPTIONS.h" |
14 |
#endif |
15 |
#ifdef ALLOW_EXF |
16 |
# include "EXF_OPTIONS.h" |
17 |
#endif |
18 |
|
19 |
CBOP |
20 |
C !ROUTINE: LOAD_FIELDS_DRIVER |
21 |
C !INTERFACE: |
22 |
SUBROUTINE LOAD_FIELDS_DRIVER( myTime, myIter, myThid ) |
23 |
|
24 |
C !DESCRIPTION: \bv |
25 |
C *================================================================== |
26 |
C | SUBROUTINE LOAD_FIELDS_DRIVER |
27 |
C | o Load external forcing fields from file |
28 |
C *================================================================== |
29 |
C *================================================================== |
30 |
C \ev |
31 |
|
32 |
C !CALLING SEQUENCE: |
33 |
C LOAD_FIELDS_DRIVER |
34 |
C | |
35 |
C |-- BULKF_FIELDS_LOAD |
36 |
C | |
37 |
C |-- EXF_GETFORCING |
38 |
C | |
39 |
C |-- CHEAPAML_FIELDS_LOAD |
40 |
C | |
41 |
C |-- EXTERNAL_FIELDS_LOAD |
42 |
C | |
43 |
C |-- GCHEM_FIELDS_LOAD |
44 |
C | |
45 |
C |-- RBCS_FIELDS_LOAD |
46 |
C | |
47 |
C |-- AIM_FIELDS_LOAD |
48 |
|
49 |
C !USES: |
50 |
IMPLICIT NONE |
51 |
C == Global variables == |
52 |
#include "SIZE.h" |
53 |
#include "EEPARAMS.h" |
54 |
#include "PARAMS.h" |
55 |
#include "FFIELDS.h" |
56 |
|
57 |
#ifdef ALLOW_AUTODIFF |
58 |
# include "tamc.h" |
59 |
# ifdef ALLOW_CTRL |
60 |
# include "CTRL_SIZE.h" |
61 |
# include "ctrl.h" |
62 |
# include "ctrl_dummy.h" |
63 |
# endif |
64 |
# ifdef ALLOW_COST |
65 |
# include "cost.h" |
66 |
# endif |
67 |
# include "EOS.h" |
68 |
# ifdef ALLOW_EXF |
69 |
# include "EXF_FIELDS.h" |
70 |
# include "EXF_CONSTANTS.h" |
71 |
# endif |
72 |
#endif /* ALLOW_AUTODIFF */ |
73 |
|
74 |
C !INPUT/OUTPUT PARAMETERS: |
75 |
C myTime :: time counter for this thread |
76 |
C myIter :: iteration counter for this thread |
77 |
C myThid :: thread number for this instance of the routine. |
78 |
_RL myTime |
79 |
INTEGER myIter |
80 |
INTEGER myThid |
81 |
|
82 |
C !LOCAL VARIABLES: |
83 |
#if (defined ALLOW_ADDFLUID) || (defined ALLOW_FRICTION_HEATING) |
84 |
INTEGER i,j,k,bi,bj |
85 |
#endif |
86 |
CEOP |
87 |
|
88 |
#ifdef ALLOW_DEBUG |
89 |
IF (debugMode) CALL DEBUG_ENTER( 'LOAD_FIELDS_DRIVER', myThid ) |
90 |
#endif |
91 |
|
92 |
C-- Initialise forcing arrays that may receive multiple contributions |
93 |
#ifdef ALLOW_ADDFLUID |
94 |
IF ( selectAddFluid.NE.0 .AND. addMassFile.EQ.' ' ) THEN |
95 |
DO bj=myByLo(myThid),myByHi(myThid) |
96 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
97 |
DO k=1,Nr |
98 |
DO j=1-OLy,sNy+OLy |
99 |
DO i=1-OLx,sNx+OLx |
100 |
addMass(i,j,k,bi,bj) = 0. _d 0 |
101 |
ENDDO |
102 |
ENDDO |
103 |
ENDDO |
104 |
ENDDO |
105 |
ENDDO |
106 |
ENDIF |
107 |
#endif /* ALLOW_ADDFLUID */ |
108 |
|
109 |
#ifdef ALLOW_FRICTION_HEATING |
110 |
IF ( addFrictionHeating .AND. staggerTimeStep ) THEN |
111 |
DO bj=myByLo(myThid),myByHi(myThid) |
112 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
113 |
DO k=1,Nr |
114 |
DO j=1-OLy,sNy+OLy |
115 |
DO i=1-OLx,sNx+OLx |
116 |
frictionHeating(i,j,k,bi,bj) = 0. _d 0 |
117 |
ENDDO |
118 |
ENDDO |
119 |
ENDDO |
120 |
ENDDO |
121 |
ENDDO |
122 |
ENDIF |
123 |
#endif /* ALLOW_FRICTION_HEATING */ |
124 |
|
125 |
C-- Map generic time varying controls to xx_gentim2d |
126 |
#ifdef ALLOW_CTRL |
127 |
if (useCTRL) CALL CTRL_MAP_GENTIM2D( myTime, myIter, myThid ) |
128 |
#endif |
129 |
|
130 |
#ifdef ALLOW_BULK_FORCE |
131 |
IF ( useBulkForce ) THEN |
132 |
C-- Bulk-Formulae pkg: load all forcing fields at current time |
133 |
#ifdef ALLOW_DEBUG |
134 |
IF (debugMode) CALL DEBUG_CALL('BULKF_FIELDS_LOAD',myThid) |
135 |
#endif |
136 |
CALL TIMER_START('BULKF_FIELDS_LOAD [LOAD_FLDS_DRIVER]',myThid) |
137 |
CALL BULKF_FIELDS_LOAD( myTime, myIter, myThid ) |
138 |
CALL TIMER_STOP ('BULKF_FIELDS_LOAD [LOAD_FLDS_DRIVER]',myThid) |
139 |
ENDIF |
140 |
#endif /* ALLOW_BULK_FORCE */ |
141 |
|
142 |
C-- Call external forcing package |
143 |
#ifdef ALLOW_EXF |
144 |
IF (useEXF) THEN |
145 |
# ifdef ALLOW_DEBUG |
146 |
IF (debugMode) CALL DEBUG_CALL('EXF_GETFORCING',myThid) |
147 |
# endif |
148 |
CALL TIMER_START('EXF_GETFORCING [LOAD_FLDS_DRIVER]',myThid) |
149 |
CALL EXF_GETFORCING( myTime, myIter, myThid ) |
150 |
CALL TIMER_STOP ('EXF_GETFORCING [LOAD_FLDS_DRIVER]',myThid) |
151 |
ENDIF |
152 |
#endif /* ALLOW_EXF */ |
153 |
|
154 |
C-- Call external CheapAML forcing package |
155 |
#ifdef ALLOW_CHEAPAML |
156 |
IF ( useCheapAML ) THEN |
157 |
#ifdef ALLOW_DEBUG |
158 |
IF (debugMode) CALL DEBUG_CALL('CHEAPAML_FIELDS_LOAD',myThid) |
159 |
#endif |
160 |
CALL CHEAPAML_FIELDS_LOAD( myTime, myIter, myThid ) |
161 |
ENDIF |
162 |
#endif /*ALLOW_CHEAPAML */ |
163 |
|
164 |
IF ( fluidIsWater ) THEN |
165 |
#ifdef ALLOW_DEBUG |
166 |
IF (debugMode) CALL DEBUG_CALL('EXTERNAL_FIELDS_LOAD',myThid) |
167 |
#endif |
168 |
CALL TIMER_START('EXTERNAL_FLDS_LOAD [LOAD_FLDS_DRIVER]',myThid) |
169 |
CALL EXTERNAL_FIELDS_LOAD( myTime, myIter, myThid ) |
170 |
CALL TIMER_STOP ('EXTERNAL_FLDS_LOAD [LOAD_FLDS_DRIVER]',myThid) |
171 |
#ifdef NONLIN_FRSURF |
172 |
CADJ STORE SST = comlev1, key = ikey_dynamics, kind = isbyte |
173 |
CADJ STORE SSS = comlev1, key = ikey_dynamics, kind = isbyte |
174 |
# ifdef SHORTWAVE_HEATING |
175 |
CADJ STORE Qsw = comlev1, key = ikey_dynamics, kind = isbyte |
176 |
# endif |
177 |
#endif |
178 |
ENDIF |
179 |
|
180 |
#ifdef ALLOW_GCHEM |
181 |
IF ( useGCHEM ) THEN |
182 |
#ifdef ALLOW_DEBUG |
183 |
IF (debugMode) CALL DEBUG_CALL('GCHEM_FIELDS_LOAD',myThid) |
184 |
#endif /* ALLOW_DEBUG */ |
185 |
CALL GCHEM_FIELDS_LOAD( myTime, myIter, myThid ) |
186 |
ENDIF |
187 |
#endif /* ALLOW_GCHEM */ |
188 |
|
189 |
#ifdef ALLOW_RBCS |
190 |
IF ( useRBCS ) THEN |
191 |
CALL RBCS_FIELDS_LOAD( myTime, myIter, myThid ) |
192 |
ENDIF |
193 |
#endif |
194 |
|
195 |
#ifdef ALLOW_AIM |
196 |
IF ( useAIM ) THEN |
197 |
C- Update AIM bottom boundary data |
198 |
CALL AIM_FIELDS_LOAD( myTime, myIter, myThid ) |
199 |
ENDIF |
200 |
#endif |
201 |
|
202 |
#ifdef ALLOW_DEBUG |
203 |
IF (debugMode) CALL DEBUG_LEAVE( 'LOAD_FIELDS_DRIVER', myThid ) |
204 |
#endif |
205 |
|
206 |
RETURN |
207 |
END |