Skip to content

Commit c22aa84

Browse files
committed
Using named variable for ungridded dims
1 parent 268ece2 commit c22aa84

File tree

2 files changed

+60
-40
lines changed

2 files changed

+60
-40
lines changed

ESMF/GOCART2G_GridComp/SS2G_GridComp/SS2G_GridCompMod.F90

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ module SS2G_GridCompMod
2727
use mapl3g_RestartModes, only: MAPL_RESTART_SKIP
2828
use mapl3g_Geom_API, only: MAPL_GridGet
2929
use mapl3g_State_API, only: MAPL_StateGetPointer
30+
use mapl3g_UngriddedDim, only: UngriddedDim
3031
use GOCART2G_MieMod
3132
use Chem_AeroGeneric
3233
use iso_c_binding, only: c_loc, c_f_pointer, c_ptr
@@ -38,9 +39,9 @@ module SS2G_GridCompMod
3839
private
3940

4041
integer, parameter :: instanceComputational = 1
41-
integer, parameter :: instanceData = 2
42+
integer, parameter :: instanceData = 2
4243
real, parameter :: OCEAN=0.0, LAND = 1.0, SEA_ICE = 2.0
43-
integer, parameter :: DP=kind(1.0d0)
44+
integer, parameter :: DP=kind(1.0d0)
4445

4546
!PUBLIC MEMBER FUNCTIONS:
4647
PUBLIC SetServices
@@ -106,6 +107,8 @@ subroutine SetServices(gc, rc)
106107
logical :: file_exists
107108
real, allocatable :: emission_scale_res(:)
108109
class(Logger_t), pointer :: logger
110+
type(UngriddedDim) :: ungrd_nbins
111+
type(UngriddedDim) :: ungrd_wavelengths_profile, ungrd_wavelengths_vertint
109112
integer :: status
110113

111114
call ESMF_GridCompGet(gc, name=comp_name, _RC)
@@ -119,6 +122,17 @@ subroutine SetServices(gc, rc)
119122
! Process generic config items
120123
call self%GA_Environment%load_from_config(gc, _RC)
121124

125+
! Defined UngriddedDim items
126+
ungrd_nbins = UngriddedDim(self%nbins, name="nbins", units="1")
127+
ungrd_wavelengths_profile = UngriddedDim( &
128+
size(self%wavelengths_profile), &
129+
name="wavelengths_profile", &
130+
units="nm")
131+
ungrd_wavelengths_vertint = UngriddedDim( &
132+
size(self%wavelengths_vertint), &
133+
name="wavelengths_vertint", &
134+
units="nm")
135+
122136
! Process SS-specific items
123137
call MAPL_GridCompGetResource(gc, "sstEmisFlag", self%sstEmisFlag, _RC)
124138
call MAPL_GridCompGetResource(gc, "weibullFlag", self%weibullFlag, _RC)
@@ -140,7 +154,7 @@ subroutine SetServices(gc, rc)
140154
call MAPL_GridCompSetEntryPoint (gc, ESMF_METHOD_RUN, Run, phase_name="Run1", _RC)
141155
if (data_driven .neqv. .true.) then
142156
call MAPL_GridCompSetEntryPoint (gc, ESMF_METHOD_RUN, Run2, phase_name="Run2", _RC)
143-
call MAPL_GridCompSetEntryPoint (gc, ESMF_METHOD_RUN, Run0, phase_name="Run0", _RC)
157+
! call MAPL_GridCompSetEntryPoint (gc, ESMF_METHOD_RUN, Run0, phase_name="Run0", _RC)
144158
end if
145159

146160
DEFVAL = 0.0
@@ -157,7 +171,7 @@ subroutine SetServices(gc, rc)
157171
dims='xyz', &
158172
vstagger=VERTICAL_STAGGER_CENTER, &
159173
! restart=MAPL_RestartOptional, &
160-
ungridded_dims=[self%nbins], &
174+
ungridded_dims=[ungrd_nbins], &
161175
! friendlyto='DYNAMICS:TURBULENCE:MOIST', &
162176
add_to_export=.true., _RC)
163177

