Skip to content

Commit

Permalink
Merge pull request #23 from GEOS-ESM/feature/esherman/gocart2g_develo…
Browse files Browse the repository at this point in the history
…p_MAPLconst

Compute diagnostic varaibles for multiple wavelengths. Stable.
  • Loading branch information
tclune authored Mar 5, 2021
2 parents cd6c1f2 + a3fd728 commit 3e6c9b8
Show file tree
Hide file tree
Showing 16 changed files with 147 additions and 146 deletions.
15 changes: 9 additions & 6 deletions ESMF/GOCART2G_GridComp/CA2G_GridComp/CA2G_GridCompMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ subroutine Initialize (GC, import, export, clock, RC)
type (ESMF_State) :: internal
type (ESMF_State) :: aero, aero_aci
type (ESMF_State) :: providerState
type (ESMF_Config) :: cfg, cf
type (ESMF_Config) :: cfg, universal_cfg
type (ESMF_FieldBundle) :: Bundle_DP
type (wrap_) :: wrap
type (CA2G_GridComp), pointer :: self
Expand All @@ -380,7 +380,7 @@ subroutine Initialize (GC, import, export, clock, RC)

! Get the target components name and set-up traceback handle.
! -----------------------------------------------------------
call ESMF_GridCompGet (GC, grid=grid, name=COMP_NAME, config=cf, __RC__)
call ESMF_GridCompGet (GC, grid=grid, name=COMP_NAME, config=universal_cfg, __RC__)
Iam = trim(COMP_NAME) // '::' //trim(Iam)

if (comp_name(1:5) == 'CA.oc') then
Expand Down Expand Up @@ -415,7 +415,7 @@ subroutine Initialize (GC, import, export, clock, RC)

