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

Fix several data component issues #1987

Merged
merged 4 commits into from
Oct 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/build_scripts/buildlib.csm_share
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ chdir($libdir) or die "Could not cd to $libdir: $!\n";
my @filepath = ( "$CASEROOT/SourceMods/src.share",
"$CIMEROOT/src/drivers/mct/shr",
"$CIMEROOT/src/components/xcpl_models/xshare",
"$CIMEROOT/src/components/data_comps/dshare",
"$CIMEROOT/src/share/streams",
"$CIMEROOT/src/share/util",
"$CIMEROOT/src/share/RandNum/src",
"$CIMEROOT/src/share/RandNum/src/dsfmt_f03",
Expand Down
2 changes: 2 additions & 0 deletions src/components/data_comps/datm/cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen):
if atm_domain_file != "UNSET":
full_domain_path = os.path.join(atm_domain_path, atm_domain_file)
nmlgen.add_default("domainfile", value=full_domain_path)
else:
nmlgen.add_default("domainfile", value='null')

#----------------------------------------------------
# Finally, write out all the namelists.
Expand Down
2 changes: 2 additions & 0 deletions src/components/data_comps/dice/cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen):
if ice_domain_file != "UNSET":
full_domain_path = os.path.join(ice_domain_path, ice_domain_file)
nmlgen.add_default("domainfile", value=full_domain_path)
else:
nmlgen.add_default("domainfile", value='null')

#----------------------------------------------------
# Finally, write out all the namelists.
Expand Down
2 changes: 2 additions & 0 deletions src/components/data_comps/dlnd/cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen):
if lnd_domain_file != "UNSET":
full_domain_path = os.path.join(lnd_domain_path, lnd_domain_file)
nmlgen.add_default("domainfile", value=full_domain_path)
else:
nmlgen.add_default("domainfile", "null")

#----------------------------------------------------
# Finally, write out all the namelists.
Expand Down
6 changes: 6 additions & 0 deletions src/components/data_comps/docn/cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen):
if ocn_domain_file != "UNSET":
full_domain_path = os.path.join(ocn_domain_path, ocn_domain_file)
nmlgen.add_default("domainfile", value=full_domain_path)
else:
if "aqua" in docn_mode:
expect( ocn_domain_file != "UNSET",
"in aquaplanet mode the xml variable OCN_DOMAIN_FILE cannot be equal to UNSET ")
else:
nmlgen.add_default("domainfile", value='null')

#----------------------------------------------------
# Finally, write out all the namelists.
Expand Down
19 changes: 6 additions & 13 deletions src/components/data_comps/docn/docn_comp_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,12 @@ subroutine docn_comp_init(Eclock, x2o, o2x, &
call shr_strdata_init(SDOCN,mpicom,compid,name='ocn', &
scmmode=scmmode,scmlon=scmlon,scmlat=scmlat, calendar=calendar)
else
call shr_strdata_init(SDOCN,mpicom,compid,name='ocn', calendar=calendar)
if (datamode == 'SST_AQUAPANAL' .or. datamode == 'SST_AQUAPFILE' .or. datamode == 'SOM_AQUAP') then
! Special logic for either prescribed or som aquaplanet - overwrite and
call shr_strdata_init(SDOCN,mpicom,compid,name='ocn', calendar=calendar, reset_domain_mask=.true.)
else
call shr_strdata_init(SDOCN,mpicom,compid,name='ocn', calendar=calendar)
end if
endif

if (my_task == master_task) then
Expand Down Expand Up @@ -215,18 +220,6 @@ subroutine docn_comp_init(Eclock, x2o, o2x, &

call shr_dmodel_rearrGGrid(SDOCN%grid, ggrid, gsmap, rearr, mpicom)

! Special logic for either prescribed or som aquaplanet - overwrite and
! set mask/frac to 1
if (datamode == 'SST_AQUAPANAL' .or. datamode == 'SST_AQUAPFILE' .or. datamode == 'SOM_AQUAP') then
kmask = mct_aVect_indexRA(ggrid%data,'mask')
ggrid%data%rattr(kmask,:) = 1

kfrac = mct_aVect_indexRA(ggrid%data,'frac')
ggrid%data%rattr(kfrac,:) = 1.0_r8

write(logunit,F00) ' Resetting the data ocean mask and frac to 1 for aquaplanet'
end if

call t_stopf('docn_initmctdom')

!----------------------------------------------------------------------------
Expand Down
9 changes: 2 additions & 7 deletions src/components/data_comps/drof/cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,11 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen):
logger.info(" .... Obtaining DROF model domain info from stream {}".format(streams[0]))
nmlgen.add_default("domainfile", value=drof_cplhist_domain_file)
else:
rof_domain_file = case.get_value("ROF_DOMAIN_FILE")
rof_domain_path = case.get_value("ROF_DOMAIN_PATH")
if rof_domain_file != "UNSET":
full_domain_path = os.path.join(rof_domain_path, rof_domain_file)
nmlgen.add_default("domainfile", value=full_domain_path)

# set variables that are not per-stream
if rof_domain_file != "UNSET":
full_domain_path = os.path.join(rof_domain_path, rof_domain_file)
nmlgen.add_default("domainfile", value=full_domain_path)
else:
nmlgen.add_default("domainfile", value="null")

#----------------------------------------------------
# Finally, write out all the namelists.
Expand Down
2 changes: 2 additions & 0 deletions src/components/data_comps/dwav/cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen):
if wav_domain_file != "UNSET":
full_domain_path = os.path.join(wav_domain_path, wav_domain_file)
nmlgen.add_default("domainfile", value=full_domain_path)
else:
nmlgen.add_default("domainfile", value="null")

