-
Notifications
You must be signed in to change notification settings - Fork 1
/
hycom_cice_nuopc.F90
122 lines (109 loc) · 4.76 KB
/
hycom_cice_nuopc.F90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
!==============================================================================
! Earth System Modeling Framework
! Copyright 2002-2018, University Corporation for Atmospheric Research,
! Massachusetts Institute of Technology, Geophysical Fluid Dynamics
! Laboratory, University of Michigan, National Centers for Environmental
! Prediction, Los Alamos National Laboratory, Argonne National Laboratory,
! NASA Goddard Space Flight Center.
! Licensed under the University of Illinois-NCSA License.
!==============================================================================
! esm app from https://www.earthsystemcog.org/projects/nuopc/proto_codes/ AtmOcnPetListProto
program hycom_cice_nuopc
!-----------------------------------------------------------------------------
! Generic ESM application driver
!-----------------------------------------------------------------------------
use ESMF
use ESM, only: esmSS => SetServices
implicit none
integer :: rc, urc
type(ESMF_GridComp) :: esmComp
! Initialize ESMF
#ifdef logerror
call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI_ON_ERROR, &
defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc)
#elif defined logmulti
call ESMF_Initialize(logkindflag=ESMF_LOGKIND_MULTI, &
defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc)
#else
call ESMF_Initialize(logkindflag=ESMF_LOGKIND_NONE, &
defaultCalkind=ESMF_CALKIND_GREGORIAN, rc=rc)
#endif
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
call ESMF_Finalize(endflag=ESMF_END_ABORT)
call ESMF_LogSet(flush=.true., rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
call ESMF_Finalize(endflag=ESMF_END_ABORT)
call ESMF_LogWrite("HYCOM CICE coupled with NUOPC is STARTING", ESMF_LOGMSG_INFO, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
call ESMF_Finalize(endflag=ESMF_END_ABORT)
! Create the earth system Component
call ESMF_LogWrite("GridCompCreate", ESMF_LOGMSG_INFO, rc=rc)
esmComp = ESMF_GridCompCreate(name="esm", rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
call ESMF_Finalize(endflag=ESMF_END_ABORT)
! SetServices for the earth system Component
call ESMF_LogWrite("GridCompSetServices", ESMF_LOGMSG_INFO, rc=rc)
call ESMF_GridCompSetServices(esmComp, esmSS, userRc=urc, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
call ESMF_Finalize(endflag=ESMF_END_ABORT)
if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
call ESMF_Finalize(endflag=ESMF_END_ABORT)
! Call Initialize for the earth system Component
call ESMF_LogWrite("GridCompInitialize", ESMF_LOGMSG_INFO, rc=rc)
call ESMF_GridCompInitialize(esmComp, userRc=urc, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
call ESMF_Finalize(endflag=ESMF_END_ABORT)
if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
call ESMF_Finalize(endflag=ESMF_END_ABORT)
! Call Run for earth the system Component
call ESMF_LogWrite("GridCompRun", ESMF_LOGMSG_INFO, rc=rc)
call ESMF_GridCompRun(esmComp, userRc=urc, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
call ESMF_Finalize(endflag=ESMF_END_ABORT)
if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
call ESMF_Finalize(endflag=ESMF_END_ABORT)
! Call Finalize for the earth system Component
call ESMF_LogWrite("GridCompFinalize", ESMF_LOGMSG_INFO, rc=rc)
call ESMF_GridCompFinalize(esmComp, userRc=urc, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
call ESMF_Finalize(endflag=ESMF_END_ABORT)
if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
call ESMF_Finalize(endflag=ESMF_END_ABORT)
! Destroy the earth system Component
call ESMF_GridCompDestroy(esmComp, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
call ESMF_Finalize(endflag=ESMF_END_ABORT)
call ESMF_LogWrite("HYCOM CICE coupled with NUOPC finalizes", ESMF_LOGMSG_INFO, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
call ESMF_Finalize(endflag=ESMF_END_ABORT)
! Finalize ESMF
call ESMF_Finalize()
end program