Back to home page

MITgcm

 
 

    


File indexing completed on 2018-03-02 18:37:36 UTC

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
885dea980c Jean*0001 CBOP 0
                0002 C !ROUTINE: COUPLER
                0003 
                0004 C !INTERFACE:
7f58e89433 Jean*0005       PROGRAM COUPLER
885dea980c Jean*0006 
                0007 C !DESCRIPTION:
                0008 C     *==========================================================*
                0009 C     | PROGRAM COUPLER
                0010 C     | o Main routine for 'Coupler' component. 'Coupler'
                0011 C     |   component coordiantes the exchange of data between
                0012 C     |   component models in a coupled model experiment.
                0013 C     *==========================================================*
                0014 C     | This version uses the MIT Coupler "checkpoint1" library
                0015 C     | calls.
                0016 C     *==========================================================*
                0017 
                0018 C !USES:
7f58e89433 Jean*0019       IMPLICIT NONE
885dea980c Jean*0020 C     == Global variables ==
7f58e89433 Jean*0021 #include "mpif.h"
                0022 #include "CPL_PARAMS.h"
                0023 
885dea980c Jean*0024 C !LOCAL VARIABLES:
                0025 C     I       :: Loop counter
                0026 C     rc      :: MPI return code
                0027 C     msgUnit :: log-file I/O unit
7f58e89433 Jean*0028       INTEGER I
                0029       INTEGER rc
885dea980c Jean*0030       INTEGER msgUnit
                0031 CEOP
7f58e89433 Jean*0032 
                0033 C     Initialise the coupler component
885dea980c Jean*0034       CALL INITIALISE(
                0035      O                 msgUnit )
7f58e89433 Jean*0036 
                0037 C     Perform registration with other components
                0038       CALL ACCEPT_COMPONENT_REGISTRATIONS
                0039 
6502611145 Jean*0040 C     Send Coupler-params to both components
                0041       CALL CPL_SEND_ATM_CPLPARMS( msgUnit )
                0042       CALL CPL_SEND_OCN_CPLPARMS( msgUnit )
                0043 
                0044 C     Coordinate the transfer configuration information between components
                0045       CALL EXCH_COMPONENT_CONFIGS( msgUnit )
7f58e89433 Jean*0046 
                0047       DO I=1,nCouplingSteps
                0048 
7eca977925 Jean*0049        IF ( cpl_sequential.EQ.1 ) THEN
                0050 C-     Sequential coupling
7f58e89433 Jean*0051 
7eca977925 Jean*0052 C       Receive ATM updated state
4abf9d9a22 Jean*0053         CALL CPL_RECV_ATM_FIELDS( msgUnit, I )
7eca977925 Jean*0054 C       Send out ATM fields to OCN
4abf9d9a22 Jean*0055         CALL CPL_SEND_OCN_FIELDS( msgUnit, I )
7eca977925 Jean*0056 
                0057 C       Receive OCN updated state
4abf9d9a22 Jean*0058         CALL CPL_RECV_OCN_FIELDS( msgUnit, I )
7eca977925 Jean*0059 C       Send out OCN fields to ATM
4abf9d9a22 Jean*0060         CALL CPL_SEND_ATM_FIELDS( msgUnit, I )
7eca977925 Jean*0061 
                0062        ELSE
                0063 C-     Synchronous coupling
                0064 
                0065 C       Receive updated state
4abf9d9a22 Jean*0066         CALL CPL_RECV_OCN_FIELDS( msgUnit, I )
                0067         CALL CPL_RECV_ATM_FIELDS( msgUnit, I )
7eca977925 Jean*0068 
                0069 C       Send out fields
4abf9d9a22 Jean*0070         CALL CPL_SEND_ATM_FIELDS( msgUnit, I )
                0071         CALL CPL_SEND_OCN_FIELDS( msgUnit, I )
7eca977925 Jean*0072 
                0073        ENDIF
7f58e89433 Jean*0074 
                0075       ENDDO
                0076 
                0077 C     o Finalize MPI
                0078 C     First wait for everybody to finish. Nobody should call
                0079 C     MPI_Finalize before all the component modules are
                0080 C     ready to finish. On some systems once one participant
                0081 C     gets to MPI_Finalize then its unclear what will
                0082 C     happen after that. If everybody does on MPI_Barrier
                0083 C     on COMM_WORLD then we will be OK.
                0084       CALL MPI_BARRIER( MPI_COMM_WORLD, rc )
                0085       CALL MPI_FINALIZE(rc)
                0086 
                0087       STOP
                0088       END