program ESMF_NUOPCAtmModelEx
!------------------------------------------------------------------------------
!ESMF_EXAMPLE String used by test script to count examples.
!==============================================================================
#include "ESMF.h"
! ESMF Framework module
use ESMF
use ESMF_TestMod
use DRIVER, only: driverSS => SetServices
implicit none
! Local variables
type(ESMF_GridComp) :: drvr
type(ESMF_State) :: importState, exportState
integer :: rc
integer :: finalrc
integer :: result = 0 ! all pass
character(ESMF_MAXSTR) :: testname
character(ESMF_MAXSTR) :: failMsg
finalrc = ESMF_SUCCESS
!-------------------------------------------------------------------------
!-------------------------------------------------------------------------
write(failMsg, *) "Example failure"
write(testname, *) "Example ESMF_NUOPCAtmModelEx"
!-------------------------------------------------------------------------
!-------------------------------------------------------------------------
call ESMF_Initialize(defaultlogfilename="NUOPCAtmModelEx.Log", &
defaultCalKind=ESMF_CALKIND_GREGORIAN, &
logkindflag=ESMF_LOGKIND_MULTI, rc=rc)
!-------------------------------------------------------------------------
print *, "NUOPC DRIVER + ATM Model example run"
importState = ESMF_StateCreate(name="Driver Import State", &
stateintent=ESMF_STATEINTENT_EXPORT, rc=rc)
if (rc.NE.ESMF_SUCCESS) finalrc = ESMF_FAILURE
exportState = ESMF_StateCreate(name="Driver Export State", &
stateintent=ESMF_STATEINTENT_IMPORT, rc=rc)
if (rc.NE.ESMF_SUCCESS) finalrc = ESMF_FAILURE
drvr = ESMF_GridCompCreate(name="Driver", rc=rc)
if (rc.NE.ESMF_SUCCESS) finalrc = ESMF_FAILURE
call ESMF_GridCompSetServices(drvr, userRoutine=driverSS, rc=rc)
if (rc.NE.ESMF_SUCCESS) finalrc = ESMF_FAILURE
call ESMF_GridCompInitialize(drvr, phase=0, rc=rc)
if (rc.NE.ESMF_SUCCESS) finalrc = ESMF_FAILURE
call ESMF_GridCompInitialize(drvr, importState=importState, &
exportState=exportState, rc=rc)
if (rc.NE.ESMF_SUCCESS) finalrc = ESMF_FAILURE
call ESMF_GridCompRun(drvr, importState=importState, &
exportState=exportState, rc=rc)
if (rc.NE.ESMF_SUCCESS) finalrc = ESMF_FAILURE
call ESMF_GridCompFinalize(drvr, importState=importState, &
exportState=exportState, rc=rc)
if (rc.NE.ESMF_SUCCESS) finalrc = ESMF_FAILURE
call ESMF_GridCompDestroy(drvr, rc=rc)
if (rc.NE.ESMF_SUCCESS) finalrc = ESMF_FAILURE
!-------------------------------------------------------------------------
! IMPORTANT: ESMF_STest() prints the PASS string and the # of processors in the log
! file that the scripts grep for.
call ESMF_STest((finalrc.eq.ESMF_SUCCESS), testname, failMsg, result, ESMF_SRCLINE)
call ESMF_Finalize(rc=rc)
if (rc.NE.ESMF_SUCCESS) finalrc = ESMF_FAILURE
if (finalrc.EQ.ESMF_SUCCESS) then
print *, "PASS: ESMF_NUOPCAtmModelEx.F90"
else
print *, "FAIL: ESMF_NUOPCAtmModelEx.F90"
end if
end program ESMF_NUOPCAtmModelEx