Skip to content
Closed
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
33 changes: 17 additions & 16 deletions src/aqm_cap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ module AQM

use aqm_comp_mod
use aqm_const_mod, only: rad_to_deg

implicit none

! -- import fields
integer, parameter :: importFieldCount = 36
integer, parameter :: importFieldCount = 37
character(len=*), dimension(importFieldCount), parameter :: &
importFieldNames = (/ &
"canopy_moisture_storage ", &
Expand Down Expand Up @@ -51,7 +51,8 @@ module AQM
"soil_type ", &
"surface_cell_area ", &
"surface_snow_area_fraction ", &
"temperature_of_soil_layer " &
"temperature_of_soil_layer ", &
"vegetation_type " &
/)
! -- export fields
integer, parameter :: exportFieldCount = 2
Expand All @@ -64,18 +65,18 @@ module AQM
private

public SetServices

!-----------------------------------------------------------------------------
contains
!-----------------------------------------------------------------------------

subroutine SetServices(model, rc)
type(ESMF_GridComp) :: model
integer, intent(out) :: rc

! begin
rc = ESMF_SUCCESS

! the NUOPC model component will register the generic methods
call NUOPC_CompDerive(model, inheritModel, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
Expand Down Expand Up @@ -120,15 +121,15 @@ subroutine SetServices(model, rc)
return ! bail out

end subroutine

!-----------------------------------------------------------------------------

subroutine InitializeP0(model, importState, exportState, clock, rc)
type(ESMF_GridComp) :: model
type(ESMF_State) :: importState, exportState
type(ESMF_Clock) :: clock
integer, intent(out) :: rc

! local variables
integer :: verbosity
character(len=ESMF_MAXSTR) :: msgString, name, rcFile
Expand Down Expand Up @@ -195,16 +196,16 @@ subroutine InitializeP0(model, importState, exportState, clock, rc)
line=__LINE__, &
file=__FILE__)) &
return ! bail out

end subroutine

!-----------------------------------------------------------------------------
subroutine InitializeP1(model, importState, exportState, clock, rc)
type(ESMF_GridComp) :: model
type(ESMF_State) :: importState, exportState
type(ESMF_Clock) :: clock
integer, intent(out) :: rc

! begin
rc = ESMF_SUCCESS

Expand Down Expand Up @@ -285,7 +286,7 @@ subroutine DataInitialize(model, rc)
return ! bail out

! -- check if import fields are defined
if (importFieldCount < 1) then
if (importFieldCount < 1) then
call ESMF_LogSetError(ESMF_RC_NOT_IMPL, &
msg="This component requires import fields to be defined.", &
line=__LINE__, file=__FILE__, &
Expand All @@ -294,7 +295,7 @@ subroutine DataInitialize(model, rc)
end if

! -- check if export fields are defined
if (exportFieldCount < 1) then
if (exportFieldCount < 1) then
call ESMF_LogSetError(ESMF_RC_NOT_IMPL, &
msg="This component requires export fields to be defined.", &
line=__LINE__, file=__FILE__, &
Expand Down Expand Up @@ -417,7 +418,7 @@ subroutine DataInitialize(model, rc)
line=__LINE__, &
file=__FILE__)) &
return ! bail out

do item = 1, 2
call ESMF_GridGetCoord(grid, coordDim=item, staggerloc=ESMF_STAGGERLOC_CENTER, &
localDE=localDe, farrayPtr=coord, rc=rc)
Expand Down Expand Up @@ -534,7 +535,7 @@ end subroutine DataInitialize
subroutine ModelAdvance(model, rc)
type(ESMF_GridComp) :: model
integer, intent(out) :: rc

! local variables
type(ESMF_Clock) :: clock
type(ESMF_State) :: importState, exportState
Expand All @@ -548,7 +549,7 @@ subroutine ModelAdvance(model, rc)

! begin
rc = ESMF_SUCCESS

