From 7f548c795a348bbb0fe4967dd25692c79036dc73 Mon Sep 17 00:00:00 2001 From: Denise Worthen Date: Tue, 6 Aug 2024 10:00:07 -0400 Subject: [PATCH] initialize cpl_scalars when created (#1274) --- model/src/wav_import_export.F90 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/model/src/wav_import_export.F90 b/model/src/wav_import_export.F90 index e6caa1a2d..9d859989d 100644 --- a/model/src/wav_import_export.F90 +++ b/model/src/wav_import_export.F90 @@ -944,6 +944,7 @@ subroutine SetScalarField(field, flds_scalar_name, flds_scalar_num, rc) ! local variables type(ESMF_Distgrid) :: distgrid type(ESMF_Grid) :: grid + real(ESMF_KIND_R8), pointer :: fldptr2d(:,:) character(len=*), parameter :: subname='(wav_import_export:SetScalarField)' ! ---------------------------------------------- @@ -960,6 +961,11 @@ subroutine SetScalarField(field, flds_scalar_name, flds_scalar_num, rc) ungriddedLBound=(/1/), ungriddedUBound=(/flds_scalar_num/), gridToFieldMap=(/2/), rc=rc) ! num of scalar values if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=u_FILE_u)) return + ! initialize fldptr to zero + call ESMF_FieldGet(field, farrayPtr=fldptr2d, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + fldptr2d(:,:) = 0.0 + end subroutine SetScalarField end subroutine fldlist_realize