Hello,
I have a question on customizing CLM output. I would like to output the vapor pressure and friction velocity for urban and rural land units. I think the way to do this is to modify CLM scripts. First calculate vapor pressure and friction velocity in urban and rural patch, and then add the new variables into master field. I do not know the scripts well enough so I am not sure I did this in the right way. Could anyone with better knowledge on CLM code give me some suggestiona on my modification?
In attached txt files, I commented every modification with "Where Keer Modified" so that you can find them easily. Here are a summary of what I modified:
---------------------------------------calculating vapor pressure and friction velocity in urban and rural patch---------------------------------------------------------
In BareGroundFluxesMod.f90 and CanopyFluxesMod.f90, I added the following line at the (I think) proper location:
vap_ref2m_r => humanindex_inst%vap_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m height vapor pressure (Pa)
ustar_r => frictionvel_inst%fv_r_patch , & ! Output: [real(r8) (:) ] rural friction velocity(m/s)
------------------------------------------------------------------------------
ustar_r(p)=ustar(p)
------------------------------------------------------------------------------
vap_ref2m_r(p) = vap_ref2m(p)
In UrbanFluxesMod.f90, I added the following line at the (I think) proper location:
vap_ref2m_u => humanindex_inst%vap_ref2m_u_patch , & ! Output: [real(r8) (:) ] Urban 2 m height vapor pressure (Pa)
ustar_u => frictionvel_inst%fv_u_patch , & ! Output: [real(r8) (:) ] Urban friction velocity (m/s)
------------------------------------------------------------------------------
ustar_u(p) = ustar(l)
------------------------------------------------------------------------------
vap_ref2m_u(p) = vap_ref2m(p)
----------------------------------------------add the new variables into master field----------------------------------------------------------------
In HumanIndexMod.f90, I added the following line at the (I think) proper location:
type, public :: humanindex_type
real(r8), pointer :: vap_ref2m_r_patch (:) ! Patch Rural 2 m height vapor pressure (Pa)
real(r8), pointer :: vap_ref2m_u_patch (:) ! Patch Urban 2 m height vapor pressure (Pa)
------------------------------------------------------------------------------
begp = bounds%begp; endp= bounds%endp
allocate(this%vap_ref2m_patch (begp:endp)) ; this%vap_ref2m_patch (:) = nan
allocate(this%vap_ref2m_r_patch (begp:endp)) ; this%vap_ref2m_r_patch (:) = nan
allocate(this%vap_ref2m_u_patch (begp:endp)) ; this%vap_ref2m_u_patch (:) = nan
------------------------------------------------------------------------------
this%vap_ref2m_u_patch(begp:endp) = spval
call hist_addfld1d (fname='VAPOR_PRES_U', units='Pa', &
avgflag='A', long_name='Urban 2 m vapor pressure', &
ptr_patch=this%vap_ref2m_u_patch, set_nourb=spval)
this%vap_ref2m_r_patch(begp:endp) = spval
call hist_addfld1d (fname='VAPOR_PRES_R', units='Pa', &
avgflag='A', long_name='Rural 2 m vapor pressure', &
ptr_patch=this%vap_ref2m_r_patch, set_spec=spval)
In FrictionVelocityMod.f90, I added the following line at the (I think) proper location:
type, public :: frictionvel_type
real(r8), pointer, public :: fv_u_patch (:) ! Urban patch friction velocity (m/s) (for dust model)
real(r8), pointer, public :: fv_r_patch (:) ! Rural patch friction velocity (m/s) (for dust model)
------------------------------------------------------------------------------
begp = bounds%begp; endp= bounds%endp
begc = bounds%begc; endc= bounds%endc
allocate(this%fv_u_patch (begp:endp)) ; this%fv_u_patch (:) = nan
allocate(this%fv_r_patch (begp:endp)) ; this%fv_r_patch (:) = nan
------------------------------------------------------------------------------
this%fv_u_patch(begp:endp) = spval
call hist_addfld1d (fname='FV_U', units='m/s', &
avgflag='A', long_name='Urban friction velocity for dust model', &
ptr_patch=this%fv_u_patch, set_nourb=spval,default='inactive')
this%fv_r_patch(begp:endp) = spval
call hist_addfld1d (fname='FV_R', units='m/s', &
avgflag='A', long_name='Rural friction velocity for dust model', &
ptr_patch=this%fv_r_patch, set_spec=spval,default='inactive')
(Note that I move these two hist_addfld1d functions which add FV_U and FV_R into master field out of if(use_cn) block, because I am using I2000Clm50SpGs compsets. Is it alright to just ignore this if-block?)
Any opinion or suggestions are very much appreciated! Thank you!!
I have a question on customizing CLM output. I would like to output the vapor pressure and friction velocity for urban and rural land units. I think the way to do this is to modify CLM scripts. First calculate vapor pressure and friction velocity in urban and rural patch, and then add the new variables into master field. I do not know the scripts well enough so I am not sure I did this in the right way. Could anyone with better knowledge on CLM code give me some suggestiona on my modification?
In attached txt files, I commented every modification with "Where Keer Modified" so that you can find them easily. Here are a summary of what I modified:
---------------------------------------calculating vapor pressure and friction velocity in urban and rural patch---------------------------------------------------------
In BareGroundFluxesMod.f90 and CanopyFluxesMod.f90, I added the following line at the (I think) proper location:
vap_ref2m_r => humanindex_inst%vap_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m height vapor pressure (Pa)
ustar_r => frictionvel_inst%fv_r_patch , & ! Output: [real(r8) (:) ] rural friction velocity(m/s)
------------------------------------------------------------------------------
ustar_r(p)=ustar(p)
------------------------------------------------------------------------------
vap_ref2m_r(p) = vap_ref2m(p)
In UrbanFluxesMod.f90, I added the following line at the (I think) proper location:
vap_ref2m_u => humanindex_inst%vap_ref2m_u_patch , & ! Output: [real(r8) (:) ] Urban 2 m height vapor pressure (Pa)
ustar_u => frictionvel_inst%fv_u_patch , & ! Output: [real(r8) (:) ] Urban friction velocity (m/s)
------------------------------------------------------------------------------
ustar_u(p) = ustar(l)
------------------------------------------------------------------------------
vap_ref2m_u(p) = vap_ref2m(p)
----------------------------------------------add the new variables into master field----------------------------------------------------------------
In HumanIndexMod.f90, I added the following line at the (I think) proper location:
type, public :: humanindex_type
real(r8), pointer :: vap_ref2m_r_patch (:) ! Patch Rural 2 m height vapor pressure (Pa)
real(r8), pointer :: vap_ref2m_u_patch (:) ! Patch Urban 2 m height vapor pressure (Pa)
------------------------------------------------------------------------------
begp = bounds%begp; endp= bounds%endp
allocate(this%vap_ref2m_patch (begp:endp)) ; this%vap_ref2m_patch (:) = nan
allocate(this%vap_ref2m_r_patch (begp:endp)) ; this%vap_ref2m_r_patch (:) = nan
allocate(this%vap_ref2m_u_patch (begp:endp)) ; this%vap_ref2m_u_patch (:) = nan
------------------------------------------------------------------------------
this%vap_ref2m_u_patch(begp:endp) = spval
call hist_addfld1d (fname='VAPOR_PRES_U', units='Pa', &
avgflag='A', long_name='Urban 2 m vapor pressure', &
ptr_patch=this%vap_ref2m_u_patch, set_nourb=spval)
this%vap_ref2m_r_patch(begp:endp) = spval
call hist_addfld1d (fname='VAPOR_PRES_R', units='Pa', &
avgflag='A', long_name='Rural 2 m vapor pressure', &
ptr_patch=this%vap_ref2m_r_patch, set_spec=spval)
In FrictionVelocityMod.f90, I added the following line at the (I think) proper location:
type, public :: frictionvel_type
real(r8), pointer, public :: fv_u_patch (:) ! Urban patch friction velocity (m/s) (for dust model)
real(r8), pointer, public :: fv_r_patch (:) ! Rural patch friction velocity (m/s) (for dust model)
------------------------------------------------------------------------------
begp = bounds%begp; endp= bounds%endp
begc = bounds%begc; endc= bounds%endc
allocate(this%fv_u_patch (begp:endp)) ; this%fv_u_patch (:) = nan
allocate(this%fv_r_patch (begp:endp)) ; this%fv_r_patch (:) = nan
------------------------------------------------------------------------------
this%fv_u_patch(begp:endp) = spval
call hist_addfld1d (fname='FV_U', units='m/s', &
avgflag='A', long_name='Urban friction velocity for dust model', &
ptr_patch=this%fv_u_patch, set_nourb=spval,default='inactive')
this%fv_r_patch(begp:endp) = spval
call hist_addfld1d (fname='FV_R', units='m/s', &
avgflag='A', long_name='Rural friction velocity for dust model', &
ptr_patch=this%fv_r_patch, set_spec=spval,default='inactive')
(Note that I move these two hist_addfld1d functions which add FV_U and FV_R into master field out of if(use_cn) block, because I am using I2000Clm50SpGs compsets. Is it alright to just ignore this if-block?)
Any opinion or suggestions are very much appreciated! Thank you!!