fvtp2d
FiniteVolumeTransport
Equivalent of Fortran FV3 subroutine fv_tp_2d, done in 3 dimensions. Tested on serialized data with FvTp2d ONLY USE_SG=False compiler flag implements
__call__(q, crx, cry, x_area_flux, y_area_flux, q_x_flux, q_y_flux, x_mass_flux=None, y_mass_flux=None, mass=None)
Calculate fluxes for horizontal finite volume transport.
Defined in Putman and Lin 2007 (PL07). Corresponds to equation 4.17 in the FV3 documentation.
Divergence terms are handled by advecting the weighting used in the units of the scalar, and dividing by its divergence. For example, temperature (pt in the Fortran) and tracers are mass weighted, so the final tendency is e.g. (convergence of tracer) / (convergence of gridcell mass). This is described in eq 17 of PL07. pressure thickness and vorticity by contrast are area weighted.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
q
|
in
|
scalar to be transported |
required |
crx
|
in
|
Courant number in x-direction |
required |
cry
|
in
|
Courant number in y-direction |
required |
x_area_flux
|
in
|
flux of area in x-direction, in units of m^2 |
required |
y_area_flux
|
in
|
flux of area in y-direction, in units of m^2 |
required |
q_x_flux
|
out
|
transport flux of q in x-direction in units q * m^2, corresponding to X in eq 4.17 of FV3 documentation |
required |
q_y_flux
|
out
|
transport flux of q in y-direction in units q * m^2, corresponding to Y in eq 4.17 of FV3 documentation |
required |
x_mass_flux
|
in
|
mass flux in x-direction, corresponds to F(rho^* = 1) in PL07 eq 17, if not given then q is assumed to have per-area units |
None
|
y_mass_flux
|
in
|
mass flux in x-direction, corresponds to G(rho^* = 1) in PL07 eq 18, if not given then q is assumed to have per-area units |
None
|
mass
|
in
|
??? passed along to damping code, if scalar is per-mass (as opposed to per-area) then this must be provided for damping to be correct |
None
|
apply_x_flux_divergence(q, q_x_flux)
Update a scalar q according to its flux in the x direction.
apply_y_flux_divergence(q, q_y_flux)
Update a scalar q according to its flux in the x direction.
final_fluxes(q_advected_y_x_advected_mean, q_x_advected_mean, q_advected_x_y_advected_mean, q_y_advected_mean, x_unit_flux, y_unit_flux, x_flux, y_flux)
Compute final x and y fluxes of q from different numerical representations.
Corresponds roughly to eq. 4.17 of FV3 documentation, except that the flux is in units of q rather than in units of q per interface area per time. This corresponds to eq 4.17 with both sides multiplied by e.g. x_unit_flux / u^* (similarly for y/v).
Combining the advection operators in this way is done to cancel leading-order numerical splitting error.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
q_advected_y_x_advected_mean
|
in
|
|
required |
q_x_advected_mean
|
in
|
|
required |
q_advected_x_y_advected_mean
|
in
|
|
required |
q_y_advected_mean
|
in
|
|
required |
x_unit_flux
|
in
|
|
required |
y_unit_flux
|
in
|
|
required |
x_flux
|
out
|
|
required |
y_flux
|
out
|
|
required |
q_i_stencil(q, area, y_area_flux, q_advected_along_y, q_i)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
q
|
in
|
|
required |
area
|
in
|
|
required |
y_area_flux
|
in
|
|
required |
q_advected_along_y
|
in
|
|
required |
q_i
|
out
|
|
required |
q_j_stencil(q, area, x_area_flux, fx2, q_j)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
q
|
in
|
|
required |
area
|
in
|
|
required |
x_area_flux
|
in
|
|
required |
fx2
|
in
|
|
required |
q_j
|
out
|
|
required |