Skip to content

Commit 339112c

Browse files
authored
Merge pull request #15 from ESCOMP/feature/bug_fixes
Several bug fixes
2 parents 2fa1125 + bb79a7f commit 339112c

File tree

5 files changed

+57
-42
lines changed

5 files changed

+57
-42
lines changed

datm/cime_config/namelist_definition_datm.xml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@
342342
<!-- optional stream prescribed aero -->
343343
<!-- ==================================== -->
344344
<value stream="presaero.cplhist">
345-
$DATM_DOMAIN_MESH
345+
$ATM_DOMAIN_MESH
346346
</value>
347347
<value stream="presaero\.">
348348
$DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc
@@ -351,7 +351,7 @@
351351
<!-- optional topo -->
352352
<!-- ==================================== -->
353353
<value stream="topo.cplhist">
354-
$DATM_DOMAIN_MESH
354+
$ATM_DOMAIN_MESH
355355
</value>
356356
<value stream="topo.observed">
357357
$DIN_LOC_ROOT/atm/datm7/topo_forcing/topodata_0.9x1.SCRIP.210520_ESMFmesh.nc
@@ -2412,6 +2412,10 @@
24122412
<value stream="CPLHISTForcing.State1hr">linear</value>
24132413
<value stream="presaero.cplhist">nearest</value>
24142414
<value stream="topo.cplhist">nearest</value>
2415+
<value stream="CLM_QIAN.Solar">coszen</value>
2416+
<value stream="CLM_QIAN.Precip">nearest</value>
2417+
<value stream="CLM_QIAN_WISO.Solar">coszen</value>
2418+
<value stream="CLM_QIAN_WISO.Precip">nearest</value>
24152419
<value stream="CLMCRUNCEP.Solar">coszen</value>
24162420
<value stream="CLMCRUNCEP.Precip">nearest</value>
24172421
<value stream="CLMCRUNCEPv7.Solar">coszen</value>
@@ -2506,6 +2510,9 @@
25062510
<value stream="CPLHISTForcing.State1hr">3.0</value>
25072511
<value stream="presaero.cplhist">3.0</value>
25082512
<value stream="topo.cplhist">3.0</value>
2513+
<value stream="co2tseries.20tr">1.e30</value>
2514+
<value stream="co2tseries.SSP">1.e30</value>
2515+
<value datm_mode="1PT">1.e30</value>
25092516
</values>
25102517
</entry>
25112518

dice/cime_config/namelist_definition_dice.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
<value stream="ssmi$">
7777
$DIN_LOC_ROOT/ice/dice7/SSMI/ssmi.ifrac.0.5x0.5_ESMFmesh_120520.nc
7878
</value>
79-
<value stream="ssmi_IAF">
79+
<value stream="ssmi_iaf">
8080
$DIN_LOC_ROOT/ocn/iaf/ssmi.ifrac.0.5x0.5_ESMFmesh_120520.nc
8181
</value>
8282
</values>

