1 |
C $Header: /u/gcmpack/MITgcm/pkg/aim_ocn_coupler/coupler.F,v 1.2 2004/05/21 19:31:50 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
PROGRAM COUPLER |
5 |
C /==========================================================\ |
6 |
C | PROGRAM COUPLER | |
7 |
C | o Main routine for 'Coupler' component. 'Coupler' | |
8 |
C | component coordiantes the exchange of data between | |
9 |
C | component models in a coupled model experiment. | |
10 |
C |==========================================================| |
11 |
C | This version uses the MIT Coupler "checkpoint1" library | |
12 |
C | calls. | |
13 |
C \==========================================================/ |
14 |
IMPLICIT NONE |
15 |
#include "mpif.h" |
16 |
#include "CPL_PARAMS.h" |
17 |
|
18 |
C == Local variables == |
19 |
C I - Loop counter |
20 |
C MPI_COMM_Coupler |
21 |
C rc - MPI return code |
22 |
INTEGER I |
23 |
INTEGER rc |
24 |
|
25 |
C Initialise the coupler component |
26 |
CALL INITIALISE |
27 |
|
28 |
C Perform registration with other components |
29 |
CALL ACCEPT_COMPONENT_REGISTRATIONS |
30 |
|
31 |
C Coordinate the transfer configuration information |
32 |
C between components |
33 |
CALL RECEIVE_COMPONENT_CONFIGS |
34 |
CALL SENDOUT_COMPONENT_CONFIGS |
35 |
|
36 |
DO I=1,nCouplingSteps |
37 |
|
38 |
C Receive updated state |
39 |
CALL CPL_RECV_OCN_FIELDS |
40 |
CALL CPL_RECV_ATM_FIELDS |
41 |
|
42 |
C Send out fields |
43 |
CALL CPL_SEND_ATM_FIELDS |
44 |
CALL CPL_SEND_OCN_FIELDS |
45 |
|
46 |
ENDDO |
47 |
|
48 |
C o Finalize MPI |
49 |
C First wait for everybody to finish. Nobody should call |
50 |
C MPI_Finalize before all the component modules are |
51 |
C ready to finish. On some systems once one participant |
52 |
C gets to MPI_Finalize then its unclear what will |
53 |
C happen after that. If everybody does on MPI_Barrier |
54 |
C on COMM_WORLD then we will be OK. |
55 |
CALL MPI_BARRIER( MPI_COMM_WORLD, rc ) |
56 |
CALL MPI_FINALIZE(rc) |
57 |
|
58 |
STOP |
59 |
END |