FieldExchanger
This module contains general functions for the exchange of fields between the atmospheric and surface component models.
The FieldExchanger
needs to populate the coupler with
- atmospheric fields (mostly fluxes), via the
import_atmos_fields!
function - average surface properties of each coupler gridpoint, via the
import_combined_surface_fields!
function
The component models are updated by broadcasting the coupler fields, via the update_model_sims!
function. For an update, this function requires that update_field!
is defined for the particular variable and component model. Currently, we support the:
AtmosModelSimulation
:albedo
,surface_temperature
- if calculating fluxes in the atmospheric model:
roughness_momentum
,roughness_buoyancy
,beta
- if calculating fluxes in the atmospheric model:
SurfaceModelSimulation
:air_density
,turbulent_energy_flux
,turbulent_moisture_flux
,radiative_energy_flux_sfc
,liquid_precipitation
,snow_precipitation
If an update_field!
function is not defined for a particular component model, it will be ignored.
FieldExchanger API
ClimaCoupler.FieldExchanger.import_atmos_fields!
— Functionimport_atmos_fields!(csf, model_sims)
Update the coupler with the atmospheric fluxes. The Interfacer.get_field
functions (:turbulent_energy_flux
, :turbulent_moisture_flux
, :radiative_energy_flux_sfc
, :liquid_precipitation
, :snow_precipitation
) have to be defined for the atmospheric component model type.
Arguments
csf
: [NamedTuple] containing coupler fields.model_sims
: [NamedTuple] containingComponentModelSimulation
s.
import_atmos_fields!(csf, ::Interfacer.SurfaceModelSimulation, atmos_sim)
Updates the coupler simulation fields with atmospheric fluxes from the atmosphere simulation. This is the default function to be used for most surface model simulations, as are computed by the coupler or atmosphere and passed to the surfaces.
ClimaCoupler.FieldExchanger.import_combined_surface_fields!
— Functionimport_combined_surface_fields!(csf, model_sims)
Updates the coupler with the surface properties. The Interfacer.get_field
functions for (:surface_temperature
, :surface_direct_albedo
, :surface_diffuse_albedo
) need to be specified for each surface model.
Arguments
csf
: [NamedTuple] containing coupler fields.model_sims
: [NamedTuple] containingComponentModelSimulation
s.
ClimaCoupler.FieldExchanger.update_model_sims!
— Functionupdate_model_sims!(model_sims, csf)
Iterates update_sim!
over all component model simulations saved in cs.model_sims
.
Arguments
model_sims
: [NamedTuple] containingComponentModelSimulation
s.csf
: [NamedTuple] containing coupler fields.
ClimaCoupler.FieldExchanger.update_sim!
— Functionupdate_sim!(atmos_sim::Interfacer.AtmosModelSimulation, csf)
Updates the surface fields for temperature, roughness length, albedo, and specific humidity.
Arguments
atmos_sim
: [Interfacer.AtmosModelSimulation] containing an atmospheric model simulation object.csf
: [NamedTuple] containing coupler fields.
update_sim!(sim::SurfaceModelSimulation, csf, area_fraction)
Updates the surface component model cache with the current coupler fields of Fturbenergy, Fradiative, Fturbmoisture, Pliq, and ρ_sfc.
Arguments
sim
: [Interfacer.SurfaceModelSimulation] containing a surface model simulation object.csf
: [NamedTuple] containing coupler fields.
ClimaCoupler.FieldExchanger.reinit_model_sims!
— Functionreinit_model_sims!(model_sims)
Iterates reinit!
over all component model simulations saved in cs.model_sims
.
Arguments
model_sims
: [NamedTuple] containingComponentModelSimulation
s.
ClimaCoupler.FieldExchanger.step_model_sims!
— Functionstep_model_sims!(model_sims, t)
Iterates step!
over all component model simulations saved in cs.model_sims
.
Arguments
model_sims
: [NamedTuple] containingComponentModelSimulation
s.t
: [AbstractFloat] denoting the simulation time.
ClimaCoupler.FieldExchanger.update_surface_fractions!
— Functionupdate_surface_fractions!(cs::Interfacer.CoupledSimulation)
Updates dynamically changing area fractions. Maintains the invariant that the sum of area fractions is 1 at all points.
Arguments
cs
: [Interfacer.CoupledSimulation] containing area fraction information.
FieldExchanger Internal Functions
ClimaCoupler.FieldExchanger.combine_surfaces!
— Functioncombine_surfaces!(combined_field::CC.Fields.Field, sims, field_name::Val)
Sums the fields, specified by field_name
, weighted by the respective area fractions of all surface simulations. THe result is saved in combined_field
.
Arguments
combined_field
: [CC.Fields.Field] output object containing weighted values.sims
: [NamedTuple] containing simulations .field_name
: [Val] containing the name Symbol of the field t be extracted by theInterfacer.get_field
functions.
Example
combine_surfaces!(temp_field, cs.model_sims, Val(:surface_temperature))
ClimaCoupler.FieldExchanger.dummmy_remap!
— Functiondummmy_remap!(target, source)
Simple stand-in function for remapping. For AMIP we don't need regridding of surface model CC.Fields. When we do, we re-introduce the ClimaCoreTempestRemap remapping functions.
Arguments
target
: [CC.Fields.Field] destination of remapping.source
: [CC.Fields.Field] source of remapping.