Skip to content

Commit 18e9871

Browse files
DusanJovic-NOAABijuThomas-NOAA
authored andcommitted
Fix dumpfields=true option by using ESMF_FieldBundleWrite (NOAA-EMC#856)
* Update diagnose_cplFields routine to use FieldBundleWrite. Needs esmf v8.6.0 * Fixed bug in aux2d dimensions for GFS meta file. * Pass return code from diagnose_cplFields back to caller * Skip 'cpl_scalars' field when dumping export state * fix fhzero for GEFS * fix cpl_scalars (#6) * fix issues w/ cplscalars * error out of all 3 spatial indices are not present * add check for scalar_id = 0 * modify for timeslices and times (#7)
1 parent 35ee711 commit 18e9871

6 files changed

+197
-60
lines changed

atmos_model.F90

+1-1
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step)
815815
if (mpp_pe() == mpp_root_pe()) print *,'in atmos_model, fhzero=',GFS_Control%fhzero, 'fhour=',sec/3600.,sec_lastfhzerofh/3600
816816

817817
if (mod((sec-sec_lastfhzerofh),int(GFS_Control%fhzero*3600.)) /= 0) then
818-
diag_time = Time - real_to_time_type(mod(int((GFS_Control%kdt - 1)*dt_phys-sec_lastfhzerofh),int(GFS_Control%fhzero))*3600.0)
818+
diag_time = Time - real_to_time_type(real(mod(int((GFS_Control%kdt - 1)*dt_phys-sec_lastfhzerofh),int(GFS_Control%fhzero*3600.0))))
819819
if (mpp_pe() == mpp_root_pe()) print *,'Warning: in atmos_init,start at non multiple of fhzero'
820820
endif
821821
if (Atmos%iau_offset > zero) then

ccpp/data/GFS_typedefs.meta

+1-1
Original file line numberDiff line numberDiff line change
@@ -9907,7 +9907,7 @@
99079907
standard_name = auxiliary_2d_arrays
99089908
long_name = auxiliary 2d arrays to output (for debugging)
99099909
units = none
9910-
dimensions = (horizontal_loop_extent,number_of_xyz_dimensioned_auxiliary_arrays)
9910+
dimensions = (horizontal_loop_extent,number_of_xy_dimensioned_auxiliary_arrays)
99119911
type = real
99129912
kind = kind_phys
99139913
active = (number_of_xy_dimensioned_auxiliary_arrays > 0)

cpl/module_cap_cpl.F90

+167-45
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,29 @@ module module_cap_cpl
1717
!-----------------------------------------------------------------------------
1818

1919
subroutine diagnose_cplFields(gcomp, clock_fv3, fcstpe, &
20-
statewrite_flag, stdiagnose_flag, state_tag)
20+
statewrite_flag, stdiagnose_flag, state_tag, rc)
2121

2222
type(ESMF_GridComp), intent(in) :: gcomp
2323
type(ESMF_Clock),intent(in) :: clock_fv3
2424
logical, intent(in) :: fcstpe
2525
logical, intent(in) :: statewrite_flag
2626
integer, intent(in) :: stdiagnose_flag
27-
character(len=*), intent(in) :: state_tag !< Import or export.
27+
character(len=*), intent(in) :: state_tag !< "import" or "export".
28+
integer, intent(out) :: rc
2829

2930
character(len=*),parameter :: subname='(module_cap_cpl:diagnose_cplFields)'
3031
type(ESMF_Time) :: currTime
3132
type(ESMF_State) :: state
32-
character(len=240) :: timestr
33-
integer :: timeslice = 1
33+
type(ESMF_TimeInterval) :: timeStep
34+
character(len=240) :: import_timestr, export_timestr
3435
character(len=160) :: nuopcMsg
3536
character(len=160) :: filename
36-
integer :: rc
3737
!
38-
call ESMF_ClockGet(clock_fv3, currTime=currTime, rc=rc)
38+
call ESMF_ClockGet(clock_fv3, currTime=currTime, timeStep=timestep, rc=rc)
39+
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
40+
call ESMF_TimeGet(currTime, timestring=import_timestr, rc=rc)
3941
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
40-
call ESMF_TimeGet(currTime, timestring=timestr, rc=rc)
42+
call ESMF_TimeGet(currTime+timestep, timestring=export_timestr, rc=rc)
4143
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
4244