@@ -608,6 +622,8 @@ subroutine Run1 (gc, import, export, clock, RC)
608622
call MAPL_GridCompGetInternalState(gc, internal, _RC)
609623
#include "SS2G_GetPointer___.h"
610624

625+
if (associated(SSSMASS)) SSSMASS = 0.
626+
611627
! Get my private internal state
612628
call ESMF_UserCompGetInternalState(gc, 'SS2G_GridComp', wrap, _RC)
613629
self => wrap%ptr
@@ -730,6 +746,10 @@ subroutine Run2 (gc, import, export, clock, RC)
730746
i1 = lbound(pfi_lsan, 1); i2 = ubound(pfi_lsan, 1); j1 = lbound(pfi_lsan, 2); j2 = ubound(pfi_lsan, 2)
731747
allocate(pfi_lsan0(i1:i2, j1:j2, 0:km), source=pfi_lsan(i1:i2, j1:j2, 1:km+1))
732748

749+
! Set klid and Set internal values to 0 above klid
750+
call findKlid (self%klid, self%plid, ple0, __RC__)
751+
call setZeroKlid4d (self%km, self%klid, SS)
752+
733753
allocate(dqa, mold=lwi, __STAT__)
734754
allocate(drydepositionfrequency, mold=lwi, __STAT__)
735755

@@ -739,7 +759,7 @@ subroutine Run2 (gc, import, export, clock, RC)
739759
if (associated(SSSD)) flux_ptr => SSSD(:,:,n)
740760
call Chem_SettlingSimple (self%km, self%klid, self%diag_Mie, n, self%cdt, MAPL_GRAV, &
741761
SS(:,:,:,n), t, airdens, &
742-
rh2, zle0, delp, flux_ptr, _RC)
762+
rh2, zle0, delp, flux_ptr, settling_scheme=1, _RC)
743763
end do
744764

745765
! Deposition

