/[MITgcm]/MITgcm/pkg/ecco/ecco_the_model_main.F
ViewVC logotype

Contents of /MITgcm/pkg/ecco/ecco_the_model_main.F

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


Revision 1.1.2.2 - (show annotations) (download)
Wed Feb 6 22:55:38 2002 UTC (22 years, 3 months ago) by heimbach
Branch: ecco-branch
CVS Tags: ecco_c44_e19, ecco_c44_e18, ecco_c44_e16, ecco-branch-mod3, ecco-branch-mod4, ecco-branch-mod5, ecco_c44_e17, ecco_c44_e22, ecco_c44_e23, ecco_c44_e20, ecco_c44_e21, ecco_c44_e26, ecco_c44_e24, ecco_c44_e25, ecco_ice2, ecco_ice1
Branch point for: c24_e25_ice
Changes since 1.1.2.1: +3 -3 lines
Parameter lists were inconsistent between MITgcm and ECCO;
this affected shared grdchk package.

1 C $Header: /u/gcmpack/MITgcm/pkg/ecco/Attic/ecco_the_model_main.F,v 1.1.2.1 2002/02/05 20:23:59 heimbach Exp $
2 C $Name: $
3
4 #include "CPP_OPTIONS.h"
5
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 IMPLICIT NONE
27 C
28 C == Global variables ===
29 #include "SIZE.h"
30 #include "EEPARAMS.h"
31 #include "PARAMS.h"
32 #include "DYNVARS.h"
33 #ifdef ALLOW_NONHYDROSTATIC
34 #include "CG3D.h"
35 #endif
36
37 #ifdef ALLOW_AUTODIFF_TAMC
38 #include "tamc.h"
39 #include "cost.h"
40 #include "adcost.h"
41 #endif
42
43 C == Routine arguments ==
44 C myThid - Thread number for this instance of the routine.
45 INTEGER myThid
46
47 C == Local variables ==
48 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 C myCurrentTime - Time counter for this thread
54 C myCurrentIter - Iteration counter for this thread
55 INTEGER myCurrentIter
56 _RL myCurrentTime
57
58 C-- This timer encompasses the whole code
59 CALL TIMER_START('ALL [THE_MODEL_MAIN]',myThid)
60
61
62 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
67 myCurrentTime = startTime
68 myCurrentIter = nIter0
69
70 #if ( defined (ALLOW_ADJOINT_RUN) || \
71 defined (ALLOW_GRADIENT_CHECK) || \
72 defined (ALLOW_ECCO_OPTIMIZATION) )
73
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 CALL TIMER_START('ADTHE_MAIN_LOOP [ADJOINT RUN]', mythid)
84 CALL ADTHE_MAIN_LOOP ( mythid )
85 CALL TIMER_STOP ('ADTHE_MAIN_LOOP [ADJOINT RUN]', mythid)
86 _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 #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
106 C-- Call time stepping loop of full model
107 CALL TIMER_START('THE_MAIN_LOOP [THE_MODEL_MAIN]',myThid)
108 CALL THE_MAIN_LOOP( myCurrentTime, myCurrentIter, myThid )
109 CALL TIMER_STOP ('THE_MAIN_LOOP [THE_MODEL_MAIN]',myThid)
110
111 #endif /* ALLOW_ADJOINT_RUN */
112
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
119 CALL TIMER_STOP ('ALL [THE_MODEL_MAIN]',myThid)
120
121 C-- Write timer statistics
122 IF ( myThid .EQ. 1 ) THEN
123 CALL TIMER_PRINTALL( myThid )
124 CALL COMM_STATS
125 ENDIF
126
127 RETURN
128 END

  ViewVC Help
Powered by ViewVC 1.1.22