dshr/dshr_dfield_mod.F90

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,6 @@ subroutine dshr_dfield_add_1d(dfields, sdat, state_fld, strm_fld, state, logunit
120120
110 format(a)
121121
end if
122122

123-
! write output
124-
if (masterproc) then
125-
if (found) then
126-
write(logunit,100)'(dshr_addfield_add) set pointer to stream field strm_'//trim(strm_fld)//&
127-
' stream index = ',ns,' field bundle index= ',nf
128-
100 format(a,i6,2x,a,i6)
129-
end if
130-
end if
131-
132123
end subroutine dshr_dfield_add_1d
133124

134125
!===============================================================================

streams/dshr_strdata_mod.F90

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ subroutine shr_strdata_init(sdat, model_clock, rc)
395395
call shr_sys_abort(subName//"ERROR: file does not exist: "//trim(fileName))
396396
end if
397397
endif
398-
if(filename /= 'none') then
398+
if (filename /= 'none') then
399399
sdat%pstrm(ns)%stream_mesh = ESMF_MeshCreate(trim(filename), fileformat=ESMF_FILEFORMAT_ESMFMESH, rc=rc)
400400
endif
401401
if (ChkErr(rc,__LINE__,u_FILE_u)) return
@@ -698,15 +698,13 @@ subroutine shr_strdata_advance(sdat, ymd, tod, logunit, istr, timers, rc)
698698
logical :: checkflag = .false.
699699
integer :: npes
700700
integer :: my_task
701+
integer :: nstreams
701702
real(r8) ,parameter :: solZenMin = 0.001_r8 ! minimum solar zenith angle
702703
integer ,parameter :: tadj = 2
703704
character(len=*) ,parameter :: timname = "_strd_adv"
704705
character(*) ,parameter :: subname = "(shr_strdata_advance) "
705706
character(*) ,parameter :: F00 = "('(shr_strdata_advance) ',a)"
706707
character(*) ,parameter :: F01 = "('(shr_strdata_advance) ',a,a,i4,2(f10.5,2x))"
707-
real(r8), pointer :: dataptr_temp1(:)
708-
real(r8), pointer :: dataptr_temp2(:)
709-
integer :: nstreams
710708
!-------------------------------------------------------------------------------
711709

712710
rc = ESMF_SUCCESS
@@ -806,21 +804,27 @@ subroutine shr_strdata_advance(sdat, ymd, tod, logunit, istr, timers, rc)
806804
call shr_cal_timeSet(timeUB,sdat%pstrm(ns)%ymdUB,0,sdat%stream(ns)%calendar,rc=rc)
807805
if (ChkErr(rc,__LINE__,u_FILE_u)) return
808806
timeint = timeUB-timeLB
809-
call ESMF_TimeIntervalGet(timeint,StartTimeIn=timeLB,d=dday)
807+
call ESMF_TimeIntervalGet(timeint, StartTimeIn=timeLB, d=dday)
810808
if (ChkErr(rc,__LINE__,u_FILE_u)) return
811809
dtime = abs(real(dday,r8) + real(sdat%pstrm(ns)%todUB-sdat%pstrm(ns)%todLB,r8)/shr_const_cDay)
812810

813811
sdat%pstrm(ns)%dtmin = min(sdat%pstrm(ns)%dtmin,dtime)
814812
sdat%pstrm(ns)%dtmax = max(sdat%pstrm(ns)%dtmax,dtime)
813+
815814
if ((sdat%pstrm(ns)%dtmax/sdat%pstrm(ns)%dtmin) > sdat%stream(ns)%dtlimit) then
816815
if (sdat%masterproc) then
817-
write(sdat%logunit,*) trim(subname),' ERROR: for stream ',n
818-
write(sdat%logunit,*) trim(subName),' ERROR: dt limit1 ',&
819-
sdat%pstrm(ns)%dtmax, sdat%pstrm(ns)%dtmin, sdat%stream(ns)%dtlimit
820-
write(sdat%logunit,*) trim(subName),' ERROR: dt limit2 ',&
816+
write(sdat%logunit,*) trim(subname),' ERROR: for stream ',ns
817+
write(sdat%logunit,*) trim(subName),' ERROR: dtime, dtmax, dtmin, dtlimit = ',&
818+
dtime, sdat%pstrm(ns)%dtmax, sdat%pstrm(ns)%dtmin, sdat%stream(ns)%dtlimit
819+
write(sdat%logunit,*) trim(subName),' ERROR: ymdLB, todLB, ymdUB, todUB = ', &
821820
sdat%pstrm(ns)%ymdLB, sdat%pstrm(ns)%todLB, sdat%pstrm(ns)%ymdUB, sdat%pstrm(ns)%todUB
822821
end if
823-
call shr_sys_abort(trim(subName)//' ERROR dt limit for stream')
822+
write(6,*) trim(subname),' ERROR: for stream ',ns
823+
write(6,*) trim(subName),' ERROR: dtime, dtmax, dtmin, dtlimit = ',&
824+
dtime, sdat%pstrm(ns)%dtmax, sdat%pstrm(ns)%dtmin, sdat%stream(ns)%dtlimit
825+
write(6,*) trim(subName),' ERROR: ymdLB, todLB, ymdUB, todUB = ', &
826+
sdat%pstrm(ns)%ymdLB, sdat%pstrm(ns)%todLB, sdat%pstrm(ns)%ymdUB, sdat%pstrm(ns)%todUB
827+
call shr_sys_abort(trim(subName)//' ERROR dt limit for stream, see atm.log output')
824828
endif
825829
endif
826830

@@ -1256,8 +1260,6 @@ subroutine shr_strdata_readstrm(sdat, ns, stream, stream_mesh, &
12561260

12571261
lsize = size(dataptr)
12581262
do nf = 1,size(fldlist_stream)
1259-
call dshr_fldbun_getfieldN(fldbun_model, nf, field_dst, rc=rc)
1260-
if (chkerr(rc,__LINE__,u_FILE_u)) return
12611263
rcode = pio_inq_varid(pioid, trim(fldlist_stream(nf)), varid)
12621264
! determine type of the variable
12631265
rcode = pio_inq_vartype(pioid, varid, pio_iovartype)
@@ -1357,16 +1359,23 @@ subroutine shr_strdata_readstrm(sdat, ns, stream, stream_mesh, &
13571359
call shr_sys_abort(subName//"ERROR: only double, real and short types are supported for stream read")
13581360
end if
13591361

1360-
if(associated(dataptr2d_src) .and. trim(fldlist_model(nf)) .eq. uname) then
1362+
if (associated(dataptr2d_src) .and. trim(fldlist_model(nf)) .eq. uname) then
13611363
! save in dataptr2d_src
13621364
dataptr2d_src(1,:) = dataptr(:)
1363-
elseif(associated(dataptr2d_src) .and. trim(fldlist_model(nf)) .eq. vname) then
1365+
else if (associated(dataptr2d_src) .and. trim(fldlist_model(nf)) .eq. vname) then
1366+
! save in dataptr2d_src
13641367
dataptr2d_src(2,:) = dataptr(:)
13651368
else if (pio_iodesc_set) then
1369+
! regrid the data
1370+
call dshr_fldbun_getfieldN(fldbun_model, nf, field_dst, rc=rc)
1371+
if (chkerr(rc,__LINE__,u_FILE_u)) return
13661372
call ESMF_FieldRegrid(sdat%pstrm(ns)%field_stream, field_dst, routehandle=sdat%pstrm(ns)%routehandle, &
13671373
termorderflag=ESMF_TERMORDER_SRCSEQ, checkflag=.false., zeroregion=ESMF_REGION_TOTAL, rc=rc)
13681374
if (chkerr(rc,__LINE__,u_FILE_u)) return
13691375
else
1376+
! fill the data
1377+
call dshr_fldbun_getfieldN(fldbun_model, nf, field_dst, rc=rc)
1378+
if (chkerr(rc,__LINE__,u_FILE_u)) return
13701379
call ESMF_FieldFill(field_dst, dataFillScheme="const", const1=dataptr(1), rc=rc)
13711380
if (chkerr(rc,__LINE__,u_FILE_u)) return
13721381
endif

streams/dshr_stream_mod.F90

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ module dshr_stream_mod
110110
end type shr_stream_streamType
111111

112112
!----- parameters -----
113-
integer , save :: debug = 0 ! edit/turn-on for debug write statements
113+
integer :: debug = 0 ! edit/turn-on for debug write statements
114114
real(R8) , parameter :: spd = shr_const_cday ! seconds per day
115115
character(*) , parameter :: u_FILE_u = &
116116
__FILE__
@@ -129,19 +129,23 @@ subroutine shr_stream_init_from_xml(xmlfilename, streamdat, mastertask, logunit,
129129
! <?xml version="1.0"?>
130130
! <file id="stream" version="1.0">
131131
! <stream_info>
132-
! <meshfile>
133-
! mesh_filename
134-
! </meshfile>
135-
! <data_files>
136-
! /glade/p/cesmdata/cseg/inputdata/atm/datm7/NYF/nyf.ncep.T62.050923.nc
137-
! .....
138-
! <data_files>
139-
! <data_variables>
140-
! u_10 u
141-
! </data_variables>
142-
! <stream_offset>
143-
! 0
144-
! </stream_offset>
132+
! <taxmode></taxmode>
133+
! <tInterpAlgo></tInterpAlgo>
134+
! <readMode></readMode>
135+
! <mapalgo></mapalgo>
136+
! <dtlimit></dtlimit>
137+
! <yearFirst></yearFirst>
138+
! <yearLast></yearLast>
139+
! <yearAlign></yearAlign>
140+
! <stream_vectors></stream_vectors>
141+
! <stream_mesh_file></stream_mesh_file>
142+
! <stream_data_files>
143+
! <file></file>
144+
! </stream_data_files>
145+
! <stream_data_variables>
146+
! <var></var>
147+
! </stream_data_variables>
148+
! <stream_offset></stream_offset>
145149
! </stream_info>
146150
! </file>
147151
! ---------------------------------------------------------------------
@@ -163,6 +167,7 @@ subroutine shr_stream_init_from_xml(xmlfilename, streamdat, mastertask, logunit,
163167
integer :: status
164168
integer :: tmp(6)
165169
real(r8) :: rtmp(1)
170+
character(*),parameter :: subName = '(shr_stream_init_from_xml) '
166171
! --------------------------------------------------------
167172

168173
rc = ESMF_SUCCESS
@@ -332,16 +337,19 @@ subroutine shr_stream_init_from_xml(xmlfilename, streamdat, mastertask, logunit,
332337
streamdat(i)%pio_iotype = shr_pio_getiotype(trim(compname))
333338
streamdat(i)%pio_ioformat = shr_pio_getioformat(trim(compname))
334339
call shr_stream_getCalendar(streamdat(i), 1, streamdat(i)%calendar)
335-
enddo
336340

341+
! Error check
342+
if (trim(streamdat(i)%taxmode) == shr_stream_taxis_extend .and. streamdat(i)%dtlimit < 1.e10) then
343+
call shr_sys_abort(trim(subName)//" ERROR: if taxmode value is extend set dtlimit to 1.e30")
344+
end if
345+
enddo
337346

338347
! Set logunit
339348
streamdat(:)%logunit = logunit
340349

341350
! initialize flag that stream has been set
342351
streamdat(:)%init = .true.
343352

344-
345353
end subroutine shr_stream_init_from_xml
346354

347355
!===============================================================================

0 commit comments

Comments
 (0)