ESMF/GOCART2G_GridComp/SS2G_GridComp/SS2G_StateSpecs.rc

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -39,40 +39,40 @@ category: EXPORT
3939
#----------------------------------------------------------------------------------------
4040
# VARIABLE | DIMENSIONS | Additional Metadata
4141
#----------------------------------------------------------------------------------------
42-
NAME | UNITS | DIMS | VLOC | UNGRIDDED | LONG NAME
42+
NAME | UNITS | DIMS | VLOC | UNGRIDDED | LONG NAME
4343
#----------------------------------------------------------------------------------------
44-
SSMASS | kg kg-1 | xyz | C | | Sea Salt Mass Mixing Ratio
45-
SSMASS25 | kg kg-1 | xyz | C | | Sea Salt Mass Mixing Ratio of Particulate Matter < 2.5 microns (PM2.5)
46-
SSCONC | kg m-3 | xyz | C | | Sea Salt Mass Concentration
47-
SSEXTCOEF | m-1 | xyz | C | size(self%wavelengths_profile) | Sea Salt Extinction Coefficient
48-
SSEXTCOEFRH20 | m-1 | xyz | C | size(self%wavelengths_profile) | Sea Salt Extinction Coefficient - Fixed RH=20%
49-
SSEXTCOEFRH80 | m-1 | xyz | C | size(self%wavelengths_profile) | Sea Salt Extinction Coefficient - Fixed RH=80%
50-
SSSCACOEF | m-1 | xyz | C | size(self%wavelengths_profile) | Sea Salt Scattering Coefficient
51-
SSSCACOEFRH20 | m-1 | xyz | C | size(self%wavelengths_profile) | Sea Salt Scattering Coefficient - Fixed RH=20%
52-
SSSCACOEFRH80 | m-1 | xyz | C | size(self%wavelengths_profile) | Sea Salt Scattering Coefficient - Fixed RH=80%
53-
SSBCKCOEF | m-1 sr-1 | xyz | C | size(self%wavelengths_profile) | Sea Salt Backscatter Coefficient
54-
#............. | ............ | ..... | ..... | ............ | ..................................
55-
SSEM | kg m-2 s-1 | xy | N | self%nbins | Sea Salt Emission (Bin %d)
56-
SSSD | kg m-2 s-1 | xy | N | self%nbins | Sea Salt Sedimentation (Bin %d)
57-
SSDP | kg m-2 s-1 | xy | N | self%nbins | Sea Salt Dry Deposition (Bin %d)
58-
SSWT | kg m-2 s-1 | xy | N | self%nbins | Sea Salt Wet Deposition (Bin %d)
59-
SSSV | kg m-2 s-1 | xy | N | self%nbins | Sea Salt Convective Scavenging (Bin %d)
60-
SSSMASS | kg m-3 | xy | N | | Sea Salt Surface Mass Concentration
61-
SSCMASS | kg m-2 | xy | N | | Sea Salt Column Mass Density
62-
SSEXTTAU | 1 | xy | N | size(self%wavelengths_vertint) | Sea Salt Aerosol Optical Depth
63-
SSSTEXTTAU | 1 | xy | N | size(self%wavelengths_vertint) | Sea Salt Stratospheric Aerosol Optical Thickness
64-
SSSCATAU | 1 | xy | N | size(self%wavelengths_vertint) | Sea Salt Aerosol Optical Depth Due to Scattering
65-
SSSTSCATAU | 1 | xy | N | size(self%wavelengths_vertint) | Sea Salt Stratospheric Aerosol Optical Thickness Due to Scattering
66-
SSSMASS25 | kg m-3 | xy | N | | Sea Salt Surface Mass Concentration of Particulate Matter < 2.5 microns (PM2.5)
67-
SSCMASS25 | kg m-2 | xy | N | | Sea Salt Column Mass Density of Particulate Matter < 2.5 microns (PM2.5)
68-
SSEXTT25 | 1 | xy | N | size(self%wavelengths_vertint) | Sea Salt Aerosol Optical Depth from Particulate Matter < 2.5 microns (PM2.5)
69-
SSSCAT25 | 1 | xy | N | size(self%wavelengths_vertint) | Sea Salt Aerosol Optical Depth Due to Scattering from Particulate Matter < 2.5 microns (PM2.5)
70-
SSAERIDX | 1 | xy | N | | Sea Salt TOMS UV Aerosol Index
71-
SSEXTTFM | 1 | xy | N | size(self%wavelengths_vertint) | Sea Salt Aerosol Optical Depth from Particulate Matter < 1 micron (PM1.0)
72-
SSSCATFM | 1 | xy | N | size(self%wavelengths_vertint) | Sea Salt Aerosol Optical Depth Due to Scattering from Particulate Matter < 1 micron (PM1.0)
73-
SSANGSTR | 1 | xy | N | | Sea Salt Angstrom parameter [470-870 nm]
74-
SSFLUXU | kg m-1 s-1 | xy | N | | Sea Salt column u-wind mass flux
75-
SSFLUXV | kg m-1 s-1 | xy | N | | Sea Salt column v-wind mass flux
44+
SSMASS | kg kg-1 | xyz | C | | Sea Salt Mass Mixing Ratio
45+
SSMASS25 | kg kg-1 | xyz | C | | Sea Salt Mass Mixing Ratio of Particulate Matter < 2.5 microns (PM2.5)
46+
SSCONC | kg m-3 | xyz | C | | Sea Salt Mass Concentration
47+
SSEXTCOEF | m-1 | xyz | C | ungrd_wavelengths_profile | Sea Salt Extinction Coefficient
48+
SSEXTCOEFRH20 | m-1 | xyz | C | ungrd_wavelengths_profile | Sea Salt Extinction Coefficient - Fixed RH=20%
49+
SSEXTCOEFRH80 | m-1 | xyz | C | ungrd_wavelengths_profile | Sea Salt Extinction Coefficient - Fixed RH=80%
50+
SSSCACOEF | m-1 | xyz | C | ungrd_wavelengths_profile | Sea Salt Scattering Coefficient
51+
SSSCACOEFRH20 | m-1 | xyz | C | ungrd_wavelengths_profile | Sea Salt Scattering Coefficient - Fixed RH=20%
52+
SSSCACOEFRH80 | m-1 | xyz | C | ungrd_wavelengths_profile | Sea Salt Scattering Coefficient - Fixed RH=80%
53+
SSBCKCOEF | m-1 sr-1 | xyz | C | ungrd_wavelengths_profile | Sea Salt Backscatter Coefficient
54+
#............. | ............ | ..... | ..... | ............ | ..................................
55+
SSEM | kg m-2 s-1 | xy | N | ungrd_nbins | Sea Salt Emission (Bin %d)
56+
SSSD | kg m-2 s-1 | xy | N | ungrd_nbins | Sea Salt Sedimentation (Bin %d)
57+
SSDP | kg m-2 s-1 | xy | N | ungrd_nbins | Sea Salt Dry Deposition (Bin %d)
58+
SSWT | kg m-2 s-1 | xy | N | ungrd_nbins | Sea Salt Wet Deposition (Bin %d)
59+
SSSV | kg m-2 s-1 | xy | N | ungrd_nbins | Sea Salt Convective Scavenging (Bin %d)
60+
SSSMASS | kg m-3 | xy | N | | Sea Salt Surface Mass Concentration
61+
SSCMASS | kg m-2 | xy | N | | Sea Salt Column Mass Density
62+
SSEXTTAU | 1 | xy | N | ungrd_wavelengths_vertint | Sea Salt Aerosol Optical Depth
63+
SSSTEXTTAU | 1 | xy | N | ungrd_wavelengths_vertint | Sea Salt Stratospheric Aerosol Optical Thickness
64+
SSSCATAU | 1 | xy | N | ungrd_wavelengths_vertint | Sea Salt Aerosol Optical Depth Due to Scattering
65+
SSSTSCATAU | 1 | xy | N | ungrd_wavelengths_vertint | Sea Salt Stratospheric Aerosol Optical Thickness Due to Scattering
66+
SSSMASS25 | kg m-3 | xy | N | | Sea Salt Surface Mass Concentration of Particulate Matter < 2.5 microns (PM2.5)
67+
SSCMASS25 | kg m-2 | xy | N | | Sea Salt Column Mass Density of Particulate Matter < 2.5 microns (PM2.5)
68+
SSEXTT25 | 1 | xy | N | ungrd_wavelengths_vertint | Sea Salt Aerosol Optical Depth from Particulate Matter < 2.5 microns (PM2.5)
69+
SSSCAT25 | 1 | xy | N | ungrd_wavelengths_vertint | Sea Salt Aerosol Optical Depth Due to Scattering from Particulate Matter < 2.5 microns (PM2.5)
70+
SSAERIDX | 1 | xy | N | | Sea Salt TOMS UV Aerosol Index
71+
SSEXTTFM | 1 | xy | N | ungrd_wavelengths_vertint | Sea Salt Aerosol Optical Depth from Particulate Matter < 1 micron (PM1.0)
72+
SSSCATFM | 1 | xy | N | ungrd_wavelengths_vertint | Sea Salt Aerosol Optical Depth Due to Scattering from Particulate Matter < 1 micron (PM1.0)
73+
SSANGSTR | 1 | xy | N | | Sea Salt Angstrom parameter [470-870 nm]
74+
SSFLUXU | kg m-1 s-1 | xy | N | | Sea Salt column u-wind mass flux
75+
SSFLUXV | kg m-1 s-1 | xy | N | | Sea Salt column v-wind mass flux
7676

7777

7878
category: INTERNAL
@@ -81,8 +81,8 @@ category: INTERNAL
8181
#----------------------------------------------------------------------------------------
8282
NAME | UNITS | DIMS | VLOC | UNGRIDDED | RESTART | ADD2EXPORT | FRIENDLYTO | LONG NAME
8383
#----------------------------------------------------------------------------------------
84-
SS |kg kg-1| xyz | C | self%nbins | MAPL_RestartOptional | T | DYNAMICS:TURBULENCE:MOIST | Sea Salt Mixing Ratio (bin %d)
85-
DEEP_LAKES_MASK | 1 | xy | N | | MAPL_RestartSkip | F | | Deep Lakes Mask
84+
SS |kg kg-1| xyz | C | ungrd_nbins | MAPL_RestartOptional | T | DYNAMICS:TURBULENCE:MOIST | Sea Salt Mixing Ratio (bin %d)
85+
DEEP_LAKES_MASK | 1 | xy | N | | MAPL_RestartSkip | F | | Deep Lakes Mask
8686

8787
#********************************************************
8888
#

0 commit comments

Comments
 (0)