! Check whether to de-activate diurnal biomass burning (default is *on*)
! ----------------------------------------------------------------------
call ESMF_ConfigGetAttribute(cf, diurnal_bb, label='DIURNAL_BIOMASS_BURNING:', &
call ESMF_ConfigGetAttribute(universal_cfg, diurnal_bb, label='DIURNAL_BIOMASS_BURNING:', &
default='YES', __RC__)
diurnal_bb = ESMF_UtilStringUpperCase(diurnal_bb, __RC__)
if (trim(diurnal_bb) == 'YES') then
Expand Down Expand Up @@ -554,10 +554,12 @@ subroutine Initialize (GC, import, export, clock, RC)
! Get file names for the optical tables
call ESMF_ConfigGetAttribute (cfg, self%diag_MieTable(instance)%optics_file, &
label="aerosol_monochromatic_optics_file:", __RC__ )
call ESMF_ConfigGetAttribute (cfg, self%diag_MieTable(instance)%nch, label="n_channels:", __RC__)
call ESMF_ConfigGetAttribute (cfg, self%diag_MieTable(instance)%nmom, label="n_moments:", default=0, __RC__)

i = ESMF_ConfigGetLen (universal_cfg, label='aerosol_monochromatic_optics_wavelength:', __RC__)
self%diag_MieTable(instance)%nch = i
allocate (self%diag_MieTable(instance)%channels(self%diag_MieTable(instance)%nch), __STAT__ )
call ESMF_ConfigGetAttribute (cfg, self%diag_MieTable(instance)%channels, &
call ESMF_ConfigGetAttribute (universal_cfg, self%diag_MieTable(instance)%channels, &
label= "aerosol_monochromatic_optics_wavelength:", __RC__)

allocate (self%diag_MieTable(instance)%mie_aerosol, __STAT__)
Expand Down Expand Up @@ -1022,7 +1024,8 @@ subroutine Run2 (GC, import, export, clock, RC)
int_arr(:,:,:,2) = intPtr_philic

call Aero_Compute_Diags (mie_table=self%diag_MieTable(self%instance), km=self%km, klid=self%klid, nbegin=1, nbins=2, &
channels=self%diag_MieTable(self%instance)%channels, wavelengths_profile=self%wavelengths_profile*1.0e-9, &
channels=self%diag_MieTable(self%instance)%channels*1.0e-9, &
wavelengths_profile=self%wavelengths_profile*1.0e-9, &
wavelengths_vertint=self%wavelengths_vertint*1.0e-9, aerosol=int_arr, grav=MAPL_GRAV, &
tmpu=t, rhoa=airdens, rh=rh2, u=u, v=v, delp=delp, sfcmass=CASMASS, colmass=CACMASS, &
mass=CAMASS, exttau=CAEXTTAU, scatau=CASCATAU, fluxu=CAFLUXU, fluxv=CAFLUXV, &
Expand Down
4 changes: 1 addition & 3 deletions ESMF/GOCART2G_GridComp/CA2G_GridComp/CA2G_GridComp_CA.bc.rc
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
nbins: 2

aerosol_radBands_optics_file: ExtData/MERRA2/x/opticsBands_BC.v1_3.RRTMG.nc

aerosol_monochromatic_optics_file: ExtData/AeroCom/x/optics_BC.v1_3.nc
aerosol_monochromatic_optics_wavelength: 4.7e-7 5.5e-7 6.7e-7 8.7e-7 ! units: nm
n_channels: 4

# Heights [m] of LTO, CDS and CRS aviation emissions layers
aviation_vertical_layers: 0.0 100.0 9.0e3 10.0e3
Expand All @@ -32,6 +29,7 @@ fnum: 1.50e19 1.50e19
particle_radius_microns: 0.35 0.35

rhFlag: 0
particle_density: 1800 1800

# Sigma of lognormal number distribution
sigma: 2.0 2.0
Expand Down
11 changes: 7 additions & 4 deletions ESMF/GOCART2G_GridComp/CA2G_GridComp/CA2G_GridComp_CA.br.rc
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@


aerosol_radBands_optics_file: ExtData/MERRA2/x/opticsBands_BRC.v1_5.RRTMG.nc

aerosol_monochromatic_optics_file: ExtData/AeroCom/x/optics_BRC.v1_5.nc
aerosol_monochromatic_optics_wavelength: 470 550 670 870 ! units: nm
n_channels: 4
r_channels: 4.7e-7 5.5e-7 6.7e-7 8.7e-7

# Heights [m] of LTO, CDS and CRS aviation emissions layers
aviation_vertical_layers: 0.0 100.0 9.0e3 10.0e3
Expand All @@ -28,6 +24,8 @@ fscav: 0.0 0.4
# particle radius
particle_radius_microns: 0.35 0.35

rhFlag: 0

# Dry particle density [kg m-3]
particle_density: 1800 1800

Expand All @@ -37,7 +35,12 @@ molecular_weight: 0.18 0.18
# Number of particles per kg mass
fnum: 9.76e17 9.76e17

# Number median radius [um]
particle_radius_number: 0.0212 0.0212

# Sigma of lognormal number distribution
sigma: 2.20 2.20

pressure_lid_in_hPa: 0.01

nbins: 2
7 changes: 4 additions & 3 deletions ESMF/GOCART2G_GridComp/CA2G_GridComp/CA2G_GridComp_CA.oc.rc
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
#

aerosol_radBands_optics_file: ExtData/MERRA2/x/opticsBands_OC.v1_3.RRTMG.nc

aerosol_monochromatic_optics_file: ExtData/AeroCom/x/optics_OC.v1_3.nc
aerosol_monochromatic_optics_wavelength: 4.7e-7 5.5e-7 6.7e-7 8.7e-7 ! units: nm
n_channels: 4

# Heights [m] of LTO, CDS and CRS aviation emissions layers
aviation_vertical_layers: 0.0 100.0 9.0e3 10.0e3
Expand All @@ -20,6 +17,8 @@ pom_oc_ratio: 1.4
# particle radius
particle_radius_microns: 0.35 0.35

particle_density: 1800 1800

rhFlag: 0

# Initially hydrophobic portion
Expand All @@ -42,4 +41,6 @@ sigma: 2.20 2.20

pressure_lid_in_hPa: 0.01

#point_emissions_srcfilen: /gpfsm/dnb32/esherman/gocartRefactor/RC/CA2G_point_src_test.rc

nbins: 2
30 changes: 12 additions & 18 deletions ESMF/GOCART2G_GridComp/DU2G_GridComp/DU2G_GridCompMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ subroutine SetServices (GC, RC)

__Iam__('SetServices')

integer :: n_wavelengths_profile, n_wavelengths_vertint

!****************************************************************************
! Begin...

Expand Down Expand Up @@ -366,10 +364,6 @@ subroutine Initialize (GC, import, export, clock, RC)
VERIFY_(STATUS)
self => wrap%ptr


! process generic config items
! call self%GA_GridComp%load_from_config_Init(universal_cfg, __RC__)

call MAPL_GridGet ( grid, globalCellCountPerDim=dims, __RC__ )

! Dust emission tuning coefficient [kg s2 m-5]. NOT bin specific.
Expand Down Expand Up @@ -516,10 +510,12 @@ subroutine Initialize (GC, import, export, clock, RC)
! Get file names for the optical tables
call ESMF_ConfigGetAttribute (cfg, self%diag_MieTable(instance)%optics_file, &
label="aerosol_monochromatic_optics_file:", __RC__ )
call ESMF_ConfigGetAttribute (cfg, self%diag_MieTable(instance)%nch, label="n_channels:", __RC__)
call ESMF_ConfigGetAttribute (cfg, self%diag_MieTable(instance)%nmom, label="n_moments:", default=0, __RC__)

i = ESMF_ConfigGetLen (universal_cfg, label='aerosol_monochromatic_optics_wavelength:', __RC__)
self%diag_MieTable(instance)%nch = i
allocate (self%diag_MieTable(instance)%channels(self%diag_MieTable(instance)%nch), __STAT__ )
call ESMF_ConfigGetAttribute (cfg, self%diag_MieTable(instance)%channels, &
call ESMF_ConfigGetAttribute (universal_cfg, self%diag_MieTable(instance)%channels, &
label= "aerosol_monochromatic_optics_wavelength:", __RC__)

allocate (self%diag_MieTable(instance)%mie_aerosol, __STAT__)
Expand All @@ -533,8 +529,8 @@ subroutine Initialize (GC, import, export, clock, RC)

! Add variables to DU instance's aero state. This is used in aerosol optics calculations
! --------------------------------------------------------------------------------------
call add_aero (aero, label='air_pressure_for_aerosol_optics', label2='PLE', grid=grid, typekind=MAPL_R4, __RC__)
call add_aero (aero, label='relative_humidity_for_aerosol_optics', label2='RH', grid=grid, typekind=MAPL_R4, __RC__)
call add_aero (aero, label='air_pressure_for_aerosol_optics', label2='PLE', grid=grid, typekind=MAPL_R4, __RC__)
call add_aero (aero, label='relative_humidity_for_aerosol_optics', label2='RH', grid=grid, typekind=MAPL_R4, __RC__)
! call ESMF_StateGet (import, 'PLE', field, __RC__)
! call MAPL_StateAdd (aero, field, __RC__)
! call ESMF_StateGet (import, 'RH2', field, __RC__)
Expand All @@ -544,7 +540,8 @@ subroutine Initialize (GC, import, export, clock, RC)
call add_aero (aero, label='single_scattering_albedo_of_ambient_aerosol', label2='SSA', grid=grid, typekind=MAPL_R8, __RC__)
call add_aero (aero, label='asymmetry_parameter_of_ambient_aerosol', label2='ASY', grid=grid, typekind=MAPL_R8, __RC__)

call ESMF_AttributeSet(aero, name='band_for_aerosol_optics', value=0, __RC__)
call ESMF_AttributeSet(aero, name='band_for_aerosol_optics', value=0, __RC__)
call ESMF_AttributeSet(aero, name='wavelength_for_aerosol_optics', value=0, __RC__)

mieTable_pointer = transfer(c_loc(self), [1])
call ESMF_AttributeSet(aero, name='mieTable_pointer', valueList=mieTable_pointer, itemCount=size(mieTable_pointer), __RC__)
Expand Down Expand Up @@ -894,12 +891,11 @@ subroutine Run2 (GC, import, export, clock, RC)
if(mapl_am_i_root()) print*,'n = ', n,' : Run2 E DU2G sum(du00n) = ',sum(DU(:,:,:,n))
end do

if(mapl_am_i_root()) print*,'DU2G self%wavelengths_profile = ',self%wavelengths_profile
if(mapl_am_i_root()) print*,'DU2G self%wavelengths_vertint = ',self%wavelengths_vertint
if(mapl_am_i_root()) print*,'DU2G self%diag_MieTable(self%instance)%channels = ',self%diag_MieTable(self%instance)%channels

! Compute diagnostics
! -------------------
! Certain variables are multiplied by 1.0e-9 to convert from nanometers to meters
call Aero_Compute_Diags (self%diag_MieTable(self%instance), self%km, self%klid, 1, self%nbins, self%rlow, &
self%rup, self%diag_MieTable(self%instance)%channels, self%wavelengths_profile*1.0e-9, &
self%rup, self%diag_MieTable(self%instance)%channels*1.0e-9, self%wavelengths_profile*1.0e-9, &
self%wavelengths_vertint*1.0e-9, DU, MAPL_GRAV, t, airdens, &
rh2, u, v, delp, DUSMASS, DUCMASS, DUMASS, DUEXTTAU, DUSCATAU, &
DUSMASS25, DUCMASS25, DUMASS25, DUEXTT25, DUSCAT25, &
Expand Down Expand Up @@ -1126,7 +1122,5 @@ end subroutine mie_

end subroutine aerosol_optics

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

end module DU2G_GridCompMod

4 changes: 1 addition & 3 deletions ESMF/GOCART2G_GridComp/DU2G_GridComp/DU2G_GridComp_DU.rc
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
#

aerosol_radBands_optics_file: ExtData/MERRA2/x/opticsBands_DU.v15_3.RRTMG.nc

aerosol_monochromatic_optics_file:ExtData/AeroCom/x/optics_DU.v15_3.nc
aerosol_monochromatic_optics_wavelength: 4.7e-7 5.5e-7 6.7e-7 8.7e-7 ! units: nm
n_channels: 4

particle_radius_microns: 0.73 1.4 2.4 4.5 8.0

Expand Down Expand Up @@ -40,4 +37,5 @@ nbins: 5

pressure_lid_in_hPa: 0.01

#point_emissions_srcfilen: /gpfsm/dnb32/esherman/gocartRefactor/RC/CA2G_point_src_test.rc

5 changes: 3 additions & 2 deletions ESMF/GOCART2G_GridComp/GA_GridComp/GA_GridCompMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module GA_GridCompMod
!LOCALS
integer :: status
integer :: nbins
integer :: n_wavelengths_profile, n_wavelengths_vertint
integer :: n_wavelengths_profile, n_wavelengths_vertint, n_channels

contains

Expand Down Expand Up @@ -69,7 +69,8 @@ subroutine load_from_config(self, cfg, universal_cfg, rc)
call ESMF_ConfigGetAttribute (cfg, self%rhFlag, label='rhFlag:', __RC__)
call ESMF_ConfigGetAttribute (cfg, self%plid, label='pressure_lid_in_hPa:', __RC__)
call ESMF_ConfigGetAttribute (universal_cfg, self%wavelengths_profile, label='wavelengths_for_profile_aop_in_nm:', __RC__)
call ESMF_ConfigGetAttribute (universal_cfg, self%wavelengths_vertint, label='wavelengths_for_vertically_integrated_aop_in_nm:', __RC__)
call ESMF_ConfigGetAttribute (universal_cfg, self%wavelengths_vertint, &
label='wavelengths_for_vertically_integrated_aop_in_nm:', __RC__)

end subroutine load_from_config

Expand Down
17 changes: 11 additions & 6 deletions ESMF/GOCART2G_GridComp/GOCART2G_GridComp.rc
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,27 @@

# Include the constituent in the simulation?
# ----------------------------------------------------
ACTIVE_INSTANCES_DU: DU # DU.data
PASSIVE_INSTANCES_DU:
ACTIVE_INSTANCES_DU: DU #DU.test
PASSIVE_INSTANCES_DU:

ACTIVE_INSTANCES_SS: SS # SS.data
PASSIVE_INSTANCES_SS:

ACTIVE_INSTANCES_SU: SU #SU.data
ACTIVE_INSTANCES_SU: SU #SU.data
PASSIVE_INSTANCES_SU:

ACTIVE_INSTANCES_CA: CA.oc CA.bc #CA.oc.data CA.bc.data
ACTIVE_INSTANCES_CA: CA.oc CA.bc #CA.br #CA.oc.data CA.bc.datac
PASSIVE_INSTANCES_CA:

ACTIVE_INSTANCES_NI: NI #NI.data
PASSIVE_INSTANCES_NI:

# monochromatic wavelengths are in meters
aerosol_monochromatic_optics_wavelength: 4.7e-7 5.5e-7 6.7e-7 8.7e-7
# Set optics parameters
# ---------------------
aerosol_monochromatic_optics_wavelength: 470 550 670 870 # units:nm

wavelengths_for_profile_aop_in_nm: 470 550 870
wavelengths_for_vertically_integrated_aop_in_nm: 470 550 670 870



Loading

0 comments on commit 3e6c9b8

Please sign in to comment.