Toon solver
Modules contains all functions required to run the Toon (1989) radiative transfer solver.
toon_solver
Makes function calls relating to radiative transfer solver in sequence and returns outputs.
Args
tau
: optical thicknessssa
: single scattering albedog
: asymmetry parameterL_snw
: mass of ice in each layerice
: instance of Ice classillumination
: instance of Illumination classmodel_config
: instance of ModelConfig classrt_config
: instance of RTConfig class
Returns
outputs
: instance of Outputs class
validate_inputs_toon
Checks for known invalid data configurations that break the Toon solver. If invalid config is detected a ValueError
is raised, halting execution.
Args:
ice
: class representing the ice column and containing related physical constantsillumination
: class representing incoming irradiance containing related physical constants
Returns:
None
Raises:
ValueError
: raised with descriptive error message if invalid input detected
delta_transformation
Applies Delta transformation.
Args:
rt_config
: instance of RTConfig classg
: asymmetry parameterssa
: single scatterign albedotau
: optical thickness
Returns:
g_star
: delta scaled asymmetry parameterssa_star
: delta scaled singloe scattering albedotau_star
: delta scaled optical thickness
calculate_optical_depth_of_column
Calculates column optical thickness.
Args:
ice
: instance of Ice classmodel_config
: instance of ModelConfig classtau_star
: delta scaled optical thickness
Returns:
tau_clm
: optical thickness of column
boundary_condition
Calculates reflectance from underlying surface.
Args:
ice
: instance of Ice classillumination
: instance of Illumination classtau_clm
: optical thickness of columntau_star
: delta_scaled optical thickness
Returns:
S_sfc
: reflectance from underlying surface
two_stream_approximation
Applies two-stream approximation.
Three 2-stream approximations are available: Eddington, Quadrature and hemispheric mean. The equations for each approximation are provided in Toon et al. (1989) Table 1.
The hemispheric mean scheme is derived by assuming that the phase function is equal to 1 + g in the forward scattering hemisphere and to 1 - g in the backward scattering hemisphere. The asymmetry parameter is g. The hemispheric mean is only useful for infrared wavelengths.
Args:
rt_config
: instance of RTConfig classssa_star
: delta scaled signle scattering albedog_star
: delta scaled asymmetry parameter
Returns:
gamma1
: coefficient for matrix solutiongamma2
: coefficient for matrix solutiongamma3
: coefficient for matrix solutiongamma4
: coefficient for matrix solutionmu_one
: adjusted incidence angle
calculate_matrix_coefficients
Calculates coefficients required for matrix calculation.
Args
gamma1
: coefficient for matrix solutiongamma2
: coefficient for matrix solutiontau_star
: delta scaled optical thickness
Returns
lam
: coefficient for matrix solutionGAMMA
: coefficient for matrix solutione1
: coefficient for matrix solutione2
: coefficient for matrix solutione3
: coefficient for matrix solutione4
: coefficient for matrix solution
c_functions
Calculate fluxes through column.
Args
ice
: instance of Ice classmodel_config
: instance of ModelConfig classillumination
: instance of Illumination classssa_star
: delta scaled single scatterign albedotau_star
: delta scaled optical thicknesstau_clm
: column optical thicknesslam
: coefficient for matrix solutiongamma1
: coefficient for matrix solutiongamma2
: coefficient for matrix solutiongamma3
: coefficient for matrix solutiongamma4
: coefficient for matrix solution
Returns
C_pls_btm
: upwards flux from bottom of layerC_mns_btm
: downwards flux from bottom of layerC_pls_top
: upwards flux from top of layerC_mns_top
: downwards flux from top of layer
matrix_solver
Execute matrix calculation.
Args
ice
: instance of Ice classillumination
: instance of Illumination classmodel_config
: instance of ModelConfig classs_sfc
: reflectance of underlying surfaceC_pls_btm
: upwards flux from bottom of layerC_mns_btm
: downwards flux from bottom of layerC_pls_top
: upwards flux from top of layerC_mns_top
: downwards flux from top of layere1
: coefficient for matrix solutione2
: coefficient for matrix solutione3
: coefficient for matrix solutione4
: coefficient for matrix solution
Returns
Y
: intermediate representing t-0 boundary fluxes
layer_fluxes
Calculates total fluxes
Args
ice
: instance of Ice classillumination
: instance of Illumination classmodel_config
: instance of ModelConfig classtau_clm
: optical thickness of columnlam
: intermediate coefficientGAMMA
: intermediate coefficienttau_star
: delta scaled optical thicknessC_pls_btm
: upwards flux from bottom of layerC_mns_btm
: downwards flux from bottom of layerC_pls_top
: upwards flux from top of layerC_mns_top
: downwards flux from top of layere1
: coefficient for matrix solutione2
: coefficient for matrix solutione3
: coefficient for matrix solutione4
: coefficient for matrix solutionmu_one
: adjusted indicence angle
Returns
F_net
: net flux in each layerF_top_pls
: net upwards flux from upper surface of each layerF_btm_net
: net flux at bottom surfaceF_top_net
: net fluxes at upper surfaceintensity
: mean intensity at base of each layer
absorbed_fluxes
Calculates energy absorbed in each layer.
Args
ice
: instance of Ice classmodel_config
: instance of ModelConfig classF_net
: net flux in each layerF_top_net
: net flux at upper model boundary
Returns:
F_abs
: absorbed flux in each layer
conservation_of_energy_check
Checks there is no conservation of energy violation.
Args
illumination
: instance of Illumination classF_abs
: absorbed flux in each layerF_btm_net
: net flux at bottom surfaceF_top_pls
: upwards flux from upper boundary
Returns
None
Raises
ValueError
is conservation of energy error is detected
get_outputs
Assimilates useful data into instance of Outputs class.
Args
illumination
: instance of Illumination classalbedo
: ratio of upwwards fluxes and irradiancemodel_config
: instance of ModelConfig classL_snw
: mass of ice in each layerF_abs
: absorbed flux in each layerF_btm_net
: net flux at bottom surface
Returns
outputs
: instance of Outputs class
apply_smoothing_function
Optionally applies a Savitsky-Golay smoothing filter to the returned albedo
Args
model_config
: instance of ModelConfig classalbedo
: the model-predicted spectral albedo
Returns
albedo
: smoothed spectral albedo