Skip to content

Commit

Permalink
Implement string options for dust emission schemes
Browse files Browse the repository at this point in the history
and define import fields conditionally in the dust
component's spec resource file.
  • Loading branch information
rmontuoro committed Apr 8, 2021
1 parent ce3a179 commit 261a4ac
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 28 deletions.
41 changes: 24 additions & 17 deletions ESMF/GOCART2G_GridComp/DU2G_GridComp/DU2G_GridCompMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ module DU2G_GridCompMod
real :: Ch_DU ! dust emission tuning coefficient [kg s2 m-5].
logical :: maringFlag=.false. ! maring settling velocity correction
integer :: day_save = -1
integer :: emission_scheme ! emission scheme selector
character(len=8) :: emission_scheme ! emission scheme selector
! !Workspae for point emissions
logical :: doing_point_emissions = .false.
character(len=255) :: point_emissions_srcfilen ! filename for pointwise emissions
Expand Down Expand Up @@ -110,6 +110,7 @@ subroutine SetServices (GC, RC)
type (DU2G_GridComp), pointer :: self

character (len=ESMF_MAXSTR) :: field_name
character (len=8) :: emission_scheme
integer :: i
real :: DEFVAL
logical :: data_driven = .true.
Expand Down Expand Up @@ -149,8 +150,8 @@ subroutine SetServices (GC, RC)
call ESMF_ConfigGetAttribute (cfg, self%Ch_DU_res, label='Ch_DU:', __RC__)
call ESMF_ConfigGetAttribute (cfg, self%rlow, label='radius_lower:', __RC__)
call ESMF_ConfigGetAttribute (cfg, self%rup, label='radius_upper:', __RC__)
call ESMF_ConfigGetAttribute (cfg, self%emission_scheme, &
label='emission_scheme:', default=DUST_SCHEME_GOCART, __RC__)
call ESMF_ConfigGetAttribute (cfg, emission_scheme, label='emission_scheme:', default='ginoux', __RC__)
self%emission_scheme = ESMF_UtilStringLowerCase(emission_scheme, __RC__)
call ESMF_ConfigGetAttribute (cfg, self%point_emissions_srcfilen, &
label='point_emissions_srcfilen:', default='/dev/null', __RC__)
if ( (index(self%point_emissions_srcfilen,'/dev/null')>0) ) then
Expand All @@ -161,7 +162,7 @@ subroutine SetServices (GC, RC)

! read FENGSHA-specific parameters
! --------------------------------
if (self%emission_scheme == DUST_SCHEME_FENGSHA) then
if (self%emission_scheme == 'fengsha') then
call ESMF_ConfigGetAttribute (cfg, self%alpha, label='alpha:', __RC__)
call ESMF_ConfigGetAttribute (cfg, self%gamma, label='gamma:', __RC__)
call ESMF_ConfigGetAttribute (cfg, self%kvhmax, label='vertical_to_horizontal_flux_ratio_limit:', __RC__)
Expand Down Expand Up @@ -269,8 +270,10 @@ subroutine SetServices (GC, RC)
! ----------------------
if (.not. data_driven) then
#include "DU2G_Export___.h"
#include "DU2G_Import___.h"
#include "DU2G_Internal___.h"
associate (scheme => self%emission_scheme)
#include "DU2G_Import___.h"
end associate
end if

! This state holds fields needed by radiation
Expand Down Expand Up @@ -395,7 +398,7 @@ subroutine Initialize (GC, import, export, clock, RC)

! Dust emission size distribution for FENGSHA
! ---------------------------------------------------------------
if (self%emission_scheme == DUST_SCHEME_FENGSHA) then
if (self%emission_scheme == 'fengsha') then
allocate(self%sdist(self%nbins), __STAT__)
call DustAerosolDistributionKok(self%radius, self%rup, self%rlow, self%sdist)
end if
Expand Down Expand Up @@ -705,16 +708,10 @@ subroutine Run1 (GC, import, export, clock, RC)
! -----------------------------------
call MAPL_Get (mapl, INTERNAL_ESMF_STATE=internal, __RC__)

#include "DU2G_GetPointer___.h"

do n=1,5
if(mapl_am_i_root()) print*,'n = ', n,' : Run1 B DU2G sum(du00n) = ',sum(DU(:,:,:,n))
end do

! Set du_src to 0 where undefined
! --------------------------------
where (1.01*du_src > MAPL_UNDEF) du_src = 0.

! Get my private internal state
! ------------------------------
call ESMF_UserCompGetInternalState(GC, 'DU2G_GridComp', wrap, STATUS)
Expand All @@ -728,6 +725,10 @@ subroutine Run1 (GC, import, export, clock, RC)
call MAPL_PackTime (nymd, iyr, imm , idd)
call MAPL_PackTime (nhms, ihr, imn, isc)

associate (scheme => self%emission_scheme)
#include "DU2G_GetPointer___.h"
end associate

