Skip to content
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

time interpolation bug fix #21

Merged
merged 13 commits into from
Dec 8, 2020
4 changes: 2 additions & 2 deletions DATM/AtmBundleCreate.F90
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ subroutine AtmBundleCreate(gcomp, exportState, rc)
call ESMF_FieldBundleAdd(AtmBundleFwd, (/field/), rc=rc)
call ESMF_FieldGet(field, farrayPtr=AtmBundleFields(ii)%farrayPtr_fwd, rc=rc)

AtmBundleFields(ii)%farrayPtr_bak = 0.0
AtmBundleFields(ii)%farrayPtr_fwd = 0.0
AtmBundleFields(ii)%farrayPtr_bak = 0.0_ESMF_KIND_R8
AtmBundleFields(ii)%farrayPtr_fwd = 0.0_ESMF_KIND_R8
enddo !ii

!-------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion DATM/AtmFieldUtils.F90
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ subroutine AtmFieldsRealize(state, grid, field_defs, tag, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

! initialize
field_defs(ii)%farrayPtr = 0.0
field_defs(ii)%farrayPtr = 0.0_ESMF_KIND_R8

msgString = trim(tag)//" Field "// trim(field_defs(ii)%shortname) // " is connected on root pe"
call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO)
Expand Down Expand Up @@ -368,6 +368,7 @@ subroutine AtmBundleIntp(gcomp, exportState, externalClock, hour, rc)

call ESMF_FieldGet(field, farrayPtr=AtmBundleFields(ii)%farrayPtr, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
AtmBundleFields(ii)%farrayPtr = 0.0_ESMF_KIND_R8

! get the corresponding _fwd and _bak fields
fnamefwd = trim(AtmBundleFields(ii)%field_name)//'_fwd'
Expand Down
12 changes: 6 additions & 6 deletions DATM/AtmModel.F90
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ subroutine AtmRun(gcomp, exportState, externalClock, rc)
integer, intent(out) :: rc

! Local variables
type(ESMF_Time) :: currTime

type(ESMF_Time) :: currTime
type(ESMF_TimeInterval) :: timeStep
integer(kind=ESMF_KIND_I4) :: iyear,imonth,iday,ihour,iminut
real(kind=ESMF_KIND_R8) :: hour,minut
character(len=ESMF_MAXSTR) :: msgString
Expand Down Expand Up @@ -127,13 +127,13 @@ subroutine AtmRun(gcomp, exportState, externalClock, rc)
! get new forcing data---always fills the _fwd values in AtmBundle
call AtmForce(gcomp,exportState,externalClock,1,rc)
endif
! get the current time of the model clock
call ESMF_ClockGet(externalClock, currTime=currTime, rc=rc)
call ESMF_ClockGet(externalClock, currTime=currTime, timestep=timeStep, rc=rc)
call ESMF_TimeGet(currTime,yy=iyear,mm=imonth,dd=iday,h=ihour,m=iminut,rc=rc)
!write(msgString,*)iyear,imonth,iday,ihour,iminut
!call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO, rc=rc)

call ESMF_TimeGet(currTime,h_r8=hour,rc=rc)

! get the ending time of the model clock; this is the time we need to interpolate the values to
call ESMF_TimeGet(currTime+timestep,h_r8=hour,rc=rc)
write(msgString,*)'AtmRun: hbkd,hour,hfwd ', hbak,hour,hfwd
call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO, rc=rc)

Expand Down
2 changes: 1 addition & 1 deletion DATM/datm.F90
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ subroutine InitializeP2(model, importState, exportState, externalClock, rc)
call ESMF_ClockGet(externalClock, currTime=currTime, rc = rc)
call ESMF_TimeGet(currTime, timestring=timestr, rc=rc)

fname = 'field_atm_exporta_'//trim(timestr)//'.nc'
fname = 'field_atm_exporti_'//trim(timestr)//'.nc'
call AtmFieldDump(exportState, trim(fname), rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
endif
Expand Down