/[MITgcm]/MITgcm_contrib/nesting_sannino/nest_parent/nest_parent_check.F
ViewVC logotype

Contents of /MITgcm_contrib/nesting_sannino/nest_parent/nest_parent_check.F

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


Revision 1.3 - (show annotations) (download)
Mon Nov 29 14:24:14 2010 UTC (14 years, 8 months ago) by jmc
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +60 -18 lines
check for consistent number of nesting-steps between parent & child:
 if they agree, set number of nesting-steps in driver accordingly;
 if not, stop cleanly (call MPI_FINALIZE & stop).

1 C $Header: /u/gcmpack/MITgcm_contrib/nesting_sannino/nest_parent/nest_parent_check.F,v 1.2 2009/10/23 19:42:00 sannino Exp $
2 C $Name: $
3
4 #include "NEST_PARENT_OPTIONS.h"
5
6 CBOP
7 C !ROUTINE: NEST_PARENT_CHECK
8
9 C !INTERFACE:
10 SUBROUTINE NEST_PARENT_CHECK( myThid )
11
12 C !DESCRIPTION:
13 C *==========================================================*
14 C | SUBROUTINE NEST_PARENT_CHECK
15 C | o Validate basic package setup and inter-package
16 C | dependencies.
17 C *==========================================================*
18
19 C !USES:
20 IMPLICIT NONE
21
22 C === Global variables ===
23 #include "SIZE.h"
24 #include "EEPARAMS.h"
25 #include "PARAMS.h"
26 #include "EESUPPORT.h"
27 #include "NEST_PARENT_PARAMS.h"
28
29 C !INPUT/OUTPUT PARAMETERS:
30 C myThid :: my Thread Id number
31 INTEGER myThid
32 CEOP
33
34 C !LOCAL VARIABLES:
35 C msgBuf :: Informational/error message buffer
36 CHARACTER*(MAX_LEN_MBUF) msgBuf
37 INTEGER nNestSteps, checkSteps
38 INTEGER ierr, istatus
39
40 WRITE(msgBuf,'(A)')
41 & 'NEST_PARENT_CHECK: #define ALLOW_NEST_PARENT'
42 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
43 & SQUEEZE_RIGHT, myThid )
44
45 _BEGIN_MASTER( myThid )
46
47 C-- Check length of integration between components.
48 C- units: number of nesting-steps (since driver ignores CLD/PAR time steps)
49 nNestSteps = nTimeSteps/1
50 IF ( MOD( nNestSteps, 1 ).NE.0 ) nNestSteps = -1
51 IF ( mpiMyId.EQ.0 ) THEN
52 C- Send to driver the number of expected nesting-exchanges with driver:
53 CALL MPI_SEND( nNestSteps, 1, MPI_INTEGER,
54 & MSTR_DRV_P(NST_LEV_P), 3000,
55 & MPI_Comm_World, ierr )
56 ENDIF
57
58 C Receive error code (-1) from World-Master if inconsistent nNestSteps.
59 C Note: This is not broadcast from MSTR_DRV_P(NST_LEV_P) since everybody
60 C in the World need to catch error, call MPI_FINALIZE & stop.
61 CALL MPI_BCAST( checkSteps, 1, MPI_INTEGER,
62 & 0, MPI_Comm_World, ierr )
63 C- Check for mismatch:
64 IF ( checkSteps .EQ. -1 ) THEN
65 WRITE(msgBuf,'(A,I8)')
66 & 'NEST_PARENT_CHECK: Nb Nesting steps =', nNestSteps
67 CALL PRINT_ERROR( msgBuf, myThid )
68 WRITE(msgBuf,'(A)')
69 & 'NEST_PARENT_CHECK: CHILD nb of steps does NOT match'
70 CALL PRINT_ERROR( msgBuf, myThid )
71 CALL MPI_FINALIZE(ierr)
72 STOP 'ABNORMAL END: S/R NEST_PARENT_CHECK:'
73 ENDIF
74
75 _END_MASTER(myThid)
76
77 RETURN
78 END

  ViewVC Help
Powered by ViewVC 1.1.22