/[MITgcm]/MITgcm/model/src/forward_step.F
ViewVC logotype

Annotation of /MITgcm/model/src/forward_step.F

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


Revision 1.4 - (hide annotations) (download)
Mon Nov 13 16:32:58 2000 UTC (23 years, 6 months ago) by heimbach
Branch: MAIN
CVS Tags: branch-atmos-merge-start, checkpoint33, checkpoint32, checkpoint34
Branch point for: branch-atmos-merge
Changes since 1.3: +1 -2 lines
Rescaling of forcing fields done immediately after reading fields.

1 heimbach 1.4 C $Header: /u/gcmpack/models/MITgcmUV/model/src/forward_step.F,v 1.3 2000/09/11 20:54:37 heimbach Exp $
2 adcroft 1.1
3     #include "CPP_OPTIONS.h"
4    
5     SUBROUTINE FORWARD_STEP(
6     I doHalfStep, iLoop,
7     U myCurrentTime, myCurrentIter,
8     & myThid)
9     C /==========================================================\
10     C | SUBROUTINE FORWARD_STEP |
11     C | o Does one instance of the model time stepping |
12     C | The time stepping loop in THE_MAIN_LOOP() calls |
13     C | this routine |
14     C |==========================================================|
15     C \==========================================================/
16     IMPLICIT NONE
17     C
18     C Call Tree
19     C =========
20     C
21     C THE_MAIN_LOOP()
22     C |
23     C ==> | ** Time stepping loop starts here **
24     C | |
25     C /|\ |-FORWARD_STEP
26     C | | |
27     C | | |--LOAD_EXTERNAL_DATA
28     C /|\ | | o Load and/or set time dependent forcing fields
29     C | | |
30     C /|\ | |--DYNAMICS
31     C | | | o Evaluate "forward" terms
32     C /|\ | |
33     C | | |--DO_THE_MODEL_IO
34     C /|\ | | o Write model state
35     C | | |
36     C /|\ | |--SOLVE_FOR_PRESSURE
37     C | | | o Find pressure field to keep flow non-divergent
38     C /|\ | |
39     C | | |--DO_GTERM_BLOCKING_EXCHANGES
40     C /|\ | | o Update overlap regions
41     C | | |
42     C /|\ | |--WRITE_CHECKPOINT
43     C | | | o Write restart file(s)
44     C /|\ |
45     C | |
46     C |<== | ** Time stepping loop finishes here **
47     C
48    
49     C == Global variables ===
50     #include "SIZE.h"
51     #include "EEPARAMS.h"
52     #include "PARAMS.h"
53     #include "DYNVARS.h"
54     #include "CG2D.h"
55     #ifdef ALLOW_NONHYDROSTATIC
56     #include "CG3D.h"
57     #endif
58    
59     C == Routine arguments ==
60     C doHalfStep - If .TRUE. then this is the last half step
61     C iLoop - Invocation count (counter in THE_MAIN_LOOP)
62     C myCurrentIter - Iteration counter for this thread
63     C myCurrentTime - Time counter for this thread
64     C myThid - Thread number for this instance of the routine.
65     LOGICAL doHalfStep
66     INTEGER iLoop
67     INTEGER myCurrentIter
68     _RL myCurrentTime
69     INTEGER myThid
70    
71     C == Local variables ==
72    
73     C-- Load forcing/external data fields
74     CALL TIMER_START('I/O (READ) [FORWARD_STEP]',myThid)
75 heimbach 1.3 CALL EXTERNAL_FIELDS_LOAD( myCurrentTime, myCurrentIter, myThid )
76 adcroft 1.1 CALL TIMER_STOP ('I/O (READ) [FORWARD_STEP]',myThid)
77    
78     #ifdef INCLUDE_SHAPIRO_FILTER_CODE
79     C-- Step forward all tiles, filter and exchange.
80     CALL TIMER_START('SHAP_FILT [FORWARD_STEP]',myThid)
81     CALL SHAP_FILT( myCurrentTime, myCurrentIter, myThid )
82     CALL TIMER_STOP ('SHAP_FILT [FORWARD_STEP]',myThid)
83     #endif
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     C-- Do IO if needed.
100     C Note:
101     C =====
102     C At this point model arrays hold U,V,T,S at "time-level" N
103     C and cg2d_x at "time-level" N-1/2 where N = I+timeLevBase-1.
104     C By convention this is taken to be the model "state".
105     CALL TIMER_START('I/O (WRITE) [FORWARD_STEP]',myThid)
106     CALL DO_THE_MODEL_IO(
107     & doHalfStep, myCurrentTime, myCurrentIter, myThid )
108     CALL TIMER_STOP ('I/O (WRITE) [FORWARD_STEP]',myThid)
109    
110    
111     IF (.NOT. doHalfStep) THEN
112    
113     C-- Solve elliptic equation(s).
114     C Two-dimensional only for conventional hydrostatic or
115     C three-dimensional for non-hydrostatic and/or IGW scheme.
116     CALL TIMER_START('SOLVE_FOR_PRESSURE [FORWARD_STEP]',myThid)
117     CALL SOLVE_FOR_PRESSURE( myThid )
118     CALL TIMER_STOP ('SOLVE_FOR_PRESSURE [FORWARD_STEP]',myThid)
119    
120     C-- Do "blocking" sends and receives for tendency "overlap" terms
121     CALL TIMER_START('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid)
122     CALL DO_GTERM_BLOCKING_EXCHANGES( myThid )
123     CALL TIMER_STOP ('BLOCKING_EXCHANGES [FORWARD_STEP]',myThid)
124    
125     c myCurrentIter = myCurrentIter + 1
126     c myCurrentTime = myCurrentTime + deltaTClock
127     myCurrentIter = nIter0 + iLoop
128     myCurrentTime = startTime + deltaTClock * float(iLoop)
129    
130     C-- Save state for restarts
131     C Note:
132     C =====
133     C Because of the ordering of the timestepping code and
134     C tendency term code at end of loop model arrays hold
135     C U,V,T,S at "time-level" N but gu, gv, gs, gt, guNM1,...
136     C at "time-level" N+1/2 (guNM1 at "time-level" N+1/2 is
137     C gu at "time-level" N-1/2) and cg2d_x at "time-level" N+1/2.
138     C where N = I+timeLevBase-1
139     C Thus a checkpoint contains U.0000000000, GU.0000000001 and
140     C cg2d_x.0000000001 in the indexing scheme used for the model
141     C "state" files. This example is referred to as a checkpoint
142     C at time level 1
143     CALL TIMER_START('I/O (WRITE) [FORWARD_STEP]',myThid)
144     CALL WRITE_CHECKPOINT(
145     & .FALSE., myCurrentTime, myCurrentIter, myThid )
146     CALL TIMER_STOP ('I/O (WRITE) [FORWARD_STEP]',myThid)
147    
148     ENDIF
149    
150     RETURN
151     END

  ViewVC Help
Powered by ViewVC 1.1.22