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

Feature/cmaq54 fengsha #25

Draft
wants to merge 5 commits into
base: feature/cmaq54
Choose a base branch
from
Draft
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
36 changes: 19 additions & 17 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
! integer, parameter :: importFieldCount = 45 !with canopy
character(len=*), dimension(importFieldCount), parameter :: &
importFieldNames = (/ &
Expand Down Expand Up @@ -52,10 +52,12 @@ module AQM
"soil_type ", &
"surface_cell_area ", &
"surface_snow_area_fraction ", &
"temperature_of_soil_layer " &
"temperature_of_soil_layer ", &
"vtype " &
! "vegetation_type_frac " &
! "forest_canopy_height ", &
! "forest_fraction ", &
! "clumping_index ", &
! "clumping_index ", &
! "population_density ", &
! "leaf_area_index_eccc ", &
! "cum_lai_frac1_eccc ", &
Expand All @@ -74,18 +76,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 @@ -130,15 +132,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 @@ -205,16 +207,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 @@ -295,7 +297,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 @@ -304,7 +306,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 @@ -427,7 +429,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 @@ -544,7 +546,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 @@ -558,7 +560,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
124 changes: 68 additions & 56 deletions src/aqm_comp_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ subroutine aqm_comp_advance(model, rc)
!tstep( 1 ) = config % ctm_tstep ! TSTEP(1) = local output step
!tstep( 2 ) = tstep( 1 ) ! TSTEP(2) = sciproc sync. step (chem)
!test different tstep(1) and tstep(2)
tstep( 1 ) = 1 * 10000 ! TSTEP(1) = local output step
tstep( 1 ) = 1 * 10000 ! TSTEP(1) = local output step
tstep( 2 ) = config % ctm_tstep ! TSTEP(2) = sciproc sync. step (chem)
tstep( 3 ) = tstep( 2 ) ! TSTEP(3) = twoway model time step

Expand Down Expand Up @@ -604,6 +604,18 @@ subroutine aqm_comp_import(state, fieldNames, rc)
line=__LINE__, &
file=__FILE__)) &
return ! bail
case ("vtype")
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 ("vegetation_type_frac")
call ESMF_FieldGet(field, localDe=localDe, farrayPtr=stateIn % fvtype, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
return ! bail
case ("surface_cell_area")
call ESMF_FieldGet(field, localDe=localDe, farrayPtr=stateIn % area, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
Expand All @@ -622,61 +634,61 @@ subroutine aqm_comp_import(state, fieldNames, rc)
line=__LINE__, &
file=__FILE__)) &
return ! bail
!canopy variables
! case ("forest_canopy_height")
! call ESMF_FieldGet(field, localDe=localDe, farrayPtr=stateIn % stemp, rc=rc)
! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
! line=__LINE__, &
! file=__FILE__)) &
! return ! bail
! case ("forest_fraction")
! call ESMF_FieldGet(field, localDe=localDe, farrayPtr=stateIn % stemp, rc=rc)
! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
! line=__LINE__, &
! file=__FILE__)) &
! return ! bail
! case ("clumping_index")
! call ESMF_FieldGet(field, localDe=localDe, farrayPtr=stateIn % stemp, rc=rc)
! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
! line=__LINE__, &
! file=__FILE__)) &
! return ! bail
! case ("population_density")
! call ESMF_FieldGet(field, localDe=localDe, farrayPtr=stateIn % stemp, rc=rc)
! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
! line=__LINE__, &
! file=__FILE__)) &
! return ! bail
! case ("leaf_area_index_eccc")
! call ESMF_FieldGet(field, localDe=localDe, farrayPtr=stateIn % stemp, rc=rc)
! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
! line=__LINE__, &
! file=__FILE__)) &
! return ! bail
! case ("cum_lai_frac1_eccc")
! call ESMF_FieldGet(field, localDe=localDe, farrayPtr=stateIn % stemp, rc=rc)
! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
! line=__LINE__, &
! file=__FILE__)) &
! return ! bail
! case ("cum_lai_frac2_eccc")
! call ESMF_FieldGet(field, localDe=localDe, farrayPtr=stateIn % stemp, rc=rc)
! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
! line=__LINE__, &
! file=__FILE__)) &
! return ! bail
! case ("cum_lai_frac3_eccc")
! call ESMF_FieldGet(field, localDe=localDe, farrayPtr=stateIn % stemp, rc=rc)
! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
! line=__LINE__, &
! file=__FILE__)) &
! return ! bail
! case ("cum_lai_frac4_eccc")
! call ESMF_FieldGet(field, localDe=localDe, farrayPtr=stateIn % stemp, rc=rc)
! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
! line=__LINE__, &
! file=__FILE__)) &
! return ! bail
! canopy variables
case ("forest_canopy_height")
call ESMF_FieldGet(field, localDe=localDe, farrayPtr=stateIn % stemp, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
return ! bail
case ("forest_fraction")
call ESMF_FieldGet(field, localDe=localDe, farrayPtr=stateIn % stemp, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
return ! bail
case ("clumping_index")
call ESMF_FieldGet(field, localDe=localDe, farrayPtr=stateIn % stemp, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
return ! bail
case ("population_density")
call ESMF_FieldGet(field, localDe=localDe, farrayPtr=stateIn % stemp, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
return ! bail
case ("leaf_area_index_eccc")
call ESMF_FieldGet(field, localDe=localDe, farrayPtr=stateIn % stemp, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
return ! bail
case ("cum_lai_frac1_eccc")
call ESMF_FieldGet(field, localDe=localDe, farrayPtr=stateIn % stemp, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
return ! bail
case ("cum_lai_frac2_eccc")
call ESMF_FieldGet(field, localDe=localDe, farrayPtr=stateIn % stemp, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
return ! bail
case ("cum_lai_frac3_eccc")
call ESMF_FieldGet(field, localDe=localDe, farrayPtr=stateIn % stemp, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
return ! bail
case ("cum_lai_frac4_eccc")
call ESMF_FieldGet(field, localDe=localDe, farrayPtr=stateIn % stemp, 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
Loading