/[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.40 - (hide annotations) (download)
Mon Jul 30 20:39:18 2001 UTC (22 years, 10 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint40pre7, checkpoint40pre6, checkpoint40pre9, checkpoint40pre8, checkpoint40pre4, checkpoint40pre5, checkpoint40
Changes since 1.39: +5 -3 lines
Added a few re-initialisations for TAF.

1 heimbach 1.40 C $Header: /u/gcmpack/models/MITgcmUV/model/src/the_model_main.F,v 1.39 2001/07/13 14:26:57 heimbach Exp $
2     C $Name: checkpoint40pre2 $
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.40 #if ( defined (ALLOW_ADJOINT_RUN) || \
71     defined (ALLOW_GRADIENT_CHECK) || \
72     defined (ALLOW_ECCO_OPTIMIZATION) )
73 heimbach 1.37
74     _BEGIN_MASTER( mythid )
75     IF (myProcId .eq. 0) THEN
76     CALL CTRL_UNPACK( mycurrentiter, mycurrenttime, mythid )
77     ENDIF
78     _END_MASTER( mythid )
79     _BARRIER
80    
81     fc = 0.0
82     adfc = 1.0
83 heimbach 1.38 CALL TIMER_START('ADTHE_MAIN_LOOP [ADJOINT RUN]', mythid)
84 heimbach 1.39 CALL ADTHE_MAIN_LOOP ( mythid )
85     CALL TIMER_STOP ('ADTHE_MAIN_LOOP [ADJOINT RUN]', mythid)
86 heimbach 1.37 _BARRIER
87    
88     _BEGIN_MASTER( mythid )
89     IF (myProcId .eq. 0) THEN
90     call CTRL_PACK( mycurrentiter, mycurrenttime, mythid )
91     ENDIF
92     _END_MASTER( mythid )
93     _BARRIER
94    
95 heimbach 1.39 #ifdef ALLOW_GRADIENT_CHECK
96     if (useGrdchk) then
97     CALL TIMER_START('GRDCHK_MAIN [ADJOINT RUN]', mythid)
98     CALL GRDCHK_MAIN( mythid )
99     CALL TIMER_STOP ('GRDCHK_MAIN [ADJOINT RUN]', mythid)
100     _BARRIER
101     end if
102     #endif
103    
104     #else /* ALLOW_ADJOINT_RUN undef */
105 heimbach 1.37
106 adcroft 1.32 C-- Call time stepping loop of full model
107     CALL TIMER_START('THE_MAIN_LOOP [THE_MODEL_MAIN]',myThid)
108 heimbach 1.38 CALL THE_MAIN_LOOP(myCurrentTime, myCurrentIter, myThid )
109 adcroft 1.32 CALL TIMER_STOP ('THE_MAIN_LOOP [THE_MODEL_MAIN]',myThid)
110 adcroft 1.12
111 heimbach 1.39 #endif /* ALLOW_ADJOINT_RUN */
112 heimbach 1.38
113     C-- Final checkpoint (incase the in-loop checkpoint was missed)
114     CALL TIMER_START('WRITE_CHECKPOINT [THE_MODEL_MAIN]',myThid)
115     CALL WRITE_CHECKPOINT(
116     & .TRUE., myCurrentTime, myCurrentIter, myThid )
117     CALL TIMER_STOP ('WRITE_CHECKPOINT [THE_MODEL_MAIN]',myThid)
118 adcroft 1.19
119 adcroft 1.32 CALL TIMER_STOP ('ALL [THE_MODEL_MAIN]',myThid)
120 cnh 1.7
121 adcroft 1.19 C-- Write timer statistics
122 cnh 1.20 IF ( myThid .EQ. 1 ) THEN
123     CALL TIMER_PRINTALL( myThid )
124     CALL COMM_STATS
125     ENDIF
126 cnh 1.1
127     RETURN
128     END

  ViewVC Help
Powered by ViewVC 1.1.22