#----------------------------------------------------
# Finally, write out all the namelists.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ module shr_strdata_mod
!===============================================================================

subroutine shr_strdata_init(SDAT,mpicom,compid,name,scmmode,scmlon,scmlat, &
gsmap,ggrid,nxg,nyg,nzg,calendar)
gsmap,ggrid,nxg,nyg,nzg,calendar,reset_domain_mask)

implicit none

Expand All @@ -185,6 +185,7 @@ subroutine shr_strdata_init(SDAT,mpicom,compid,name,scmmode,scmlon,scmlat, &
integer(IN) ,intent(in),optional :: nyg
integer(IN) ,intent(in),optional :: nzg
character(len=*) ,intent(in),optional :: calendar
logical ,intent(in),optional :: reset_domain_mask

integer(IN) :: n,m,k ! generic index
integer(IN) :: nu,nv ! u,v index
Expand All @@ -209,7 +210,7 @@ subroutine shr_strdata_init(SDAT,mpicom,compid,name,scmmode,scmlon,scmlat, &
integer(IN), pointer :: dof(:)
type(mct_sMat):: sMati
logical :: lscmmode

integer :: kmask, kfrac
character(len=*),parameter :: subname = "(shr_strdata_init) "
character(*),parameter :: F00 = "('(shr_strdata_init) ',8a)"

Expand Down Expand Up @@ -319,7 +320,9 @@ subroutine shr_strdata_init(SDAT,mpicom,compid,name,scmmode,scmlon,scmlat, &
call shr_mpi_bcast(areaName,mpicom)
call shr_dmodel_readgrid(SDAT%gridR(n),SDAT%gsmapR(n),SDAT%strnxg(n),SDAT%strnyg(n),SDAT%strnzg(n), &
fileName, compid, mpicom, '2d1d', lonName, latName, hgtName, maskName, areaName)

SDAT%lsizeR(n) = mct_gsmap_lsize(SDAT%gsmapR(n),mpicom)

call mct_gsmap_OrderedPoints(SDAT%gsmapR(n), my_task, dof)
if (SDAT%strnzg(n) <= 0) then
call pio_initdecomp(SDAT%pio_subsystem, pio_double, &
Expand Down Expand Up @@ -382,6 +385,18 @@ subroutine shr_strdata_init(SDAT,mpicom,compid,name,scmmode,scmlon,scmlat, &
SDAT%domainfile, compid, mpicom, '2d1d', readfrac=.true.)
endif
endif

if (present(reset_domain_mask)) then
if (reset_domain_mask) then
write(logunit,F00) ' Resetting the component domain mask and frac to 1'
kmask = mct_aVect_indexRA(SDAT%grid%data,'mask')
SDAT%grid%data%rattr(kmask,:) = 1

kfrac = mct_aVect_indexRA(SDAT%grid%data,'frac')
SDAT%grid%data%rattr(kfrac,:) = 1.0_r8
end if
end if

endif
SDAT%lsize = mct_gsmap_lsize(SDAT%gsmap,mpicom)

Expand Down