4345
call ESMF_ClockPrint(clock_fv3, options="currTime", preString="current time: ", unit=nuopcMsg)
@@ -53,8 +55,8 @@ subroutine diagnose_cplFields(gcomp, clock_fv3, fcstpe, &
5355

5456
! Dump Fields out
5557
if (statewrite_flag) then
56-
write(filename,'(A)') 'fv3_cap_import_'//trim(timestr)//'_'
57-
call State_RWFields_tiles(state,trim(filename), timeslice, rc=rc)
58+
write(filename,'(A)') 'fv3_cap_import_'//trim(import_timestr)//'.tile*.nc'
59+
call State_RWFields_tiles(state,trim(filename), rc=rc)
5860
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
5961
end if
6062
end if
@@ -69,8 +71,8 @@ subroutine diagnose_cplFields(gcomp, clock_fv3, fcstpe, &
6971

7072
! Dump Fields out
7173
if (statewrite_flag) then
72-
write(filename,'(A)') 'fv3_cap_export_'//trim(timestr)//'_'
73-
call State_RWFields_tiles(state,trim(filename), timeslice, rc=rc)
74+
write(filename,'(A)') 'fv3_cap_export_'//trim(export_timestr)//'.tile*.nc'
75+
call State_RWFields_tiles(state,trim(filename), rc=rc)
7476
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
7577
end if
7678
end if
@@ -80,28 +82,36 @@ end subroutine diagnose_cplFields
8082
!-----------------------------------------------------------------------------
8183

8284
! This subroutine requires ESMFv8 - for coupled FV3
83-
subroutine State_RWFields_tiles(state,filename,timeslice,rc)
85+
subroutine State_RWFields_tiles(state,filename,rc)
8486

8587
type(ESMF_State), intent(in) :: state
8688
character(len=*), intent(in) :: fileName
87-
integer, intent(in) :: timeslice
8889
integer, intent(out) :: rc
8990

90-
! local
91-
type(ESMF_Field) :: firstESMFFLD
92-
type(ESMF_Field),allocatable :: flds(:)
93-
type(ESMF_GridComp) :: IOComp
94-
type(ESMF_Grid) :: gridFv3
95-
96-
character(len=256) :: msgString
97-
integer :: i, icount, ifld
91+
! local variables
92+
type(ESMF_Array) :: array
93+
type(ESMF_Grid) :: grid
94+
type(ESMF_FieldBundle) :: fieldbundle
95+
type(ESMF_Field), allocatable :: flds(:)
96+
type(ESMF_DistGrid) :: distgrid
97+
integer :: i, icount, ifld, id
9898
integer :: fieldcount, firstfld
99+
integer :: fieldDimCount, gridDimCount, dimCount, tileCount, ungriddedDimCount
99100
character(64), allocatable :: itemNameList(:), fldNameList(:)
100101
type(ESMF_StateItem_Flag), allocatable :: typeList(:)
102+
integer, allocatable :: minIndexPTile(:,:), maxIndexPTile(:,:)
103+
integer, allocatable :: ungriddedLBound(:), ungriddedUBound(:)
104+
integer, allocatable :: fieldDimLen(:)
105+
character(len=32), allocatable :: gridded_dim_labels(:), ungridded_dim_labels(:)
101106

102-
character(len=*),parameter :: subname='(module_cap_cpl:State_RWFields_tiles)'
107+
character(16), parameter :: convention = 'NetCDF'
108+
character(16), parameter :: purpose = 'FV3'
103109

104-
! local variables
110+
integer, parameter :: max_n_axes = 4
111+
integer, parameter :: max_n_dim = 16
112+
integer, dimension(max_n_axes, max_n_dim) :: axes_dimcount = 0
113+
114+
character(len=*),parameter :: subname='(module_cap_cpl:State_RWFields_tiles)'
105115

106116
rc = ESMF_SUCCESS
107117
!call ESMF_LogWrite(trim(subname)//trim(filename)//": called", ESMF_LOGMSG_INFO, rc=rc)
@@ -118,9 +128,6 @@ subroutine State_RWFields_tiles(state,filename,timeslice,rc)
118128
if(typeList(i) == ESMF_STATEITEM_FIELD) firstfld = i
119129
if(typeList(i) == ESMF_STATEITEM_FIELD) fieldcount = fieldcount + 1
120130
enddo
121-
!write(msgString,*) trim(subname)//' icount = ',icount," fieldcount =
122-
!",fieldcount," firstfld = ",firstfld
123-
!call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO, rc=rc)
124131

125132
allocate(flds(fieldCount),fldNameList(fieldCount))
126133
ifld = 1
@@ -131,37 +138,152 @@ subroutine State_RWFields_tiles(state,filename,timeslice,rc)
131138
endif
132139
enddo
133140

134-
call ESMF_LogWrite(trim(subname)//": write "//trim(filename)//"tile1-tile6", ESMF_LOGMSG_INFO, rc=rc)
135-
! get first field
136-
call ESMF_StateGet(state, itemName=itemNameList(firstfld), field=firstESMFFLD, rc=rc)
137-
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
138-
line=__LINE__, file=__FILE__)) return ! bail out
139-
140-
call ESMF_FieldGet(firstESMFFLD, grid=gridFv3, rc=rc)
141-
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
142-
line=__LINE__, file=__FILE__)) return ! bail out
141+
fieldbundle = ESMF_FieldBundleCreate(rc=rc)
142+
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
143143