! get component's information
call NUOPC_CompGet(model, name=name, diagnostic=diagnostic, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
Expand Down
6 changes: 6 additions & 0 deletions src/aqm_comp_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,12 @@ subroutine aqm_comp_import(state, fieldNames, rc)
line=__LINE__, &
file=__FILE__)) &
return ! bail
case ("vegetation_type")
call ESMF_FieldGet(field, localDe=localDe, farrayPtr=stateIn % vtype, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
return ! bail
case default
! -- unused field
end select
Expand Down
16 changes: 12 additions & 4 deletions src/shr/aqm_methods.F90
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ LOGICAL FUNCTION DESC3( FNAME )
CHARACTER(LEN=*), INTENT(IN) :: FNAME

INCLUDE SUBST_FILES_ID

integer :: localrc
integer :: is, ie, js, je
integer :: EMLAYS
Expand Down Expand Up @@ -588,7 +588,7 @@ subroutine nameval(name, eqname)
case default
! -- nothing to do
end select

end subroutine nameval


Expand Down Expand Up @@ -660,7 +660,7 @@ logical function interpx( fname, vname, pname, &
do r = row0, row1
do c = col0, col1
k = k + 1
if (int(stateIn % stype(c,r)) == lu_index) buffer(k) = 1.0
if (int(stateIn % vtype(c,r)) == lu_index) buffer(k) = 1.0 ! Assign vtype to LUFRAC_
end do
end do
else
Expand Down Expand Up @@ -692,6 +692,14 @@ logical function interpx( fname, vname, pname, &
end do
case ('MSFX2')
buffer(1:lbuf) = 1.
case ('DLUSE')
k = 0
do r = row0, row1
do c = col0, col1
k = k + 1
buffer(k) = stateIn % vtype(c,r) ! Assign vtype to DLUSE
end do
end do
case ('PURB')
case default
return
Expand All @@ -703,7 +711,7 @@ logical function interpx( fname, vname, pname, &
call aqm_model_get(stateIn=stateIn, rc=localrc)
if (aqm_rc_check(localrc, msg="Failure to retrieve model input state", &
file=__FILE__, line=__LINE__)) return

call aqm_model_get(config=config, stateIn=stateIn, rc=localrc)
if (aqm_rc_check(localrc, msg="Failure to retrieve model input state", &
file=__FILE__, line=__LINE__)) return
Expand Down
84 changes: 44 additions & 40 deletions src/shr/aqm_state_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,52 @@ module aqm_state_mod

type aqm_state_type

real(AQM_KIND_R8), dimension(:,:), pointer :: area => null()
real(AQM_KIND_R8), dimension(:,:), pointer :: cmm => null()
real(AQM_KIND_R8), dimension(:,:), pointer :: fice => null()
real(AQM_KIND_R8), dimension(:,:), pointer :: hfx => null()
real(AQM_KIND_R8), dimension(:,:), pointer :: hpbl => null()
real(AQM_KIND_R8), dimension(:,:), pointer :: ht => null()
real(AQM_KIND_R8), dimension(:,:), pointer :: lh => null()
real(AQM_KIND_R8), dimension(:,:), pointer :: psfc => null()
real(AQM_KIND_R8), dimension(:,:), pointer :: q2m => null()
real(AQM_KIND_R8), dimension(:,:), pointer :: rain => null()
real(AQM_KIND_R8), dimension(:,:), pointer :: rainc => null()
real(AQM_KIND_R8), dimension(:,:), pointer :: rgrnd => null()
real(AQM_KIND_R8), dimension(:,:), pointer :: rc => null()
real(AQM_KIND_R8), dimension(:,:), pointer :: slmsk => null()
real(AQM_KIND_R8), dimension(:,:), pointer :: sncov => null()
real(AQM_KIND_R8), dimension(:,:), pointer :: stype => null()
real(AQM_KIND_R8), dimension(:,:), pointer :: t2m => null()
real(AQM_KIND_R8), dimension(:,:), pointer :: tsfc => null()
real(AQM_KIND_R8), dimension(:,:), pointer :: ustar => null()
real(AQM_KIND_R8), dimension(:,:), pointer :: u10m => null()
real(AQM_KIND_R8), dimension(:,:), pointer :: v10m => null()
real(AQM_KIND_R8), dimension(:,:), pointer :: vfrac => null()
real(AQM_KIND_R8), dimension(:,:), pointer :: wr => null()
real(AQM_KIND_R8), dimension(:,:), pointer :: xlai => null()
real(AQM_KIND_R8), dimension(:,:), pointer :: zorl => null()

real(AQM_KIND_R8), dimension(:,:,:), pointer :: cldfl => null()
real(AQM_KIND_R8), dimension(:,:,:), pointer :: dkt => null()
real(AQM_KIND_R8), dimension(:,:,:), pointer :: phii => null()
real(AQM_KIND_R8), dimension(:,:,:), pointer :: phil => null()
real(AQM_KIND_R8), dimension(:,:,:), pointer :: pri => null()
real(AQM_KIND_R8), dimension(:,:,:), pointer :: prl => null()
real(AQM_KIND_R8), dimension(:,:,:), pointer :: smois => null()
real(AQM_KIND_R8), dimension(:,:,:), pointer :: stemp => null()
real(AQM_KIND_R8), dimension(:,:,:), pointer :: temp => null()
real(AQM_KIND_R8), dimension(:,:,:), pointer :: uwind => null()
real(AQM_KIND_R8), dimension(:,:,:), pointer :: vwind => null()

real(AQM_KIND_R8), dimension(:,:,:,:), pointer :: tr => null()
! 2D Variables
real(AQM_KIND_R8), dimension(:,:), pointer :: area => null() ! Surface area
real(AQM_KIND_R8), dimension(:,:), pointer :: vtype => null() ! Vegetation type
real(AQM_KIND_R8), dimension(:,:), pointer :: cmm => null() ! Cloud mixing ratio
real(AQM_KIND_R8), dimension(:,:), pointer :: fice => null() ! Fraction of ice
real(AQM_KIND_R8), dimension(:,:), pointer :: hfx => null() ! Heat flux
real(AQM_KIND_R8), dimension(:,:), pointer :: hpbl => null() ! Planetary boundary layer height
real(AQM_KIND_R8), dimension(:,:), pointer :: ht => null() ! Height
real(AQM_KIND_R8), dimension(:,:), pointer :: lh => null() ! Latent heat
real(AQM_KIND_R8), dimension(:,:), pointer :: psfc => null() ! Surface pressure
real(AQM_KIND_R8), dimension(:,:), pointer :: q2m => null() ! Specific humidity at 2 meters
real(AQM_KIND_R8), dimension(:,:), pointer :: rain => null() ! Rainfall
real(AQM_KIND_R8), dimension(:,:), pointer :: rainc => null() ! Convective rainfall
real(AQM_KIND_R8), dimension(:,:), pointer :: rgrnd => null() ! Ground reflectance
real(AQM_KIND_R8), dimension(:,:), pointer :: rc => null() ! Cloud fraction
real(AQM_KIND_R8), dimension(:,:), pointer :: slmsk => null() ! Land-sea mask
real(AQM_KIND_R8), dimension(:,:), pointer :: sncov => null() ! Snow cover
real(AQM_KIND_R8), dimension(:,:), pointer :: stype => null() ! Soil type
real(AQM_KIND_R8), dimension(:,:), pointer :: t2m => null() ! Temperature at 2 meters
real(AQM_KIND_R8), dimension(:,:), pointer :: tsfc => null() ! Surface temperature
real(AQM_KIND_R8), dimension(:,:), pointer :: ustar => null() ! Friction velocity
real(AQM_KIND_R8), dimension(:,:), pointer :: u10m => null() ! U-component of wind at 10 meters
real(AQM_KIND_R8), dimension(:,:), pointer :: v10m => null() ! V-component of wind at 10 meters
real(AQM_KIND_R8), dimension(:,:), pointer :: vfrac => null() ! Vegetation fraction
real(AQM_KIND_R8), dimension(:,:), pointer :: wr => null() ! Water runoff
real(AQM_KIND_R8), dimension(:,:), pointer :: xlai => null() ! Leaf area index
real(AQM_KIND_R8), dimension(:,:), pointer :: zorl => null() ! Roughness length

! 3D Variables
real(AQM_KIND_R8), dimension(:,:,:), pointer :: cldfl => null() ! Cloud fraction
real(AQM_KIND_R8), dimension(:,:,:), pointer :: dkt => null() ! Diffusivity
real(AQM_KIND_R8), dimension(:,:,:), pointer :: phii => null() ! Geopotential height at interface
real(AQM_KIND_R8), dimension(:,:,:), pointer :: phil => null() ! Geopotential height at layer
real(AQM_KIND_R8), dimension(:,:,:), pointer :: pri => null() ! Precipitation rate at interface
real(AQM_KIND_R8), dimension(:,:,:), pointer :: prl => null() ! Precipitation rate at layer
real(AQM_KIND_R8), dimension(:,:,:), pointer :: smois => null() ! Soil moisture
real(AQM_KIND_R8), dimension(:,:,:), pointer :: stemp => null() ! Soil temperature
real(AQM_KIND_R8), dimension(:,:,:), pointer :: temp => null() ! Temperature
real(AQM_KIND_R8), dimension(:,:,:), pointer :: uwind => null() ! U-component of wind
real(AQM_KIND_R8), dimension(:,:,:), pointer :: vwind => null() ! V-component of wind

! 4D Variables
real(AQM_KIND_R8), dimension(:,:,:,:), pointer :: tr => null() ! Tracer concentration

! -- diagnostics
real(AQM_KIND_R8), dimension(:,:), pointer :: aod => null()
real(AQM_KIND_R8), dimension(:,:), pointer :: aod => null() ! Aerosol optical depth

end type aqm_state_type

Expand Down