C $Header: /home/ubuntu/mnt/e9_copy/MITgcm_contrib/nesting_sannino/nest_parent/nest_parent_check.F,v 1.3 2010/11/29 14:24:14 jmc Exp $ C $Name: $ #include "NEST_PARENT_OPTIONS.h" CBOP C !ROUTINE: NEST_PARENT_CHECK C !INTERFACE: SUBROUTINE NEST_PARENT_CHECK( myThid ) C !DESCRIPTION: C *==========================================================* C | SUBROUTINE NEST_PARENT_CHECK C | o Validate basic package setup and inter-package C | dependencies. C *==========================================================* C !USES: IMPLICIT NONE C === Global variables === #include "SIZE.h" #include "EEPARAMS.h" #include "PARAMS.h" #include "EESUPPORT.h" #include "NEST_PARENT_PARAMS.h" C !INPUT/OUTPUT PARAMETERS: C myThid :: my Thread Id number INTEGER myThid CEOP C !LOCAL VARIABLES: C msgBuf :: Informational/error message buffer CHARACTER*(MAX_LEN_MBUF) msgBuf INTEGER nNestSteps, checkSteps INTEGER ierr, istatus WRITE(msgBuf,'(A)') & 'NEST_PARENT_CHECK: #define ALLOW_NEST_PARENT' CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, & SQUEEZE_RIGHT, myThid ) _BEGIN_MASTER( myThid ) C-- Check length of integration between components. C- units: number of nesting-steps (since driver ignores CLD/PAR time steps) nNestSteps = nTimeSteps/1 IF ( MOD( nNestSteps, 1 ).NE.0 ) nNestSteps = -1 IF ( mpiMyId.EQ.0 ) THEN C- Send to driver the number of expected nesting-exchanges with driver: CALL MPI_SEND( nNestSteps, 1, MPI_INTEGER, & MSTR_DRV_P(NST_LEV_P), 3000, & MPI_Comm_World, ierr ) ENDIF C Receive error code (-1) from World-Master if inconsistent nNestSteps. C Note: This is not broadcast from MSTR_DRV_P(NST_LEV_P) since everybody C in the World need to catch error, call MPI_FINALIZE & stop. CALL MPI_BCAST( checkSteps, 1, MPI_INTEGER, & 0, MPI_Comm_World, ierr ) C- Check for mismatch: IF ( checkSteps .EQ. -1 ) THEN WRITE(msgBuf,'(A,I8)') & 'NEST_PARENT_CHECK: Nb Nesting steps =', nNestSteps CALL PRINT_ERROR( msgBuf, myThid ) WRITE(msgBuf,'(A)') & 'NEST_PARENT_CHECK: CHILD nb of steps does NOT match' CALL PRINT_ERROR( msgBuf, myThid ) CALL MPI_FINALIZE(ierr) STOP 'ABNORMAL END: S/R NEST_PARENT_CHECK:' ENDIF _END_MASTER(myThid) RETURN END