144-
IOComp = ESMFIO_Create(gridFv3, rc=rc)
145-
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
146-
line=__LINE__, file=__FILE__)) return ! bail out
144+
call ESMF_LogWrite(trim(subname)//": write "//trim(filename), ESMF_LOGMSG_INFO, rc=rc)
147145

148146
do ifld=1, fieldCount
149147
call ESMF_StateGet(state, itemName=fldNameList(ifld), field=flds(ifld), rc=rc)
148+
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
149+
150+
call ESMF_FieldGet(flds(ifld), grid=grid, dimCount=fieldDimCount, array=array, rc=rc)
151+
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
152+
153+
if (fieldDimCount > 4) then
154+
call ESMF_LogWrite(trim(subname)//": fieldDimCount > 4 unsupported", ESMF_LOGMSG_ERROR, rc=rc)
155+
end if
156+
157+
call ESMF_GridGet(grid, dimCount=gridDimCount, rc=rc)
158+
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
159+
160+
if (gridDimCount > 2) then
161+
call ESMF_LogWrite(trim(subname)//": gridDimCount > 2 unsupported", ESMF_LOGMSG_ERROR, rc=rc)
162+
end if
163+
164+
call ESMF_ArrayGet(array, distgrid=distgrid, dimCount=dimCount, tileCount=tileCount, rc=rc)
165+
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
166+
167+
! skip 'cpl_scalars' field because it has tileCount == 1, while all other fields have 6.
168+
! This causes the following error:
169+
! 20240705 134459.788 ERROR PET000 ESMCI_IO.C:1614 ESMCI::IO::checkNtiles() Wrong data value - New number of tiles (6) does not match previously-set number of tiles (1) for this IO object. All arrays handled by a given IO object must have the same number of tiles.
170+
if (trim(fldNameList(ifld)) == 'cpl_scalars') then
171+
cycle
172+
endif
173+
174+
allocate(fieldDimLen(fieldDimCount))
175+
176+
allocate(minIndexPTile(dimCount, tileCount))
177+
allocate(maxIndexPTile(dimCount, tileCount))
178+
call ESMF_DistGridGet(distgrid, minIndexPTile=minIndexPTile, maxIndexPTile=maxIndexPTile, rc=rc)
179+
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
180+
181+
allocate(gridded_dim_labels(gridDimCount))
182+
do i = 1, gridDimCount
183+
fieldDimLen(i) = maxIndexPTile(i,1) - minIndexPTile(i,1) + 1
184+
id = find_axis_id_for_axis_count(i,fieldDimLen(i))
185+
if (id < 1) then
186+
call ESMF_LogWrite(trim(subname)//": id < 1", ESMF_LOGMSG_ERROR, rc=rc)
187+
endif
188+
if (i == 1) write(gridded_dim_labels(i),'(A,I0)') 'xaxis_',id
189+
if (i == 2) write(gridded_dim_labels(i),'(A,I0)') 'yaxis_',id
190+
end do
191+
192+
deallocate(minIndexPTile)
193+
deallocate(maxIndexPTile)
194+
195+
ungriddedDimCount = fieldDimCount - gridDimCount
196+
allocate(ungridded_dim_labels(ungriddedDimCount))
197+
if (fieldDimCount > gridDimCount) then
198+
allocate(ungriddedLBound(ungriddedDimCount))
199+
allocate(ungriddedUBound(ungriddedDimCount))
200+
call ESMF_FieldGet(flds(ifld), ungriddedLBound=ungriddedLBound, ungriddedUBound=ungriddedUBound, rc=rc)
201+
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
202+
203+
do i=1,ungriddedDimCount
204+
fieldDimLen(i+gridDimCount) = ungriddedUBound(i) - ungriddedLBound(i) + 1
205+
id = find_axis_id_for_axis_count(i+gridDimCount, fieldDimLen(i+gridDimCount))
206+
if (id < 1) then
207+
write(0,*)'stop error', id, i, fieldDimLen(i+gridDimCount)
208+
endif
209+
if (i==1) write(ungridded_dim_labels(i),'(A,I0)') 'zaxis_',id
210+
if (i==2) write(ungridded_dim_labels(i),'(A,I0)') 'taxis_',id
211+
end do
212+
deallocate(ungriddedLBound)
213+
deallocate(ungriddedUBound)
214+
end if
215+
216+
call ESMF_AttributeAdd(grid, convention=convention, purpose=purpose, attrList=(/ ESMF_ATT_GRIDDED_DIM_LABELS /), rc=rc)
217+
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
218+
219+
call ESMF_AttributeSet(grid, convention=convention, purpose=purpose, &
220+
name=ESMF_ATT_GRIDDED_DIM_LABELS, valueList=gridded_dim_labels, rc=rc)
221+
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
222+
223+
if (ungriddedDimCount > 0) then
224+
call ESMF_AttributeAdd(flds(ifld), convention=convention, purpose=purpose, &
225+
attrList=(/ ESMF_ATT_UNGRIDDED_DIM_LABELS /), rc=rc)
226+
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
227+
228+
call ESMF_AttributeSet(flds(ifld), convention=convention, purpose=purpose, &
229+
name=ESMF_ATT_UNGRIDDED_DIM_LABELS, valueList=ungridded_dim_labels, rc=rc)
230+
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
231+
end if
232+
233+
deallocate(fieldDimLen)
234+
deallocate(gridded_dim_labels)
235+
deallocate(ungridded_dim_labels)
236+
237+
call ESMF_FieldBundleAdd(fieldbundle, (/flds(ifld)/), rc=rc)
238+
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
239+
150240
enddo
151241

152-
call ESMFIO_Write(IOComp, filename, flds, filePath='./', rc=rc)
153-
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
154-
line=__LINE__, file=__FILE__)) return ! bail out
242+
call ESMF_FieldBundleWrite(fieldbundle, fileName=trim(filename), convention=convention, purpose=purpose, &
243+
timeslice=1, overwrite=.true., rc=rc)
244+
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
155245

156-
! -- Finalize ESMFIO
246+
! -- Finalize
157247
deallocate(flds)
158248
deallocate(fldNameList)
159-
call ESMFIO_Destroy(IOComp, rc=rc)
160-
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
161-
line=__LINE__, file=__FILE__)) call ESMF_Finalize()
249+
250+
call ESMF_FieldBundleDestroy(fieldbundle, rc=rc)
251+
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
162252

