-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Properly import coupling fields when running with separate run phases #406
Changes from all commits
f78aa42
75654ac
2870f5e
37fb245
1c0a9ba
afb4c67
3004022
617b907
bdd1131
735eb9e
59cf366
6f730ae
deda93d
bb754cc
fefc233
0ec3000
3c4d18f
a119ee8
71a5fd4
4c2a7b2
80e6ea6
f3f4d00
24a15fc
7b1e88d
4f8c34b
8f28b16
310b4ac
d6bb752
fda3a64
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -140,7 +140,7 @@ subroutine SetServices(gcomp, rc) | |
|
||
! specializations required to support 'inline' run sequences | ||
call NUOPC_CompSpecialize(gcomp, specLabel=label_CheckImport, & | ||
specPhaseLabel="phase1", specRoutine=NUOPC_NoOp, rc=rc) | ||
specPhaseLabel="phase1", specRoutine=fv3_checkimport, rc=rc) | ||
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return | ||
|
||
call NUOPC_CompSpecialize(gcomp, specLabel=label_TimestampExport, & | ||
|
@@ -1212,7 +1212,7 @@ subroutine fv3_checkimport(gcomp, rc) | |
type(ESMF_Clock) :: clock | ||
type(ESMF_Time) :: currTime, invalidTime | ||
type(ESMF_State) :: importState | ||
logical :: timeCheck1,timeCheck2 | ||
logical :: isValid | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This local variable There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could use multiple logical variables if needed for clarity. We could also write a single logical function combining all the tests for increased modularity. I don't believe such a function is required elsewhere in the code base, though, and it could lead to confusion in cases where a field timestamp has not been set at all. |
||
type(ESMF_Field),pointer :: fieldList(:) | ||
character(len=128) :: fldname | ||
character(esmf_maxstr) :: msgString | ||
|
@@ -1250,25 +1250,32 @@ subroutine fv3_checkimport(gcomp, rc) | |
call ESMF_FieldGet(fieldList(n), name=fldname, rc=rc) | ||
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return | ||
|
||
nf = queryImportFields(fldname) | ||
timeCheck1 = NUOPC_IsAtTime(fieldList(n), invalidTime, rc=rc) | ||
! check if import field carries a valid timestamp | ||
call NUOPC_GetTimestamp(fieldList(n), isValid=isValid, rc=rc) | ||
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return | ||
|
||
if (timeCheck1) then | ||
importFieldsValid(nf) = .false. | ||
! if(mtype==0) print *,'in fv3_checkimport,',trim(fldname),' is set unvalid, nf=',nf,' at time',date(1:6) | ||
else | ||
timeCheck2 = NUOPC_IsAtTime(fieldList(n), currTime, rc=rc) | ||
if (isValid) then | ||
! if timestamp is set, check if it is valid | ||
isValid = .not.NUOPC_IsAtTime(fieldList(n), invalidTime, rc=rc) | ||
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return | ||
end if | ||
|
||
! store field status in internal array | ||
nf = queryImportFields(fldname) | ||
importFieldsValid(nf) = isValid | ||
|
||
if (.not.timeCheck2) then | ||
!TODO: introduce and use INCOMPATIBILITY return codes!!!! | ||
if (isValid) then | ||
! check if field is current | ||
isValid = NUOPC_IsAtTime(fieldList(n), currTime, rc=rc) | ||
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return | ||
if (.not.isValid) then | ||
call ESMF_LogSetError(ESMF_RC_ARG_BAD, & | ||
msg="NUOPC INCOMPATIBILITY DETECTED: Import Field not at current time", & | ||
msg="NUOPC INCOMPATIBILITY DETECTED: Import Field " & | ||
// trim(fldname) // " not at current time", & | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we have: importFieldsValid(nf) = .false. here too? Or maybe we are now allowing import fields with different time stamp (not at currTime)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could set |
||
line=__LINE__, file=__FILE__, rcToReturn=rc) | ||
return | ||
endif | ||
endif | ||
return | ||
end if | ||
end if | ||
write(msgString,'(A,2i4,l3)') "fv3_checkimport "//trim(fldname),n,nf,importFieldsValid(nf) | ||
call ESMF_LogWrite(msgString,ESMF_LOGMSG_INFO,rc=rc) | ||
enddo | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So now the fv3_checkImport will be called once for one integration step with two phases, just as it is called once in "ModelAdvance". One question is: should we also call checkImport for phase2? or maybe it is no necessary as the time stamp does not change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fv3_checkimport
should be called at the beginning of the atmosphere's integration step for coupling with external components except GOCART. It is not called before run phase 2 since: (a) the timestamp of imported fields does not change, and (b) GOCART does not require it.