From 8d05f394d31f63d08970d7c4899447d70b63f1b1 Mon Sep 17 00:00:00 2001 From: "denise.worthen" Date: Mon, 8 Jul 2024 13:12:30 -0600 Subject: [PATCH] initialize cpl_scalar field when created --- config_src/drivers/nuopc_cap/mom_cap.F90 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config_src/drivers/nuopc_cap/mom_cap.F90 b/config_src/drivers/nuopc_cap/mom_cap.F90 index d2dcf96067..eab4191308 100644 --- a/config_src/drivers/nuopc_cap/mom_cap.F90 +++ b/config_src/drivers/nuopc_cap/mom_cap.F90 @@ -2370,6 +2370,11 @@ subroutine SetScalarField(field, rc) ungriddedLBound=(/1/), ungriddedUBound=(/scalar_field_count/), gridToFieldMap=(/2/), rc=rc) if (ChkErr(rc,__LINE__,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 MOM_RealizeFields