163253
!call ESMF_LogWrite(trim(subname)//trim(filename)//": finished", ESMF_LOGMSG_INFO, rc=rc)
164254

255+
contains
256+
257+
function find_axis_id_for_axis_count(axis, count) result(id)
258+
integer, intent(in) :: axis, count
259+
260+
integer :: id
261+
integer :: i
262+
263+
id = -1 ! not found
264+
265+
if (axis > max_n_axes) then
266+
call ESMF_LogWrite('axis > max_n_axes. Increase max_n_axes in '//trim(subname), ESMF_LOGMSG_ERROR)
267+
return
268+
end if
269+
270+
do i =1, max_n_dim
271+
if (axes_dimcount(axis, i) == 0) then
272+
axes_dimcount(axis, i) = count
273+
id = i
274+
return
275+
else
276+
if (axes_dimcount(axis, i) == count) then
277+
id = i
278+
return
279+
end if
280+
end if
281+
end do
282+
283+
call ESMF_LogWrite('Increase max_n_dim in '//trim(subname), ESMF_LOGMSG_ERROR)
284+
285+
end function find_axis_id_for_axis_count
286+
165287
end subroutine State_RWFields_tiles
166288

167289
!-----------------------------------------------------------------------------

cpl/module_cplscalars.F90

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ subroutine State_SetScalar(scalar_value, scalar_id, State, flds_scalar_name, fld
116116
if (mytask == 0) then
117117
call ESMF_FieldGet(lfield, farrayPtr = farrayptr, rc=rc)
118118
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
119-
if (scalar_id < 0 .or. scalar_id > flds_scalar_num) then
119+
if (scalar_id <= 0 .or. scalar_id > flds_scalar_num) then
120120
call ESMF_LogWrite(trim(subname)//": ERROR in scalar_id", ESMF_LOGMSG_INFO)
121121
rc = ESMF_FAILURE
122122
return

fv3_cap.F90

+20-10
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,6 @@ subroutine InitializeAdvertise(gcomp, rc)
288288
call ESMF_LogWrite(trim(subname)//' flds_scalar_name = '//trim(flds_scalar_name), ESMF_LOGMSG_INFO)
289289
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
290290
endif
291-
292291
call NUOPC_CompAttributeGet(gcomp, name="ScalarFieldCount", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc)
293292
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
294293
if (isPresent .and. isSet) then
@@ -313,14 +312,23 @@ subroutine InitializeAdvertise(gcomp, rc)
313312
call ESMF_LogWrite(trim(subname)//' : flds_scalar_index_ny = '//trim(msgString), ESMF_LOGMSG_INFO)
314313
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
315314
endif
316-
call NUOPC_CompAttributeGet(gcomp, name="ScalarFieldIdxGridNTile", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc)
317-
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
318-
if (isPresent .and. isSet) then
319-
read(cvalue,*) flds_scalar_index_ntile
320-
write(msgString,*) flds_scalar_index_ntile
321-
call ESMF_LogWrite(trim(subname)//' : flds_scalar_index_ntile = '//trim(msgString), ESMF_LOGMSG_INFO)
315+
! tile index must be present if indices for nx and ny are non-zero
316+
if (flds_scalar_index_nx /= 0 .and. flds_scalar_index_ny /=0 ) then
317+
call NUOPC_CompAttributeGet(gcomp, name="ScalarFieldIdxGridNTile", isPresent=isPresent, isSet=isSet, rc=rc)
322318
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
323-
endif
319+
if (.not. isPresent .and. .not. isSet) then
320+
if (mype == 0)write(*,*)'ERROR : ScalarFieldIdxGridNTile must be set'
321+
call ESMF_LogWrite('ERROR : ScalarFieldIdxGridNTile must be set', ESMF_LOGMSG_ERROR)
322+
rc = ESMF_FAILURE
323+
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
324+
else
325+
call NUOPC_CompAttributeGet(gcomp, name="ScalarFieldIdxGridNTile", value=cvalue, rc=rc)
326+
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
327+
read(cvalue,*) flds_scalar_index_ntile
328+
write(msgString,*) flds_scalar_index_ntile
329+
call ESMF_LogWrite(trim(subname)//' : flds_scalar_index_ntile = '//trim(msgString), ESMF_LOGMSG_INFO)
330+
endif
331+
end if
324332

325333
!------------------------------------------------------------------------
326334
! get config variables
@@ -1081,7 +1089,8 @@ subroutine ModelAdvance_phase1(gcomp, rc)
10811089
if( dbug > 0 .or. cplprint_flag ) then
10821090
fcstpe = .false.
10831091
if( mype < num_pes_fcst ) fcstpe = .true.
1084-
call diagnose_cplFields(gcomp, clock, fcstpe, cplprint_flag, dbug, 'import')
1092+
call diagnose_cplFields(gcomp, clock, fcstpe, cplprint_flag, dbug, 'import', rc=rc)
1093+
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
10851094
endif
10861095

10871096
timep1re = MPI_Wtime()
@@ -1235,7 +1244,8 @@ subroutine ModelAdvance_phase2(gcomp, rc)
12351244
if( dbug > 0 .or. cplprint_flag ) then
12361245
fcstpe = .false.
12371246
if( mype < num_pes_fcst ) fcstpe = .true.
1238-
call diagnose_cplFields(gcomp, clock_out, fcstpe, cplprint_flag, dbug, 'export')
1247+
call diagnose_cplFields(gcomp, clock_out, fcstpe, cplprint_flag, dbug, 'export', rc=rc)
1248+
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
12391249
end if
12401250

12411251
timep2re = MPI_Wtime()

0 commit comments

Comments
 (0)