energybal module

Energy balance module.

Model the energy fluxes in the soil-plant-atmosphere system.

Author - Christopher Teh Boon Sung


LeafDim namedtuple

LeafDim(length, width)

namedtuple: Leaflet dimension

length

float: mean length of a single leaflet

width

float: mean width of a single leaflet

StomatalStresses namedtuple

StomatalStresses(water, vpd, par)

namedtuple: Stresses that would reduce stomatal conductivity

water

float: reduction due to water stress

vpd

float: reduction due to vapor pressure deficit

par

float: reduction due to insufficient solar irradiance

AvailEnergy namedtuple

AvailEnergy(total, crop, soil, net, g)

namedtuple: Available radiation to the soil-plant-atmosphere system

total

float: radiation available to both crop and soil (total)

crop

float: radiation available to the crop

soil

float: radiation available to the soil

net

float: net radiation

g

float: soil heat flux

Resistances namedtuple

Resistances(rsa, raa, rca, rst, rcs, rss)

namedtuple: Resistances to heat fluxes

rsa

float: aerodynamic resistance between soil and mcf (mean canopy flow)

raa

float: aerodynamic resistance between mcf and the reference level

rca

float: boundary layer resistance

rst

float: leaf stomatal resistance

rcs

float: canopy resistance

rss

float: soil resistance

HeatFluxes namedtuple

HeatFluxes(total, crop, soil)

namedtuple: Heat flux components

total

float total heat flux (crop + soil)

crop

float heat flux from the crop

soil

float heat flux from the soil

EnergyBal class

Energy balance class.

Model the energy fluxes in the soil-plant-atmosphere system, using the electrical network analogy, where the system is described as a network of resistances where various heat fluxes must traverse a series of resistances to a reach a given reference height.

This class determines the canopy/foliage temperature which is used by the Photosynthesis model component to determine the canopy photosynthesis.

CLASS ATTRIBUTES

  • psycho (float): psychometric constant (0.658 mbar/K)
  • pcp (float): vol. heat capacity (1221.09 J/m3/K)
  • soilroughlen (float): soil roughness length for flat, tilled land (0.004 m)
  • vonk (float): von Karman constant (0.4)

Note

All the above class attributes are supposed to be treated as constants.

ATTRIBUTES

  • refhgt (float): Reference height (m)
  • d (float): Zero plane displacement (m)
  • z0 (float): Crop roughness length (m)
  • windext (float): Wind extinction coefficient (unitless)
  • eddyext (float): Eddy diffusivity extinction coefficient (unitless)
  • leafdim (LeafDim): Leaflet dimension (m)
  • stressfn (StomatalStresses): Reduction in stomatal conductance due to stresses
  • availegy (AvailEnergy): Available energy (W/m2)
  • ustar (float): Friction velocity (m/s)
  • ucrophgt (float): Wind speed at crop height (m/s)
  • res (Resistances): Flux resistances (s/m)
  • et (HeatFluxes): Latent heat flux components (W/m2)
  • h (HeatFluxes): Sensible heat flux components (W/m2)
  • canopytemp (float): Canopy/foliage temperature (deg. C)
  • dayet (HeatFluxes): Daily latent heat flux components (mm water/day)
  • dayh (HeatFluxes): Daily sensible heat flux components (MJ/m2/day)

METHODS

  • windspeed_profile_params: Windspeed profile paramaters
  • leaf_dimension: Mean length and width of leaflets (m)
  • stomatal_cond_stresses: Reduction in stomatal conductance due to various stresses (unitless)
  • available_energy: Available energy (W/m2) to crop and soil (net radiation partitioning)
  • res_rss: Soil resistance (s/m)
  • friction_velocity: Friction velocity (m/s)
  • windspd_at_crophgt: Wind speed at crop/tree height (m/s)
  • windspd_at_refhgt: Extrapolated wind speed from weather station height to reference height (m/s)
  • res_rsa: Aerodynamic resistance between soil and mcf (mean canopy flow) (s/m)
  • res_raa: Aerodynamic resistance between mcf and reference height (s/m)
  • effective_lai: Effective LAI (m2 leaf/m2 ground)
  • res_rca: Boundary layer resistance (s/m)
  • res_rcs_st: Canopy and stomatal resistance (s/m)
  • resistances: Flux resistances (s/m)
  • calc_all_fluxes: Calculate the various latent and sensible heat fluxes (W/m2)
  • canopy_temperature: Canopy/foliage temperature (deg C)
  • set_heat_fluxes: Instantaneous heat fluxes (W/m2)
  • set_daily_immutables: Set constants that do not change within a day
  • daily_heat_balance: Solve for daily fluxes for latent heat (mm water/day) and sensible heat (MJ/m2/day)
  • update: Update the energy balance properties
  • next_hour: Generator to increment the hour and then update the model properties