! Get dimensions
! ---------------
import_shape = shape(wet1)
Expand All @@ -743,13 +744,17 @@ subroutine Run1 (GC, import, export, clock, RC)

! Get surface gridded emissions
! -----------------------------
select case (self%emission_scheme)
case (DUST_SCHEME_FENGSHA)
select case (trim(self%emission_scheme))
case ('fengsha')
call DustEmissionFENGSHA (frlake, frsnow, lwi, slc, frclay, frsand, frsilt, &
ssm, rdrag, airdens(:,:,self%km), ustar, uthres, &
self%alpha, self%gamma, self%kvhmax, MAPL_GRAV, &
self%rhop, self%sdist, emissions_surface, __RC__)
case (DUST_SCHEME_GOCART)
case ('ginoux')
! Set du_src to 0 where undefined
! --------------------------------
where (1.01*du_src > MAPL_UNDEF) du_src = 0.

call DustEmissionGOCART2G(self%radius*1.e-6, frlake, wet1, lwi, u10m, v10m, &
self%Ch_DU, du_src, MAPL_GRAV, &
emissions_surface, __RC__)
Expand Down Expand Up @@ -867,8 +872,6 @@ subroutine Run2 (GC, import, export, clock, RC)
! -----------------------------------
call MAPL_Get (MAPL, INTERNAL_ESMF_STATE=internal, __RC__)

#include "DU2G_GetPointer___.h"

do n=1,5
if(mapl_am_i_root()) print*,'n = ', n,' : Run2 B DU2G sum(du00n) = ',sum(DU(:,:,:,n))
end do
Expand All @@ -879,6 +882,10 @@ subroutine Run2 (GC, import, export, clock, RC)
VERIFY_(STATUS)
self => wrap%ptr

associate (scheme => self%emission_scheme)
#include "DU2G_GetPointer___.h"
end associate

allocate(dqa, mold=wet1, __STAT__)
allocate(drydepositionfrequency, mold=wet1, __STAT__)

Expand Down
2 changes: 1 addition & 1 deletion ESMF/GOCART2G_GridComp/DU2G_GridComp/DU2G_GridComp_DU.rc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ nbins: 5
pressure_lid_in_hPa: 0.01

# Emissions methods
emission_scheme: 1 # 1 for GOCART, 2 for FENGSHA
emission_scheme: Ginoux # available schemes: Ginoux, FENGSHA

# FENGSHA settings
alpha: 0.3
Expand Down
20 changes: 10 additions & 10 deletions ESMF/GOCART2G_GridComp/DU2G_GridComp/DU2G_StateSpecs.rc
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ category: IMPORT
#----------------------------------------------------------------------------------------
NAME | UNITS | DIMS | VLOC| COND | LONG NAME
#----------------------------------------------------------------------------------------
DU_SRC | 1 | xy | N | | erod - dust emissions
FRLAKE | 1 | xy | N | | fraction_of_lake
FRSNOW | 1 | xy | N | | surface_snow_area_fraction
DU_SRC | 1 | xy | N | scheme == 'ginoux' | erod - dust emissions
FRSNOW | 1 | xy | N | scheme == 'fengsha' | surface_snow_area_fraction
SLC | 1 | xy | N | scheme == 'fengsha' | liquid_water_content_of_soil_layer
FRCLAY | 1 | xy | N | scheme == 'fengsha' | volume_fraction_of_clay_in_soil
FRSAND | 1 | xy | N | scheme == 'fengsha' | volume_fraction_of_sand_in_soil
FRSILT | 1 | xy | N | scheme == 'fengsha' | volume_fraction_of_silt_in_soil
RDRAG | m-1 | xy | N | scheme == 'fengsha' | drag_partition
SSM | 1 | xy | N | scheme == 'fengsha' | sediment_supply_map
UTHRES | m s-1 | xy | N | scheme == 'fengsha' | surface_dry_threshold_velocity
WET1 | 1 | xy | N | | surface_soil_wetness
SLC | 1 | xy | N | | liquid_water_content_of_soil_layer
LWI | 1 | xy | N | | land-ocean-ice_mask
FRCLAY | 1 | xy | N | | volume_fraction_of_clay_in_soil
FRSAND | 1 | xy | N | | volume_fraction_of_sand_in_soil
FRSILT | 1 | xy | N | | volume_fraction_of_silt_in_soil
RDRAG | m-1 | xy | N | | drag_partition
SSM | 1 | xy | N | | sediment_supply_map
UTHRES | m s-1 | xy | N | | surface_dry_threshold_velocity
FRLAKE | 1 | xy | N | | fraction_of_lake
U10M | m s-1 | xy | N | | 10-meter_eastward_wind
V10M | m s-1 | xy | N | | 10-meter_northward_wind
AREA | m^2 | xy | N | | agrid_cell_area
Expand Down

0 comments on commit 261a4ac

Please sign in to comment.