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

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

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


Revision 1.39 - (hide annotations) (download)
Fri Jul 13 14:26:57 2001 UTC (22 years, 10 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint40pre3, checkpoint40pre2
Changes since 1.38: +16 -78 lines
o Added grdchk package handling
o Added passive tracer handling

1 heimbach 1.39 C $Header: /u/gcmpack/models/MITgcmUV/model/src/the_model_main.F,v 1.38 2001/04/10 22:35:26 heimbach Exp $
2     C $Name: checkpoint39 $
3 cnh 1.1
4 adcroft 1.18 #include "CPP_OPTIONS.h"
5 cnh 1.1
6     SUBROUTINE THE_MODEL_MAIN(myThid)
7     C /==========================================================\
8     C | SUBROUTINE THE_MODEL_MAIN |
9     C | o Master controlling routine for model using the MITgcm |
10     C | UV parallel wrapper. |
11     C |==========================================================|
12     C | THE_MODEL_MAIN is invoked by the MITgcm UV parallel |
13     C | wrapper with a single integer argument "myThid". This |
14     C | variable identifies the thread number of an instance of |
15     C | THE_MODEL_MAIN. Each instance of THE_MODEL_MAIN works |
16     C | on a particular region of the models domain and |
17     C | synchronises with other instances as necessary. The |
18     C | routine has to "understand" the MITgcm parallel |
19     C | environment and the numerical algorithm. Editing this |
20     C | routine is best done with some knowledge of both aspects.|
21     C | Notes |
22     C | ===== |
23     C | C*P* comments indicating place holders for which code is |
24     C | presently being developed. |
25     C \==========================================================/
26 adcroft 1.24 IMPLICIT NONE
27 cnh 1.10 C
28 cnh 1.1 C == Global variables ===
29     #include "SIZE.h"
30     #include "EEPARAMS.h"
31     #include "PARAMS.h"
32 adcroft 1.26 #include "DYNVARS.h"
33 adcroft 1.27 #ifdef ALLOW_NONHYDROSTATIC
34 adcroft 1.26 #include "CG3D.h"
35 adcroft 1.27 #endif
36 cnh 1.1
37 heimbach 1.37 #ifdef ALLOW_AUTODIFF_TAMC
38     #include "tamc.h"
39     #include "cost.h"
40     #include "adcost.h"
41     #endif
42    
43 cnh 1.1 C == Routine arguments ==
44     C myThid - Thread number for this instance of the routine.
45 cnh 1.6 INTEGER myThid
46 cnh 1.1
47     C == Local variables ==
48 cnh 1.7 C Note: Under the multi-threaded model myCurrentIter and
49     C myCurrentTime are local variables passed around as routine
50     C arguments. Although this is fiddly it saves the need to
51     C impose additional synchronisation points when they are
52     C updated.
53 jmc 1.34 C myCurrentTime - Time counter for this thread
54     C myCurrentIter - Iteration counter for this thread
55     INTEGER myCurrentIter
56     _RL myCurrentTime
57 cnh 1.1
58 adcroft 1.19 C-- This timer encompasses the whole code
59 adcroft 1.32 CALL TIMER_START('ALL [THE_MODEL_MAIN]',myThid)
60 adcroft 1.19
61    
62 adcroft 1.32 C-- Set model configuration (fixed arrays)
63     CALL TIMER_START('INITIALISE_FIXED [THE_MODEL_MAIN]',myThid)
64     CALL INITIALISE_FIXED( myThid )
65     CALL TIMER_STOP ('INITIALISE_FIXED [THE_MODEL_MAIN]',myThid)
66 adcroft 1.26
67 jmc 1.34 myCurrentTime = startTime
68     myCurrentIter = nIter0
69    
70 heimbach 1.39 #ifdef ALLOW_ADJOINT_RUN
71 heimbach 1.37
72     _BEGIN_MASTER( mythid )
73     IF (myProcId .eq. 0) THEN
74     CALL CTRL_UNPACK( mycurrentiter, mycurrenttime, mythid )
75     ENDIF
76     _END_MASTER( mythid )
77     _BARRIER
78    
79     fc = 0.0
80     adfc = 1.0
81 heimbach 1.38 CALL TIMER_START('ADTHE_MAIN_LOOP [ADJOINT RUN]', mythid)
82 heimbach 1.39 CALL ADTHE_MAIN_LOOP ( mythid )
83     CALL TIMER_STOP ('ADTHE_MAIN_LOOP [ADJOINT RUN]', mythid)
84 heimbach 1.37 _BARRIER
85    
86     _BEGIN_MASTER( mythid )
87     IF (myProcId .eq. 0) THEN
88     call CTRL_PACK( mycurrentiter, mycurrenttime, mythid )
89     ENDIF
90     _END_MASTER( mythid )
91     _BARRIER
92    
93 heimbach 1.39 #ifdef ALLOW_GRADIENT_CHECK
94     if (useGrdchk) then
95     CALL TIMER_START('GRDCHK_MAIN [ADJOINT RUN]', mythid)
96     CALL GRDCHK_MAIN( mythid )
97     CALL TIMER_STOP ('GRDCHK_MAIN [ADJOINT RUN]', mythid)
98     _BARRIER
99     end if
100     #endif
101    
102     #else /* ALLOW_ADJOINT_RUN undef */
103 heimbach 1.37
104 adcroft 1.32 C-- Call time stepping loop of full model
105     CALL TIMER_START('THE_MAIN_LOOP [THE_MODEL_MAIN]',myThid)
106 heimbach 1.38 CALL THE_MAIN_LOOP(myCurrentTime, myCurrentIter, myThid )
107 adcroft 1.32 CALL TIMER_STOP ('THE_MAIN_LOOP [THE_MODEL_MAIN]',myThid)
108 adcroft 1.12
109 heimbach 1.39 #endif /* ALLOW_ADJOINT_RUN */
110 heimbach 1.38
111     C-- Final checkpoint (incase the in-loop checkpoint was missed)
112     CALL TIMER_START('WRITE_CHECKPOINT [THE_MODEL_MAIN]',myThid)
113     CALL WRITE_CHECKPOINT(
114     & .TRUE., myCurrentTime, myCurrentIter, myThid )
115     CALL TIMER_STOP ('WRITE_CHECKPOINT [THE_MODEL_MAIN]',myThid)
116 adcroft 1.19
117 adcroft 1.32 CALL TIMER_STOP ('ALL [THE_MODEL_MAIN]',myThid)
118 cnh 1.7
119 adcroft 1.19 C-- Write timer statistics
120 cnh 1.20 IF ( myThid .EQ. 1 ) THEN
121     CALL TIMER_PRINTALL( myThid )
122     CALL COMM_STATS
123     ENDIF
124 cnh 1.1
125     RETURN
126     END

  ViewVC Help
Powered by ViewVC 1.1.22