Constructor __init__

EnergyBal(self, fname_in)

Create and initialize the EnergyBal object.

Arguments

  • fname_in (str): path and filename of the model initialization file

windspeed_profile_params

EnergyBal.windspeed_profile_params(self)

Windspeed profile paramaters.

Paramaters calculated are as follows

    zero plane displacement, d (m)
    crop roughness length, z0 (m)
    vertical profile extinction coeffiicient (unitless) for:
        wind speed
        eddy diffusivity

Returns

tuple: windspeed profile parameters (float)

leaf_dimension

Mean length and width of leaflets (m).

Returns

LeafDim: namedtuple containing the leaf dimensions (float)

stomatal_cond_stresses

Reduction in stomatal conductance due to various stresses (unitless).

Returns

StomatalStresses: namedtuple containing the stresses

available_energy

Available energy (W/m2) to crop and soil (net radiation partitioning).

Returns

AvailEnergy: namedtuple containing the available energy to the system and its components

res_rss

EnergyBal.res_rss(self)

Soil resistance (s/m).

Returns

float: soil resistance

friction_velocity

EnergyBal.friction_velocity(self)

Friction velocity (m/s).

Returns

float: friction velocity

Raises

  • ArithmeticError: raised when tree is taller than reference height

windspd_at_crophgt

EnergyBal.windspd_at_crophgt(self)

Wind speed at crop/tree height (m/s).

Returns

float: wind speed at the tree height

windspd_at_refhgt

EnergyBal.windspd_at_refhgt(self)

Wind speed (m/s) at reference height.

Wind speed measured at weather station height may not be the same as the reference height (thus, wind speed will have to be extrapolated to the reference height).

Returns

float: wind speed at reference height

res_rsa

EnergyBal.res_rsa(self)

Aerodynamic resistance between soil and mcf (mean canopy flow) (s/m).

Returns

float: aerodynamic resistance between soil and mcf

res_raa

EnergyBal.res_raa(self)

Aerodynamic resistance between mcf (mean canopy flow) and reference height (s/m).

Returns

float: aerodynamic resistance between mcf and reference height

effective_lai

EnergyBal.effective_lai(self)

Effective LAI (m2 leaf/m2 ground).

Returns

float: effective LAI

res_rca

EnergyBal.res_rca(self)

Boundary layer resistance (s/m).

Returns

float: boundary layer resistance

res_rcs_st

EnergyBal.res_rcs_st(self)

Canopy and stomatal resistance (s/m).

Returns

float: Canopy and stomatal resistance

resistances

Flux resistances (s/m).

Returns

Resistances: namedtuple containing all the resistances (float)

calc_all_fluxes

Calculate the various latent and sensible heat fluxes (W/m2).

Returns

HeatFluxes: namedtuple containing the components of latent and sensible heat fluxes (float)

canopy_temperature

EnergyBal.canopy_temperature(self)

Canopy/foliage temperature (deg. C).

Returns

float: canopy temperature

set_heat_fluxes

EnergyBal.set_heat_fluxes(self)

Instantaneous heat fluxes (W/m2).

Sets the following attributes

    stressfn - reduction to stomatal conductance
    availegy - available energy to the crop and soil
    ustar - friction velocity
    ucrophgt - wind speed at tree height
    res - all the heat flux resisitances
    et & h - latent and sensible heatfluxes
    canopytemp - foliage temperature

Returns

None:

set_daily_immutables

EnergyBal.set_daily_immutables(self)

Set constants that do not change within a day.

Sets parameters that will not change within the same day. This speeds up hourly calculations carried out for the same day.

Returns

None:

daily_heat_balance

EnergyBal.daily_heat_balance(self)

Solve for daily fluxes for latent (mm water/day) and sensible (MJ/m2/day) heat.

Returns

None:

update

EnergyBal.update(self, external_info)

Update the energy balance properties.

Arguments

  • external_info (dict): will be used to pass information needed by parent classes

Returns

None:

next_hour

EnergyBal.next_hour(self, duration)

Generator to increment the hour and then update the model properties.

Hour moves forward an hour day at a time within the same day, where for each hour shift, the model properties are updated.

Arguments

  • duration (int): number of cycles/steps to increment the hour and model update

Yields

int: current hour run