@@ -287,8 +287,9 @@ module atmosphere
287287 cloud_val_f:: Float64 # /
288288
289289 # Parametrised aerosols (SOCRATES's classic aerosol functionality)
290- aerosol_mmr:: Dict{String, Array{Float64,1}} # Aerosol mass mixing ratio profiles [kg/kg]
291- aerosol_size:: Dict{String, Array{Float64,1}} # Aerosol particle size profiles [m]
290+ aerosol_arr_l:: Dict{String, Array{Float64,1}} # Aerosol mass mixing ratio profiles [kg/kg]
291+ aerosol_arr_r:: Dict{String, Array{Float64,1}} # Aerosol particle size profiles [m]
292+ aerosol_val_r:: Float64 # Default particle size for aerosol species, if not specified in array
292293 aerosol_names:: Array{String,1} # Map SOCRATES index (int) to name (string)
293294 aerosol_relhumid:: Float64 # Mean relative humidity used by moist aerosol schemes [0,1]
294295 aerosol_phase_num:: Int # Number of phase-function moments retained when averaging
@@ -795,22 +796,24 @@ module atmosphere
795796 _check_range (" Evaporation efficiency" , atmos. evap_efficiency; min= 0 , max= 1 ) || return false
796797
797798 # Hardcoded cloud properties
798- atmos. cloud_alpha = 0.01 # 1% of condensed water forms substantial clouds
799- atmos. cloud_val_r = 1.0e-5 # 10 micron droplets
800- atmos. cloud_val_l = 0.8 # 80% of the saturated vapor turns into cloud
801- atmos. cloud_val_f = 0.8 # 100% of the cell "area" is cloud
799+ atmos. cloud_alpha = 0.01 # [INPUT] 1% of condensed water forms substantial clouds
800+ atmos. cloud_val_r = 1.0e-5 # [INPUT] 10 micron droplets
801+ atmos. cloud_val_l = 0.8 # [INPUT] Mass mixing ratio of water in each layer
802+ atmos. cloud_val_f = 0.8 # [INPUT] 100% of the cell "area" is cloud
802803
803804 # Aerosol parameters
804- atmos. aerosol_phase_num = 1 # number of phase-function moments
805- atmos. aerosol_relhumid = 0.0 # relative humidity used by moist aerosol schemes
806- atmos. aerosol_mmr = Dict {String, Array{Float64,1}} () # list of MMR profiles
807- atmos. aerosol_size = Dict {String, Array{Float64,1}} () # list of MMR profiles
805+ atmos. aerosol_phase_num = 1 # [INPUT] number of phase-function moments
806+ atmos. aerosol_relhumid = 0.0 # [INPUT] relative humidity used by moist aerosol schemes
807+ atmos. aerosol_val_r = 1.0e-5 # [INPUT] default particle size for aerosol species
808+ atmos. aerosol_arr_l = Dict {String, Array{Float64,1}} () # list of MMR profiles
809+ atmos. aerosol_arr_r = Dict {String, Array{Float64,1}} () # list of particle size profiles
808810 atmos. aerosol_names = String[] # list of species names, in same order as spectral file
809811 for (k, v) in aerosol_species
812+ k = lowercase (k)
810813 _check_range (" Aerosol mass mixing ratio override for type $k " , v; min= 0.0 ) || return false
811- atmos. aerosol_mmr[ lowercase (k)] = zeros (Float64, atmos. nlev_c)
812- atmos. aerosol_size[ lowercase (k) ] = zeros (Float64, atmos. nlev_c)
813- set_aerosol! (atmos, lowercase (k) , v)
814+ atmos. aerosol_arr_l[k] = zeros (Float64, atmos. nlev_c)
815+ atmos. aerosol_arr_r[k ] = zeros (Float64, atmos. nlev_c)
816+ set_aerosol! (atmos,k , v)
814817
815818 # Store empty strings for now (set in allocate! function)
816819 push! (atmos. aerosol_names, UNSET_STR)
@@ -1917,15 +1920,15 @@ module atmosphere
19171920 @debug " Generating aerosol .avg files with scatter_average_90"
19181921 aerosol_avg_files_rt = spectrum. generate_aerosol_avg_files (
19191922 atmos. spectral_file,
1920- [s for s in keys (atmos. aerosol_mmr )],
1923+ [s for s in keys (atmos. aerosol_arr_l )],
19211924 atmos. IO_DIR,
19221925 atmos. aerosol_phase_num,
19231926 socstar,
19241927 atmos. SCATTERING_DIR
19251928 )
19261929
19271930 # check that all files were generated successfully
1928- if length (aerosol_avg_files_rt) != length (atmos. aerosol_mmr )
1931+ if length (aerosol_avg_files_rt) != length (atmos. aerosol_arr_l )
19291932 @error " Failed to generate required aerosol .avg files"
19301933 list_available_aerosols (atmos)
19311934 return false
@@ -2310,14 +2313,18 @@ module atmosphere
23102313 # Enable aerosol
23112314 atmos. aer. mr_source[i] = SOCRATES. rad_pcf. ip_aersrc_classic_ron
23122315
2313- # Add array to aerosol_mmr if not requested by user already
2314- if ! haskey (atmos. aerosol_mmr, name)
2315- atmos. aerosol_mmr[name] = zeros (Float64, atmos. nlev_c)
2316+ # Add array if not requested by user already
2317+ if ! haskey (atmos. aerosol_arr_l, name)
2318+ atmos. aerosol_arr_l[name] = zeros (Float64, atmos. nlev_c)
2319+ if haskey (atmos. aerosol_arr_r, name)
2320+ @warn " Aerosol '$name ' mismatched in arrays!"
2321+ else
2322+ atmos. aerosol_arr_r[name] = zeros (Float64, atmos. nlev_c)
23162323 end
23172324 end
23182325
23192326 # warn if user has requested unsupported aerosol
2320- for name in keys (atmos. aerosol_mmr )
2327+ for name in keys (atmos. aerosol_arr_l )
23212328 if ! (name in atmos. aerosol_names)
23222329 @warn " Requested aerosol '$name ' not found in spectral file"
23232330 list_available_aerosols (atmos)
@@ -2788,7 +2795,7 @@ module atmosphere
27882795 @info @sprintf (" %10s - %s" , name, strip (title))
27892796 push! (aerosol_names, name)
27902797 end
2791- if isempty (atmos. aerosol_mmr )
2798+ if isempty (atmos. aerosol_arr_l )
27922799 @info " [none]"
27932800 end
27942801
@@ -2851,7 +2858,7 @@ module atmosphere
28512858 end
28522859
28532860 """
2854- **Set aerosol profile for a given species.**
2861+ **Set aerosol profiles for a given species.**
28552862
28562863 Arguments:
28572864 - `atmos::atmosphere.Atmos_t` the atmosphere struct instance to be used
@@ -2873,16 +2880,19 @@ module atmosphere
28732880 # Set mixing ratio profile for aerosol
28742881 if isa (mmr, Float64)
28752882 # constant profile
2876- atmos. aerosol_mmr [species][idx_mask] .= mmr
2883+ atmos. aerosol_arr_l [species][idx_mask] .= mmr
28772884 else
28782885 # 1D profile
28792886 if length (mmr) != length (atmos. p)
28802887 @error " Length of input mmr array does not match number of layers"
28812888 return false
28822889 end
2883- atmos. aerosol_mmr [species][idx_mask] .= mmr[idx_mask]
2890+ atmos. aerosol_arr_l [species][idx_mask] .= mmr[idx_mask]
28842891 end
28852892
2893+ # Set constant size
2894+ fill! (atmos. aerosol_arr_r[species], atmos. aerosol_val_r)
2895+
28862896 return true
28872897 end
28882898
0 commit comments