3 |
|
|
4 |
#include "CPP_OPTIONS.h" |
#include "CPP_OPTIONS.h" |
5 |
|
|
|
CStartOfInterface |
|
6 |
SUBROUTINE INI_CG2D( myThid ) |
SUBROUTINE INI_CG2D( myThid ) |
7 |
C /==========================================================\ |
C /==========================================================\ |
8 |
C | SUBROUTINE INI_CG2D | |
C | SUBROUTINE INI_CG2D | |
18 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
19 |
#include "PARAMS.h" |
#include "PARAMS.h" |
20 |
#include "GRID.h" |
#include "GRID.h" |
21 |
#include "DYNVARS.h" |
c#include "DYNVARS.h" |
22 |
#include "SURFACE.h" |
#include "SURFACE.h" |
23 |
#include "CG2D_INTERNAL.h" |
#include "CG2D.h" |
24 |
#ifdef ALLOW_OBCS |
#ifdef ALLOW_OBCS |
25 |
#include "OBCS.h" |
#include "OBCS.h" |
26 |
#endif |
#endif |
28 |
C === Routine arguments === |
C === Routine arguments === |
29 |
C myThid - Thread no. that called this routine. |
C myThid - Thread no. that called this routine. |
30 |
INTEGER myThid |
INTEGER myThid |
|
CEndOfInterface |
|
31 |
|
|
32 |
C === Local variables === |
C === Local variables === |
33 |
C xG, yG - Global coordinate location. |
C xG, yG - Global coordinate location. |
36 |
C bi,bj - Loop counters |
C bi,bj - Loop counters |
37 |
C faceArea - Temporary used to hold cell face areas. |
C faceArea - Temporary used to hold cell face areas. |
38 |
C I,J,K |
C I,J,K |
39 |
C myNorm - Work variable used in clculating normalisation factor |
C myNorm - Work variable used in calculating normalisation factor |
40 |
|
C sumArea - Work variable used to compute the total Domain Area |
41 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
42 |
INTEGER bi, bj |
INTEGER bi, bj |
43 |
INTEGER I, J, K |
INTEGER I, J, K |
44 |
_RL faceArea |
_RL faceArea |
45 |
_RS myNorm |
_RS myNorm |
46 |
|
_RL sumArea |
47 |
_RL aC, aCw, aCs |
_RL aC, aCw, aCs |
48 |
|
|
49 |
C-- Initialise -Boyancy at surface level : Bo_surf |
C-- Initialise -Boyancy at surface level : Bo_surf |
166 |
C CALL PLOT_FIELD_XYRS( aW2d, 'AW2D INI_CG2D.1' , 1, myThid ) |
C CALL PLOT_FIELD_XYRS( aW2d, 'AW2D INI_CG2D.1' , 1, myThid ) |
167 |
C CALL PLOT_FIELD_XYRS( aS2d, 'AS2D INI_CG2D.1' , 1, myThid ) |
C CALL PLOT_FIELD_XYRS( aS2d, 'AS2D INI_CG2D.1' , 1, myThid ) |
168 |
CcnhDebugEnds |
CcnhDebugEnds |
169 |
_EXCH_XY_R4(aW2d, myThid) |
c _EXCH_XY_R4(aW2d, myThid) |
170 |
_EXCH_XY_R4(aS2d, myThid) |
c _EXCH_XY_R4(aS2d, myThid) |
171 |
|
CALL EXCH_UV_XY_RS(aW2d,aS2d,.FALSE.,myThid) |
172 |
CcnhDebugStarts |
CcnhDebugStarts |
173 |
C CALL PLOT_FIELD_XYRS( aW2d, 'AW2D INI_CG2D.2' , 1, myThid ) |
C CALL PLOT_FIELD_XYRS( aW2d, 'AW2D INI_CG2D.2' , 1, myThid ) |
174 |
C CALL PLOT_FIELD_XYRS( aS2d, 'AS2D INI_CG2D.2' , 1, myThid ) |
C CALL PLOT_FIELD_XYRS( aS2d, 'AS2D INI_CG2D.2' , 1, myThid ) |
175 |
CcnhDebugEnds |
CcnhDebugEnds |
176 |
|
|
177 |
|
C-- Define the solver tolerance in the appropriate Unit : |
178 |
|
cg2dNormaliseRHS = cg2dTargetResWunit.LE.0 |
179 |
|
IF (cg2dNormaliseRHS) THEN |
180 |
|
C- when using a normalisation of RHS, tolerance has no unit => no conversion |
181 |
|
cg2dTolerance = cg2dTargetResidual |
182 |
|
ELSE |
183 |
|
C- compute the total Area of the domain : |
184 |
|
sumArea = 0. |
185 |
|
DO bj=myByLo(myThid),myByHi(myThid) |
186 |
|
DO bi=myBxLo(myThid),myBxHi(myThid) |
187 |
|
DO j=1,sNy |
188 |
|
DO i=1,sNx |
189 |
|
IF (Ro_surf(i,j,bi,bj).GT.R_low(i,j,bi,bj)) THEN |
190 |
|
sumArea = sumArea + rA(i,j,bi,bj) |
191 |
|
ENDIF |
192 |
|
ENDDO |
193 |
|
ENDDO |
194 |
|
ENDDO |
195 |
|
ENDDO |
196 |
|
c WRITE(0,*) ' mythid, sumArea = ', mythid, sumArea |
197 |
|
_GLOBAL_SUM_R8( sumArea, myThid ) |
198 |
|
C- convert Target-Residual (in W unit) to cg2d-solver residual unit [m^2/s^2] |
199 |
|
cg2dTolerance = cg2dNorm * cg2dTargetResWunit |
200 |
|
& * sumArea / deltaTMom |
201 |
|
WRITE(0,'(2A,1P2E22.14)') ' ini_cg2d: ', |
202 |
|
& 'sumArea,cg2dTolerance =', sumArea,cg2dTolerance |
203 |
|
ENDIF |
204 |
|
|
205 |
C-- Initialise preconditioner |
C-- Initialise preconditioner |
206 |
C Note. 20th May 1998 |
C Note. 20th May 1998 |
207 |
C I made a weird discovery! In the model paper we argue |
C I made a weird discovery! In the model paper we argue |
265 |
ENDDO |
ENDDO |
266 |
C-- Update overlap regions |
C-- Update overlap regions |
267 |
_EXCH_XY_R4(pC, myThid) |
_EXCH_XY_R4(pC, myThid) |
268 |
_EXCH_XY_R4(pW, myThid) |
c _EXCH_XY_R4(pW, myThid) |
269 |
_EXCH_XY_R4(pS, myThid) |
c _EXCH_XY_R4(pS, myThid) |
270 |
|
CALL EXCH_UV_XY_RS(pW,pS,.FALSE.,myThid) |
271 |
CcnhDebugStarts |
CcnhDebugStarts |
272 |
C CALL PLOT_FIELD_XYRS( pC, 'pC INI_CG2D.2' , 1, myThid ) |
C CALL PLOT_FIELD_XYRS( pC, 'pC INI_CG2D.2' , 1, myThid ) |
273 |
C CALL PLOT_FIELD_XYRS( pW, 'pW INI_CG2D.2' , 1, myThid ) |
C CALL PLOT_FIELD_XYRS( pW, 'pW INI_CG2D.2' , 1, myThid ) |