| 1 | ce107 | 1.1 | SUBROUTINE THE_MODEL_MAIN | 
| 2 |  |  | C     /==========================================================\ | 
| 3 |  |  | C     | SUBROUTINE THE_MODEL_MAIN                                | | 
| 4 |  |  | C     | o Master controlling routine for model using the MITgcm  | | 
| 5 |  |  | C     |   UV parallel wrapper.                                   | | 
| 6 |  |  | C     |==========================================================| | 
| 7 |  |  | C     | THE_MODEL_MAIN is invoked by the MITgcm UV parallel      | | 
| 8 |  |  | C     | wrapper with a single integer argument "myThid". This    | | 
| 9 |  |  | C     | variable identifies the thread number of an instance of  | | 
| 10 |  |  | C     | THE_MODEL_MAIN. Each instance of THE_MODEL_MAIN works    | | 
| 11 |  |  | C     | on a particular region of the models domain and          | | 
| 12 |  |  | C     | synchronises with other instances as necessary. The      | | 
| 13 |  |  | C     | routine has to "understand" the MITgcm parallel          | | 
| 14 |  |  | C     | environment and the numerical algorithm. Editing this    | | 
| 15 |  |  | C     | routine is best done with some knowledge of both aspects.| | 
| 16 |  |  | C     | Notes                                                    | | 
| 17 |  |  | C     | =====                                                    | | 
| 18 |  |  | C     | C*P* comments indicating place holders for which code is | | 
| 19 |  |  | C     |      presently being developed.                          | | 
| 20 |  |  | C     \==========================================================/ | 
| 21 |  |  |  | 
| 22 |  |  | C     == Global variables === | 
| 23 |  |  | #include "SIZE.h" | 
| 24 |  |  | #include "EEPARAMS.h" | 
| 25 |  |  | #include "PARAMS.h" | 
| 26 |  |  | #include "CG2D.h" | 
| 27 |  |  | #include "MPI_INFO.h" | 
| 28 |  |  |  | 
| 29 |  |  | C     == Routine arguments == | 
| 30 |  |  | C     myThid - Thread number for this instance of the routine. | 
| 31 |  |  | INTEGER myThid | 
| 32 |  |  |  | 
| 33 |  |  | C     == Local variables == | 
| 34 |  |  | INTEGER I | 
| 35 |  |  | Real*8 wTime1, wTime2 | 
| 36 |  |  | Real*8 fCount, fTime, fRate, wSetSize | 
| 37 |  |  |  | 
| 38 |  |  | C--   Set model initial conditions | 
| 39 |  |  | CALL INITIALISE( myThid ) | 
| 40 |  |  |  | 
| 41 |  |  | C--   Begin time stepping loop | 
| 42 |  |  | CALL CLOC(wTime1) | 
| 43 |  |  |  | 
| 44 |  |  | DO I=1, nTimeSteps | 
| 45 |  |  | nIter = nIter0 + I | 
| 46 |  |  | CALL CG2D | 
| 47 |  |  | ENDDO | 
| 48 |  |  |  | 
| 49 |  |  | CALL CLOC(wTime2) | 
| 50 |  |  |  | 
| 51 |  |  | C     CALL PLOT_FIELD_XYR8( cg2d_x , 'CG2D_X  AFTER SOLVE') | 
| 52 |  |  | C     CALL PLOT_FIELD_XYR8( cg2d_Ax, 'CG2D_AX AFTER SOLVE') | 
| 53 |  |  | C     CALL PLOT_FIELD_XYR8( cg2d_b,  'CG2D_B  AFTER SOLVE') | 
| 54 |  |  | C     CALL PLOT_FIELD_XYR8( cg2d_r,  'CG2D_R  AFTER SOLVE') | 
| 55 |  |  |  | 
| 56 |  |  | WRITE(6,*) 'Wall clock time = ', wTime2-wTime1 | 
| 57 |  |  | fTime = wTime2-wTime1 | 
| 58 |  |  | fCount = DBLE(nTImeSteps)*DBLE(cg2dMaxIters)*34.D0*DBLE(Nx)*DBLE(Ny) | 
| 59 |  |  | fRate  = fCount/fTime/1.D6 | 
| 60 |  |  | WRITE(6,*) 'PID ',myProcId,' OF ',numberOfProcs,' MFLOP/s = ', fRate | 
| 61 |  |  | wSetSize=DBLE((sNx+2*OLx)*(sNy+2*OLy)*8*11)/1024./1024. | 
| 62 |  |  | WRITE(6,*) 'PID ',myProcId,' OF ',numberOfProcs,' MB = ', wSetSize | 
| 63 |  |  | WRITE(6,'(4(1X,I4),3F10.4)') | 
| 64 |  |  | &  numberOfProcs, myProcId, sNx, sNy, | 
| 65 |  |  | &  fTime, fRate, wSetSize | 
| 66 |  |  |  | 
| 67 |  |  | RETURN | 
| 68 |  |  | END | 
| 69 |  |  |  | 
| 70 |  |  | C $Id: $ |