Skip to content

Commit

Permalink
minor fix for standalone build
Browse files Browse the repository at this point in the history
  • Loading branch information
uturuncoglu committed Apr 19, 2024
1 parent f2b10a5 commit 80a5ad5
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions model/src/wav_shr_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module wav_shr_mod
use ESMF , only : ESMF_Time, ESMF_TimeGet, ESMF_TimeSet
use ESMF , only : ESMF_TimeInterval, ESMF_TimeIntervalSet, ESMF_TimeIntervalGet
use ESMF , only : ESMF_VM, ESMF_VMGet, ESMF_VMBroadcast, ESMF_VMGetCurrent
use ESMF , only : ESMF_FieldStatus_Flag, ESMF_FIELDSTATUS_COMPLETE
use NUOPC , only : NUOPC_CompAttributeGet
use NUOPC_Model , only : NUOPC_ModelGet
use wav_kind_mod , only : r8 => shr_kind_r8, i8 => shr_kind_i8, cl=>shr_kind_cl, cs=>shr_kind_cs
Expand Down Expand Up @@ -486,6 +487,7 @@ subroutine state_reset(State, reset_value, rc)
! local variables
integer :: i,j,n
type(ESMF_Field) :: lfield
type(ESMF_FieldStatus_Flag) :: lstatus
integer :: fieldCount
integer :: lrank
character(ESMF_MAXSTR), allocatable :: lfieldnamelist(:)
Expand All @@ -507,19 +509,24 @@ subroutine state_reset(State, reset_value, rc)
call ESMF_StateGet(State, itemName=trim(lfieldnamelist(n)), field=lfield, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

call field_getfldptr(lfield, fldptr1=fldptr1, fldptr2=fldptr2, rank=lrank, rc=rc)
call ESMF_FieldGet(lfield, status=lstatus, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

if (lrank == 0) then
! no local data
elseif (lrank == 1) then
fldptr1 = reset_value
elseif (lrank == 2) then
fldptr2 = reset_value
else
call ESMF_LogWrite(trim(subname)//": ERROR in rank "//trim(lfieldnamelist(n)), ESMF_LOGMSG_ERROR)
rc = ESMF_FAILURE
return
if (lstatus == ESMF_FIELDSTATUS_COMPLETE) then
call field_getfldptr(lfield, fldptr1=fldptr1, fldptr2=fldptr2, rank=lrank, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

if (lrank == 0) then
! no local data
elseif (lrank == 1) then
fldptr1 = reset_value
elseif (lrank == 2) then
fldptr2 = reset_value
else
call ESMF_LogWrite(trim(subname)//": ERROR in rank "//trim(lfieldnamelist(n)), ESMF_LOGMSG_ERROR)
rc = ESMF_FAILURE
return
endif
endif
enddo

Expand Down

0 comments on commit 80a5ad5

Please sign in to comment.