1 |
jmc |
1.8 |
C $Header: /u/gcmpack/models/MITgcmUV/model/src/forward_step.F,v 1.7 2001/02/14 22:50:10 jmc Exp $ |
2 |
|
|
C $Name: $ |
3 |
adcroft |
1.1 |
|
4 |
|
|
#include "CPP_OPTIONS.h" |
5 |
|
|
|
6 |
|
|
SUBROUTINE FORWARD_STEP( |
7 |
jmc |
1.7 |
I iLoop, |
8 |
adcroft |
1.1 |
U myCurrentTime, myCurrentIter, |
9 |
|
|
& myThid) |
10 |
|
|
C /==========================================================\ |
11 |
|
|
C | SUBROUTINE FORWARD_STEP | |
12 |
|
|
C | o Does one instance of the model time stepping | |
13 |
|
|
C | The time stepping loop in THE_MAIN_LOOP() calls | |
14 |
|
|
C | this routine | |
15 |
|
|
C |==========================================================| |
16 |
|
|
C \==========================================================/ |
17 |
|
|
IMPLICIT NONE |
18 |
|
|
C |
19 |
|
|
C Call Tree |
20 |
|
|
C ========= |
21 |
|
|
C |
22 |
|
|
C THE_MAIN_LOOP() |
23 |
|
|
C | |
24 |
|
|
C ==> | ** Time stepping loop starts here ** |
25 |
|
|
C | | |
26 |
|
|
C /|\ |-FORWARD_STEP |
27 |
|
|
C | | | |
28 |
adcroft |
1.5 |
C /|\ | |--LOAD_EXTERNAL_DATA |
29 |
|
|
C | | | o Load and/or set time dependent forcing fields |
30 |
|
|
C /|\ | | |
31 |
|
|
C | | |--DYNAMICS |
32 |
|
|
C /|\ | | o Evaluate "forward" terms |
33 |
adcroft |
1.1 |
C | | | |
34 |
|
|
C /|\ | | |
35 |
adcroft |
1.5 |
C | | |--SOLVE_FOR_PRESSURE |
36 |
|
|
C /|\ | | o Find pressure field to keep flow non-divergent |
37 |
|
|
C | | | |
38 |
|
|
C /|\ | | |
39 |
|
|
C | | |--THE_CORRECTION_STEP |
40 |
|
|
C /|\ | | o Correct flow field with pressure gradient |
41 |
|
|
C | | | and cycle time-stepping arrays (for all fields) |
42 |
adcroft |
1.1 |
C /|\ | | |
43 |
|
|
C | | |--DO_GTERM_BLOCKING_EXCHANGES |
44 |
|
|
C /|\ | | o Update overlap regions |
45 |
|
|
C | | | |
46 |
adcroft |
1.5 |
C /|\ | | |
47 |
jmc |
1.7 |
C | | |--DO_THE_MODEL_IO |
48 |
|
|
C /|\ | | o Write model state |
49 |
|
|
C | | | |
50 |
|
|
C /|\ | | |
51 |
adcroft |
1.5 |
C | | |--WRITE_CHECKPOINT |
52 |
|
|
C /|\ | | o Write restart file(s) |
53 |
|
|
C | | |
54 |
adcroft |
1.1 |
C /|\ | |
55 |
|
|
C |<== | ** Time stepping loop finishes here ** |
56 |
|
|
C |
57 |
|
|
|
58 |
|
|
C == Global variables === |
59 |
|
|
#include "SIZE.h" |
60 |
|
|
#include "EEPARAMS.h" |
61 |
|
|
#include "PARAMS.h" |
62 |
|
|
#include "DYNVARS.h" |
63 |
|
|
#include "CG2D.h" |
64 |
|
|
#ifdef ALLOW_NONHYDROSTATIC |
65 |
|
|
#include "CG3D.h" |
66 |
|
|
#endif |
67 |
|
|
|
68 |
|
|
C == Routine arguments == |
69 |
|
|
C iLoop - Invocation count (counter in THE_MAIN_LOOP) |
70 |
|
|
C myCurrentIter - Iteration counter for this thread |
71 |
|
|
C myCurrentTime - Time counter for this thread |
72 |
|
|
C myThid - Thread number for this instance of the routine. |
73 |
|
|
INTEGER iLoop |
74 |
|
|
INTEGER myCurrentIter |
75 |
|
|
_RL myCurrentTime |
76 |
|
|
INTEGER myThid |
77 |
|
|
|
78 |
|
|
C == Local variables == |
79 |
|
|
|
80 |
|
|
C-- Load forcing/external data fields |
81 |
|
|
CALL TIMER_START('I/O (READ) [FORWARD_STEP]',myThid) |
82 |
heimbach |
1.3 |
CALL EXTERNAL_FIELDS_LOAD( myCurrentTime, myCurrentIter, myThid ) |
83 |
adcroft |
1.1 |
CALL TIMER_STOP ('I/O (READ) [FORWARD_STEP]',myThid) |
84 |
|
|
|
85 |
|
|
C-- Step forward fields and calculate time tendency terms |
86 |
|
|
CALL TIMER_START('DYNAMICS [FORWARD_STEP]',myThid) |
87 |
|
|
CALL DYNAMICS( myCurrentTime, myCurrentIter, myThid ) |
88 |
|
|
CALL TIMER_STOP ('DYNAMICS [FORWARD_STEP]',myThid) |
89 |
|
|
|
90 |
|
|
#ifdef ALLOW_NONHYDROSTATIC |
91 |
|
|
C-- Step forward W field in N-H algorithm |
92 |
|
|
IF ( nonHydrostatic ) THEN |
93 |
|
|
CALL TIMER_START('CALC_GW [FORWARD_STEP]',myThid) |
94 |
|
|
CALL CALC_GW( myThid) |
95 |
|
|
CALL TIMER_STOP ('CALC_GW [FORWARD_STEP]',myThid) |
96 |
|
|
ENDIF |
97 |
|
|
#endif |
98 |
|
|
|
99 |
adcroft |
1.5 |
#ifdef ALLOW_SHAP_FILT |
100 |
|
|
C-- Step forward all tiles, filter and exchange. |
101 |
|
|
CALL TIMER_START('SHAP_FILT [FORWARD_STEP]',myThid) |
102 |
|
|
CALL SHAP_FILT_APPLY( |
103 |
|
|
I gUnm1, gVnm1, gTnm1, gSnm1, |
104 |
|
|
I myCurrentTime, myCurrentIter, myThid ) |
105 |
|
|
CALL TIMER_STOP ('SHAP_FILT [FORWARD_STEP]',myThid) |
106 |
|
|
#endif |
107 |
|
|
|
108 |
|
|
#ifdef ALLOW_ZONAL_FILT |
109 |
jmc |
1.8 |
IF (zonal_filt_lat.LT.90.) THEN |
110 |
adcroft |
1.5 |
CALL ZONAL_FILT_APPLY( |
111 |
|
|
U gUnm1, gVnm1, gTnm1, gSnm1, |
112 |
|
|
I myThid ) |
113 |
jmc |
1.8 |
ENDIF |
114 |
adcroft |
1.5 |
#endif |
115 |
|
|
|
116 |
adcroft |
1.1 |
C-- Solve elliptic equation(s). |
117 |
|
|
C Two-dimensional only for conventional hydrostatic or |
118 |
|
|
C three-dimensional for non-hydrostatic and/or IGW scheme. |
119 |
|
|
CALL TIMER_START('SOLVE_FOR_PRESSURE [FORWARD_STEP]',myThid) |
120 |
|
|
CALL SOLVE_FOR_PRESSURE( myThid ) |
121 |
|
|
CALL TIMER_STOP ('SOLVE_FOR_PRESSURE [FORWARD_STEP]',myThid) |
122 |
|
|
|
123 |
adcroft |
1.5 |
C-- Correct divergence in flow field and cycle time-stepping |
124 |
jmc |
1.7 |
C arrays (for all fields) ; update time-counter |
125 |
|
|
myCurrentIter = nIter0 + iLoop |
126 |
|
|
myCurrentTime = startTime + deltaTClock * float(iLoop) |
127 |
adcroft |
1.5 |
CALL THE_CORRECTION_STEP(myCurrentTime, myCurrentIter, myThid) |
128 |
|
|
|
129 |
adcroft |
1.1 |
C-- Do "blocking" sends and receives for tendency "overlap" terms |
130 |
jmc |
1.7 |
c CALL TIMER_START('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
131 |
|
|
c CALL DO_GTERM_BLOCKING_EXCHANGES( myThid ) |
132 |
|
|
c CALL TIMER_STOP ('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
133 |
adcroft |
1.5 |
|
134 |
|
|
C-- Do "blocking" sends and receives for field "overlap" terms |
135 |
adcroft |
1.1 |
CALL TIMER_START('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
136 |
adcroft |
1.5 |
CALL DO_FIELDS_BLOCKING_EXCHANGES( myThid ) |
137 |
adcroft |
1.1 |
CALL TIMER_STOP ('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid) |
138 |
|
|
|
139 |
jmc |
1.7 |
C-- Do IO if needed. |
140 |
|
|
CALL TIMER_START('I/O (WRITE) [FORWARD_STEP]',myThid) |
141 |
|
|
CALL DO_THE_MODEL_IO(.FALSE., |
142 |
|
|
& myCurrentTime, myCurrentIter, myThid ) |
143 |
|
|
CALL TIMER_STOP ('I/O (WRITE) [FORWARD_STEP]',myThid) |
144 |
adcroft |
1.1 |
|
145 |
|
|
C-- Save state for restarts |
146 |
jmc |
1.7 |
C Note: (jmc: is it still the case after ckp35 ?) |
147 |
adcroft |
1.1 |
C ===== |
148 |
|
|
C Because of the ordering of the timestepping code and |
149 |
|
|
C tendency term code at end of loop model arrays hold |
150 |
|
|
C U,V,T,S at "time-level" N but gu, gv, gs, gt, guNM1,... |
151 |
|
|
C at "time-level" N+1/2 (guNM1 at "time-level" N+1/2 is |
152 |
|
|
C gu at "time-level" N-1/2) and cg2d_x at "time-level" N+1/2. |
153 |
|
|
C where N = I+timeLevBase-1 |
154 |
|
|
C Thus a checkpoint contains U.0000000000, GU.0000000001 and |
155 |
|
|
C cg2d_x.0000000001 in the indexing scheme used for the model |
156 |
|
|
C "state" files. This example is referred to as a checkpoint |
157 |
|
|
C at time level 1 |
158 |
|
|
CALL TIMER_START('I/O (WRITE) [FORWARD_STEP]',myThid) |
159 |
|
|
CALL WRITE_CHECKPOINT( |
160 |
|
|
& .FALSE., myCurrentTime, myCurrentIter, myThid ) |
161 |
|
|
CALL TIMER_STOP ('I/O (WRITE) [FORWARD_STEP]',myThid) |
162 |
|
|
|
163 |
|
|
|
164 |
|
|
RETURN |
165 |
|
|
END |