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

Contents of /MITgcm/model/src/the_model_main.F

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


Revision 1.32 - (show annotations) (download)
Wed Apr 5 19:04:14 2000 UTC (24 years, 1 month ago) by adcroft
Branch: MAIN
CVS Tags: checkpoint28, checkpoint29, checkpoint27, branch-atmos-merge-freeze, branch-atmos-merge-start, branch-atmos-merge-shapiro, checkpoint33, checkpoint32, checkpoint31, checkpoint30, checkpoint34, branch-atmos-merge-zonalfilt, branch-atmos-merge-phase5, branch-atmos-merge-phase4, branch-atmos-merge-phase7, branch-atmos-merge-phase6, branch-atmos-merge-phase1, branch-atmos-merge-phase3, branch-atmos-merge-phase2
Branch point for: branch-atmos-merge
Changes since 1.31: +47 -165 lines
Restructered the calling tree between THE_MODEL_MAIN()
and DYNAMICS(). Two calling levels have been inserted
to better split the "fixed" initialization phase from
the main time-loop for easier connectivity with the adjoint
infrastructure.

The calling tree now looks like:

   the_model_main:
      initialise_fixed()
      the_main_loop()

   the_main_loop:
      initialise_varia()
      do i=1,nIters
         forward_step()
      enddo
      forward_step()

   forward_step:
      load_external_fields()
      dynamics()
      do_the_model_io()
      solve_for_pressure()
      do_gterm_blocking_exchanges()
      write_checkpoint()

1 C $Header: /u/gcmpack/models/MITgcmUV/model/src/the_model_main.F,v 1.31 1999/08/30 18:29:27 adcroft Exp $
2
3 #include "CPP_OPTIONS.h"
4
5 SUBROUTINE THE_MODEL_MAIN(myThid)
6 C /==========================================================\
7 C | SUBROUTINE THE_MODEL_MAIN |
8 C | o Master controlling routine for model using the MITgcm |
9 C | UV parallel wrapper. |
10 C |==========================================================|
11 C | THE_MODEL_MAIN is invoked by the MITgcm UV parallel |
12 C | wrapper with a single integer argument "myThid". This |
13 C | variable identifies the thread number of an instance of |
14 C | THE_MODEL_MAIN. Each instance of THE_MODEL_MAIN works |
15 C | on a particular region of the models domain and |
16 C | synchronises with other instances as necessary. The |
17 C | routine has to "understand" the MITgcm parallel |
18 C | environment and the numerical algorithm. Editing this |
19 C | routine is best done with some knowledge of both aspects.|
20 C | Notes |
21 C | ===== |
22 C | C*P* comments indicating place holders for which code is |
23 C | presently being developed. |
24 C \==========================================================/
25 IMPLICIT NONE
26 C
27 C Call Tree
28 C =========
29 C
30 C main ( eesupp )
31 C |
32 C .
33 C .
34 C . Generic environment initialisation ( see eesupp/src and
35 C . eesupp/inc )
36 C . multiple threads and/or processes are created in here
37 C .
38 C .
39 C .
40 C |
41 C |-THE_MODEL_MAIN - Begin specific model. One instance
42 C | | of this codes exists for each thread
43 C | | and/or instance. Each instance manages
44 C | | a specifc set of tiles.
45 C | |
46 C | |--INITIALISE_FIXED
47 C | | o Set model configuration (fixed arrays)
48 C | | Topography, hydrography, timestep, grid, etc..
49 C | |
50 C | |--THE_MAIN_LOOP
51 C | | |
52 C | | |--INITIALISE_VARIA
53 C | | | o Set initial conditions (variable arrays)
54 C | | |
55 C ==> | | | ** Time stepping loop starts here **
56 C | | | |
57 C /|\ | | |
58 C | | | |--FORWARD_STEP
59 C /|\ | | | | o Does a single forward step of the model
60 C | | | | |
61 C /|\ | | | |
62 C | | | | |--LOAD_EXTERNAL_DATA
63 C /|\ | | | | o Load and/or set time dependent forcing fields
64 C | | | | |
65 C /|\ | | | |--DYNAMICS
66 C | | | | | o Evaluate "forward" terms
67 C /|\ | | | |
68 C | | | | |--DO_THE_MODEL_IO
69 C /|\ | | | | o Write model state
70 C | | | | |
71 C /|\ | | | |--SOLVE_FOR_PRESSURE
72 C | | | | | o Find pressure field to keep flow non-divergent
73 C /|\ | | | |
74 C | | | | |--DO_GTERM_BLOCKING_EXCHANGES
75 C /|\ | | | | o Update overlap regions
76 C | | | | |
77 C /|\ | | | |--WRITE_CHECKPOINT
78 C | | | | | o Write restart file(s)
79 C /|\ | | |
80 C | | | |
81 C |<== | | | ** Time stepping loop finishes here **
82 C | | |
83 C | | |--
84 C | |
85 C | |--WRITE_STATE
86 C | |--WRITE_CHECKPOINT
87 C |
88 C .
89 C .
90 C . Generic environment termination ( see eesupp/src and
91 C . eesupp/inc )
92 C .
93 C .
94
95 C == Global variables ===
96 #include "SIZE.h"
97 #include "EEPARAMS.h"
98 #include "PARAMS.h"
99 #include "DYNVARS.h"
100 #include "CG2D.h"
101 #ifdef ALLOW_NONHYDROSTATIC
102 #include "CG3D.h"
103 #endif
104
105 C == Routine arguments ==
106 C myThid - Thread number for this instance of the routine.
107 INTEGER myThid
108
109 C == Local variables ==
110 C Note: Under the multi-threaded model myCurrentIter and
111 C myCurrentTime are local variables passed around as routine
112 C arguments. Although this is fiddly it saves the need to
113 C impose additional synchronisation points when they are
114 C updated.
115
116 C-- This timer encompasses the whole code
117 CALL TIMER_START('ALL [THE_MODEL_MAIN]',myThid)
118
119
120 C-- Set model configuration (fixed arrays)
121 CALL TIMER_START('INITIALISE_FIXED [THE_MODEL_MAIN]',myThid)
122 CALL INITIALISE_FIXED( myThid )
123 CALL TIMER_STOP ('INITIALISE_FIXED [THE_MODEL_MAIN]',myThid)
124
125
126 C-- Call time stepping loop of full model
127 CALL TIMER_START('THE_MAIN_LOOP [THE_MODEL_MAIN]',myThid)
128 CALL THE_MAIN_LOOP( myThid )
129 CALL TIMER_STOP ('THE_MAIN_LOOP [THE_MODEL_MAIN]',myThid)
130
131
132 CALL TIMER_STOP ('ALL [THE_MODEL_MAIN]',myThid)
133
134 C-- Write timer statistics
135 IF ( myThid .EQ. 1 ) THEN
136 CALL TIMER_PRINTALL( myThid )
137 CALL COMM_STATS
138 ENDIF
139
140 RETURN
141 END

  ViewVC Help
Powered by ViewVC 1.1.22