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

Add the mosart runoff model #526

Merged
merged 12 commits into from
Jan 14, 2016
47 changes: 46 additions & 1 deletion models/atm/datm/bld/namelist_files/namelist_defaults_datm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ Currently the following streams are supported (term definitions precede the stre
<datamode datm_mode="CORE2_NYF" >CORE2_NYF</datamode>
<datamode datm_mode="CORE2_IAF" >CORE2_IAF</datamode>
<datamode datm_mode="WW3" >COPYALL</datamode>
<datamode datm_mode="NLDAS" >CLMNCEP</datamode>

<!-- ========================================= -->
<!--- streams -->
Expand All @@ -158,7 +159,8 @@ Currently the following streams are supported (term definitions precede the stre
<streamslist datm_mode="CORE2_NYF" >CORE2_NYF.GISS,CORE2_NYF.GXGXS,CORE2_NYF.NCEP</streamslist>
<streamslist datm_mode="CORE2_IAF" >CORE2_IAF.GCGCS.PREC,CORE2_IAF.GISS.LWDN,CORE2_IAF.GISS.SWDN,CORE2_IAF.GISS.SWUP,CORE2_IAF.NCEP.DN10,CORE2_IAF.NCEP.Q_10,CORE2_IAF.NCEP.SLP_,CORE2_IAF.NCEP.T_10,CORE2_IAF.NCEP.U_10,CORE2_IAF.NCEP.V_10,CORE2_IAF.CORE2.ArcFactor</streamslist>
<streamslist datm_mode="CPLHIST3HrWx">CPLHIST3HrWx.Solar,CPLHIST3HrWx.Precip,CPLHIST3HrWx.nonSolarNonPrecip</streamslist>
<streamslist datm_mode="WW3" >WW3</streamslist>
<streamslist datm_mode="WW3" >WW3</streamslist>
<streamslist datm_mode="NLDAS" >NLDAS</streamslist>

<!-- ========================================= -->
<!--- vectors -->
Expand All @@ -172,6 +174,7 @@ Currently the following streams are supported (term definitions precede the stre
<vectors datm_mode="CORE2_NYF" >u:v</vectors>
<vectors datm_mode="CORE2_IAF" >u:v</vectors>
<vectors datm_mode="WW3" >u:v</vectors>
<vectors datm_mode="NLDAS" >null</vectors>

<!-- ========================================= -->
<!--- dtlimit (default) -->
Expand Down Expand Up @@ -1545,6 +1548,48 @@ ncep.v_10.T62.2009.20120412.nc
airSeaTempDiff tbot
</strm_datvar>

<!-- == NLDAS ==== -->

<strm_year_start stream="NLDAS">1980</strm_year_start>
<strm_year_end stream="NLDAS">1980</strm_year_end>
<strm_year_align stream="NLDAS">1980</strm_year_align>
<strm_domdir stream="NLDAS">$DIN_LOC_ROOT/share/domains/domain.clm</strm_domdir>
<strm_domfil stream="NLDAS">domain.lnd.nldas2_0224x0464_c110415.nc</strm_domfil>
<strm_datdir stream="NLDAS">$DIN_LOC_ROOT/atm/datm7/NLDAS</strm_datdir>
<strm_datfil stream="NLDAS">
clmforc.nldas.1980-01.nc
clmforc.nldas.1980-02.nc
clmforc.nldas.1980-03.nc
clmforc.nldas.1980-04.nc
clmforc.nldas.1980-05.nc
clmforc.nldas.1980-06.nc
clmforc.nldas.1980-07.nc
clmforc.nldas.1980-08.nc
clmforc.nldas.1980-09.nc
clmforc.nldas.1980-10.nc
clmforc.nldas.1980-11.nc
clmforc.nldas.1980-12.nc
</strm_datfil>
<strm_offset stream="NLDAS">0</strm_offset>
<strm_tintalgo stream="NLDAS">linear</strm_tintalgo>
<strm_mapalgo stream="NLDAS">bilinear</strm_mapalgo>
<strm_domvar stream="NLDAS">
time time
xc lon
yc lat
area area
mask mask
</strm_domvar>
<strm_datvar stream="NLDAS">
TBOT tbot
WIND wind
QBOT shum
PSRF pbot
FLDS lwdn
PRECTmms precn
FSDS swdn
</strm_datvar>


<!-- ========================================= -->
<!-- CO2 time-series -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
type="char*256"
category="datm_setting"
group="datm_env_settings"
valid_values="CLM_QIAN,CLM1PT,CLMCRUNCEP,CPLHIST3HrWx,CORE2_NYF,CORE2_IAF,COPYALL_NPS_v1,COPYALL_CORE2_v1,WW3">
valid_values="CLM_QIAN,CLM1PT,CLMCRUNCEP,CPLHIST3HrWx,CORE2_NYF,CORE2_IAF,COPYALL_NPS_v1,COPYALL_CORE2_v1,WW3,NLDAS">
Data Model mode to process forcing data
</entry>

Expand Down
32 changes: 23 additions & 9 deletions models/drv/driver/component_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,6 @@ module component_mod
integer :: nthreads_GLOID, nthreads_CPLID
logical :: drv_threading

character(*), parameter :: subname = '(component_mod)'
character(*), parameter :: F00 = "('"//subname//" : ', 4A )"
character(*), parameter :: F0L = "('"//subname//" : ', A, L6 )"
character(*), parameter :: F0I = "('"//subname//" : ', A, 2i8 )"
character(*), parameter :: F0R = "('"//subname//" : ', A, 2g23.15 )"

!===============================================================================

contains
Expand Down Expand Up @@ -104,6 +98,7 @@ subroutine component_init_pre(comp, compid, cplcompid, cplallcompid, &
!
! Local Variables
integer :: eci ! index
character(*), parameter :: subname = '(component_init_pre)'
!---------------------------------------------------------------

! initialize module variables (this is repetitive here- but does not require a different routine)
Expand Down Expand Up @@ -199,6 +194,8 @@ end subroutine comp_init
! Local Variables
integer :: k1, k2
integer :: eci
character(*), parameter :: subname = '(component_init_cc:mct)'
character(*), parameter :: F00 = "('"//subname//" : ', 4A )"
!---------------------------------------------------------------

! **** Initialize component - this initializes x2c_cc and c2x_cc ***
Expand Down Expand Up @@ -327,7 +324,9 @@ end subroutine gridcomp_register
integer , pointer :: petlist(:)
real(R8), pointer :: fptr(:,:) ! pointer into array data
character(len=1) :: cid
character(len=8196) :: mct_names_x2c, mct_names_c2x
character(len=8196) :: mct_names_x2c, mct_names_c2x, mct_names_dom
character(*), parameter :: subname = '(component_init_cc:esmf)'
character(*), parameter :: F00 = "('"//subname//" : ', 4A )"
!---------------------------------------------------------------

if (present(seq_flds_x2c_fluxes) .and. present(seq_flds_c2x_fluxes)) then
Expand Down Expand Up @@ -522,6 +521,9 @@ end subroutine gridcomp_register
call ESMF_ArrayDestroy(c2x_cc_array, rc=rc) ! destroy the Array
if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT)

call ESMF_AttributeGet(dom_cc_array, name='mct_names', value=mct_names_dom, rc=rc)
if(rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT)

call ESMF_ArrayDestroy(dom_cc_array, rc=rc) ! destroy the Array
if (rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT)

Expand All @@ -548,6 +550,9 @@ end subroutine gridcomp_register
call ESMF_AttributeSet(c2x_cc_array, name="mct_names", value=trim(mct_names_c2x), rc=rc)
if(rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT)

call ESMF_AttributeSet(dom_cc_array, name="mct_names", value=trim(mct_names_dom), rc=rc)
if(rc /= ESMF_SUCCESS) call ESMF_Finalize(rc=rc, endflag=ESMF_END_ABORT)

call ESMF_StateReplace(comp(eci)%x2c_cc_state, (/x2c_cc_array/), rc=rc)
call ESMF_StateReplace(comp(eci)%c2x_cc_state, (/c2x_cc_array/), rc=rc)
call ESMF_StateReplace(comp(eci)%c2x_cc_state, (/dom_cc_array/), rc=rc)
Expand Down Expand Up @@ -634,6 +639,7 @@ subroutine component_init_update_petlist(comp, vm)
integer :: eci
integer :: rc
integer, pointer :: petlist(:)
character(*), parameter :: subname = '(component_init_update_petlist)'
!---------------------------------------------------------------

! Update petlist attribute
Expand Down Expand Up @@ -669,6 +675,8 @@ subroutine component_init_cx(comp, infodata)
integer :: eci
integer :: rc ! return code
type(mct_gGrid) :: dom_tmp ! temporary
character(*), parameter :: subname = '(component_init_cx)'
character(*), parameter :: F0I = "('"//subname//" : ', A, 2i8 )"
!---------------------------------------------------------------

! Initialize driver rearrangers and AVs on driver
Expand Down Expand Up @@ -783,6 +791,7 @@ subroutine component_init_aream(infodata, rof_c2_ocn, samegrid_ao, samegrid_al,
logical :: ice_present ! ice present flag
logical :: glc_present ! glc present flag
integer :: ka,km
character(*), parameter :: subname = '(component_init_aream)'
!---------------------------------------------------------------

! Note that the following is assumed to hold - all gsmaps_cx for a given
Expand Down Expand Up @@ -881,6 +890,7 @@ subroutine component_init_areacor(comp, samegrid, seq_flds_c2x_fluxes)
!
! Local Variables
integer :: eci, num_inst
character(*), parameter :: subname = '(component_init_areacor)'
!---------------------------------------------------------------

num_inst = size(comp)
Expand Down Expand Up @@ -968,6 +978,7 @@ end subroutine comp_run
logical :: seq_multi_inst ! a special case of running multiinstances on the same pes.
integer :: phase, phasemin, phasemax ! phase support
logical :: firstloop ! first time around phase loop
character(*), parameter :: subname = '(component_run:mct)'
!---------------------------------------------------------------

num_inst = size(comp)
Expand Down Expand Up @@ -1012,7 +1023,6 @@ end subroutine comp_run

if (present(timer_comp_run)) then
call t_drvstartf (trim(timer_comp_run), barrier=comp(eci)%mpicom_compid)
call t_adj_detailf(+1)
end if
if (drv_threading) call seq_comm_setnthreads(comp(1)%nthreads_compid)

Expand All @@ -1029,7 +1039,6 @@ end subroutine comp_run
if (drv_threading) call seq_comm_setnthreads(nthreads_GLOID)

if (present(timer_comp_run)) then
call t_adj_detailf(-1)
call t_drvstopf (trim(timer_comp_run))
end if

Expand Down Expand Up @@ -1097,6 +1106,7 @@ subroutine component_run(Eclock, comp, infodata, &
real(r8) :: cktime ! delta time
real(r8) :: cktime_acc(10) ! cktime accumulator array 1 = all, 2 = atm, etc
integer :: cktime_cnt(10) ! cktime counter array
character(*), parameter :: subname = '(component_run:esmf)'
!---------------------------------------------------------------

num_inst = size(comp)
Expand Down Expand Up @@ -1202,6 +1212,7 @@ end subroutine comp_final
! Local Variables
integer :: eci
integer :: num_inst
character(*), parameter :: subname = '(component_final:mct)'
!---------------------------------------------------------------

num_inst = size(comp)
Expand Down Expand Up @@ -1231,6 +1242,7 @@ subroutine component_final(Eclock, comp)
integer :: eci
integer :: rc, urc
integer :: num_inst
character(*), parameter :: subname = '(component_final:esmf)'
!---------------------------------------------------------------

num_inst = size(comp)
Expand Down Expand Up @@ -1275,6 +1287,7 @@ subroutine component_exch(comp, flow, infodata, infodata_string, &
! Local Variables
integer :: eci
integer :: ierr
character(*), parameter :: subname = '(component_exch)'
!---------------------------------------------------------------

if (present(timer_barrier)) then
Expand Down Expand Up @@ -1353,6 +1366,7 @@ subroutine component_diag(infodata, comp, flow, comment, info_debug, timer_diag
!
! Local Variables
integer :: eci
character(*), parameter :: subname = '(component_diag)'
!---------------------------------------------------------------

if (info_debug > 1) then
Expand Down
32 changes: 23 additions & 9 deletions models/drv/driver/prep_rof_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,13 @@ subroutine prep_rof_merge(l2x_r, fractions_r, x2r_r)
!
! Local variables
integer :: i
integer, save :: index_l2x_Flrl_rofl
integer, save :: index_l2x_Flrl_rofsur
integer, save :: index_l2x_Flrl_rofgwl
integer, save :: index_l2x_Flrl_rofsub
integer, save :: index_l2x_Flrl_rofi
integer, save :: index_x2r_Flrl_rofl
integer, save :: index_x2r_Flrl_rofsur
integer, save :: index_x2r_Flrl_rofgwl
integer, save :: index_x2r_Flrl_rofsub
integer, save :: index_x2r_Flrl_rofi
integer, save :: index_lfrac
logical, save :: first_time = .true.
Expand All @@ -273,21 +277,31 @@ subroutine prep_rof_merge(l2x_r, fractions_r, x2r_r)
mrgstr(i) = subname//'x2r%'//trim(field)//' ='
enddo

index_l2x_Flrl_rofl = mct_aVect_indexRA(l2x_r,'Flrl_rofl' )
index_l2x_Flrl_rofi = mct_aVect_indexRA(l2x_r,'Flrl_rofi' )
index_x2r_Flrl_rofl = mct_aVect_indexRA(x2r_r,'Flrl_rofl' )
index_x2r_Flrl_rofi = mct_aVect_indexRA(x2r_r,'Flrl_rofi' )
index_l2x_Flrl_rofsur = mct_aVect_indexRA(l2x_r,'Flrl_rofsur' )
index_l2x_Flrl_rofgwl = mct_aVect_indexRA(l2x_r,'Flrl_rofgwl' )
index_l2x_Flrl_rofsub = mct_aVect_indexRA(l2x_r,'Flrl_rofsub' )
index_l2x_Flrl_rofi = mct_aVect_indexRA(l2x_r,'Flrl_rofi' )
index_x2r_Flrl_rofsur = mct_aVect_indexRA(x2r_r,'Flrl_rofsur' )
index_x2r_Flrl_rofgwl = mct_aVect_indexRA(x2r_r,'Flrl_rofgwl' )
index_x2r_Flrl_rofsub = mct_aVect_indexRA(x2r_r,'Flrl_rofsub' )
index_x2r_Flrl_rofi = mct_aVect_indexRA(x2r_r,'Flrl_rofi' )
index_lfrac = mct_aVect_indexRA(fractions_r,"lfrac")

mrgstr(index_x2r_Flrl_rofl) = trim(mrgstr(index_x2r_Flrl_rofl))//' = '// &
'lfrac*l2x%Flrl_rofl'
mrgstr(index_x2r_Flrl_rofsur) = trim(mrgstr(index_x2r_Flrl_rofsur))//' = '// &
'lfrac*l2x%Flrl_rofsur'
mrgstr(index_x2r_Flrl_rofgwl) = trim(mrgstr(index_x2r_Flrl_rofgwl))//' = '// &
'lfrac*l2x%Flrl_rofgwl'
mrgstr(index_x2r_Flrl_rofsub) = trim(mrgstr(index_x2r_Flrl_rofsub))//' = '// &
'lfrac*l2x%Flrl_rofsub'
mrgstr(index_x2r_Flrl_rofi) = trim(mrgstr(index_x2r_Flrl_rofi))//' = '// &
'lfrac*l2x%Flrl_rofi'
end if

do i = 1,lsize
lfrac = fractions_r%rAttr(index_lfrac,i)
x2r_r%rAttr(index_x2r_Flrl_rofl,i) = l2x_r%rAttr(index_l2x_Flrl_rofl,i) * lfrac
x2r_r%rAttr(index_x2r_Flrl_rofsur,i) = l2x_r%rAttr(index_l2x_Flrl_rofsur,i) * lfrac
x2r_r%rAttr(index_x2r_Flrl_rofgwl,i) = l2x_r%rAttr(index_l2x_Flrl_rofgwl,i) * lfrac
x2r_r%rAttr(index_x2r_Flrl_rofsub,i) = l2x_r%rAttr(index_l2x_Flrl_rofsub,i) * lfrac
x2r_r%rAttr(index_x2r_Flrl_rofi,i) = l2x_r%rAttr(index_l2x_Flrl_rofi,i) * lfrac
end do

Expand Down
28 changes: 20 additions & 8 deletions models/drv/driver/seq_diag_mct.F90
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
!===============================================================================
! SVN $Id: seq_diag_mct.F90 61512 2014-06-26 21:59:35Z tcraig $
! SVN $URL: https://svn-ccsm-models.cgd.ucar.edu/drv/seq_mct/trunk_tags/drvseq5_0_17/driver/seq_diag_mct.F90 $
! SVN $URL: https://svn-ccsm-models.cgd.ucar.edu/drv/seq_mct/trunk_tags/drvseq5_1_15/driver/seq_diag_mct.F90 $
!===============================================================================
!BOP ===========================================================================
!
Expand Down Expand Up @@ -198,7 +198,9 @@ module seq_diag_mct
integer :: index_l2x_Fall_lat
integer :: index_l2x_Fall_sen
integer :: index_l2x_Fall_evap
integer :: index_l2x_Flrl_rofl
integer :: index_l2x_Flrl_rofsur
integer :: index_l2x_Flrl_rofgwl
integer :: index_l2x_Flrl_rofsub
integer :: index_l2x_Flrl_rofi

integer :: index_x2l_Faxa_lwdn
Expand All @@ -213,7 +215,9 @@ module seq_diag_mct
integer :: index_r2x_Firr_rofi
integer :: index_r2x_Flrr_flood

integer :: index_x2r_Flrl_rofl
integer :: index_x2r_Flrl_rofsur
integer :: index_x2r_Flrl_rofgwl
integer :: index_x2r_Flrl_rofsub
integer :: index_x2r_Flrl_rofi

integer :: index_o2x_Fioo_q
Expand Down Expand Up @@ -638,7 +642,9 @@ subroutine seq_diag_lnd_mct( lnd, frac_l, do_l2x, do_x2l)
index_l2x_Fall_lat = mct_aVect_indexRA(l2x_l,'Fall_lat')
index_l2x_Fall_sen = mct_aVect_indexRA(l2x_l,'Fall_sen')
index_l2x_Fall_evap = mct_aVect_indexRA(l2x_l,'Fall_evap')
index_l2x_Flrl_rofl = mct_aVect_indexRA(l2x_l,'Flrl_rofl')
index_l2x_Flrl_rofsur = mct_aVect_indexRA(l2x_l,'Flrl_rofsur')
index_l2x_Flrl_rofgwl = mct_aVect_indexRA(l2x_l,'Flrl_rofgwl')
index_l2x_Flrl_rofsub = mct_aVect_indexRA(l2x_l,'Flrl_rofsub')
index_l2x_Flrl_rofi = mct_aVect_indexRA(l2x_l,'Flrl_rofi')
end if

Expand All @@ -652,7 +658,9 @@ subroutine seq_diag_lnd_mct( lnd, frac_l, do_l2x, do_x2l)
if = f_hlatv ; budg_dataL(if,ic,ip) = budg_dataL(if,ic,ip) + dl*l2x_l%rAttr(index_l2x_Fall_lat,n)
if = f_hsen ; budg_dataL(if,ic,ip) = budg_dataL(if,ic,ip) + dl*l2x_l%rAttr(index_l2x_Fall_sen,n)
if = f_wevap ; budg_dataL(if,ic,ip) = budg_dataL(if,ic,ip) + dl*l2x_l%rAttr(index_l2x_Fall_evap,n)
if = f_wroff ; budg_dataL(if,ic,ip) = budg_dataL(if,ic,ip) - dl*l2x_l%rAttr(index_l2x_Flrl_rofl,n)
if = f_wroff ; budg_dataL(if,ic,ip) = budg_dataL(if,ic,ip) - dl*l2x_l%rAttr(index_l2x_Flrl_rofsur,n) &
- dl*l2x_l%rAttr(index_l2x_Flrl_rofgwl,n) &
- dl*l2x_l%rAttr(index_l2x_Flrl_rofsub,n)
if = f_wioff ; budg_dataL(if,ic,ip) = budg_dataL(if,ic,ip) - dl*l2x_l%rAttr(index_l2x_Flrl_rofi,n)
end do
budg_dataL(f_hioff,ic,ip) = -budg_dataL(f_wioff,ic,ip)*shr_const_latice
Expand Down Expand Up @@ -735,8 +743,10 @@ subroutine seq_diag_rof_mct( rof, frac_r)
x2r_r => component_get_x2c_cx(rof)

if (first_time) then
index_x2r_Flrl_rofl = mct_aVect_indexRA(x2r_r,'Flrl_rofl')
index_x2r_Flrl_rofi = mct_aVect_indexRA(x2r_r,'Flrl_rofi')
index_x2r_Flrl_rofsur = mct_aVect_indexRA(x2r_r,'Flrl_rofsur')
index_x2r_Flrl_rofgwl = mct_aVect_indexRA(x2r_r,'Flrl_rofgwl')
index_x2r_Flrl_rofsub = mct_aVect_indexRA(x2r_r,'Flrl_rofsub')
index_x2r_Flrl_rofi = mct_aVect_indexRA(x2r_r,'Flrl_rofi')
end if

ip = p_inst
Expand All @@ -745,7 +755,9 @@ subroutine seq_diag_rof_mct( rof, frac_r)
lSize = mct_avect_lSize(x2r_r)
do n=1,lSize
dr = dom_r%data%rAttr(kArea,n)
if = f_wroff; budg_dataL(if,ic,ip) = budg_dataL(if,ic,ip) + dr*x2r_r%rAttr(index_x2r_Flrl_rofl,n)
if = f_wroff; budg_dataL(if,ic,ip) = budg_dataL(if,ic,ip) + dr*x2r_r%rAttr(index_x2r_Flrl_rofsur,n) &
+ dr*x2r_r%rAttr(index_x2r_Flrl_rofgwl,n) &
+ dr*x2r_r%rAttr(index_x2r_Flrl_rofsub,n)
if = f_wioff; budg_dataL(if,ic,ip) = budg_dataL(if,ic,ip) + dr*x2r_r%rAttr(index_x2r_Flrl_rofi,n)
end do
budg_dataL(f_hioff,ic,ip) = -budg_dataL(f_wioff,ic,ip)*shr_const_latice
Expand Down
Loading