DG Balance Law Method

The balance law

ClimateMachine.DGmethods.BalanceLawType
BalanceLaw

An abstract type representing a PDE balance law of the form

elements for balance laws of the form

\[q_{,t} + Σ_{i=1,...d} F_{i,i} = s\]

Subtypes L should define the methods below

source

Continuous Balance Law Formulation

to be filled

Discontinuous Galerkin Method Formulation

to be filled

Examples

Attribution

The style of examples we use here is heavily inspired by JuAFEM.jl

to be filled

Variable specification methods

ClimateMachine.DGmethods.vars_integralsFunction
vars_integrals(::L, FT)

a tuple of symbols containing variables to be integrated along a vertical stack, given a float type FT.

source
vars_integrals(m::AtmosModel, FT)
source
vars_integral(::HBModel)

location to store integrands for bottom up integrals ∇hu = the horizontal divegence of u, e.g. dw/dz

source
ClimateMachine.DGmethods.vars_reverse_integralsFunction
vars_reverse_integrals(::L, FT)

a tuple of symbols containing variables to be integrated along a vertical stack, in reverse, given a float type FT.

source
vars_reverse_integrals(m::AtmosModel, FT)
source
vars_reverse_integral(::HBModel)

location to store integrands for top down integrals αᵀθ = density perturbation

source

Initial condition methods

ClimateMachine.DGmethods.init_state_conservative!Function
init_state_conservative!(
  ::L,
  state_conservative::Vars,
  state_auxiliary::Vars,
  coords,
  args...)

Initialize the conservative state variables at $t = 0$

source
init_state_conservative!(
    m::AtmosModel,
    state::Vars,
    aux::Vars,
    coords,
    t,
    args...)

Initialise state variables. args... provides an option to include configuration data (current use cases include problem constants, spline-interpolants)

source
ClimateMachine.DGmethods.init_state_auxiliary!Function
init_state_auxiliary!(
  ::L,
  state_auxiliary::Vars,
  coords,
  args...)

Initialize the auxiliary state, at $t = 0$

source
init_state_auxiliary!(
    m::AtmosModel,
    aux::Vars,
    geom::LocalGeometry
    )

Initialise auxiliary variables for each AtmosModel subcomponent. Store Cartesian coordinate information in aux.coord.

source
No need to init, initialize by full model
source

Source term kernels

ClimateMachine.DGmethods.flux_first_order!Function
flux_first_order!(
    ::L,
    flux::Grad,
    state_conservative::Vars,
    state_auxiliary::Vars,
    t::Real
)

Compute first-order flux terms in balance law equation

source
flux_first_order!(
    m::AtmosModel,
    flux::Grad,
    state::Vars,
    aux::Vars,
    t::Real
)

Computes and assembles non-diffusive fluxes in the model equations.

source
flux_first_order!(::HBModel)

calculates the hyperbolic flux contribution to state variables this computation is done pointwise at each nodal point

arguments:

m -> model in this case HBModel F -> array of fluxes for each state variable Q -> array of state variables A -> array of aux variables t -> time, not used

computations

∂ᵗu = ∇⋅(g*η + g∫αᵀθdz + v⋅u) ∂ᵗθ = ∇⋅(vθ) where v = (u,v,w)

source
ClimateMachine.DGmethods.flux_second_order!Function
flux_second_order!(
    ::L,
    flux::Grad,
    state_conservative::Vars,
    state_gradient_flux::Vars,
    hyperdiffusive::Vars,
    state_auxiliary::Vars,
    t::Real
)

Compute second-order flux terms in balance law equation

source
flux_second_order!(
    atmos::AtmosModel,
    flux::Grad,
    state::Vars,
    diffusive::Vars,
    hyperdiffusive::Vars,
    aux::Vars,
    t::Real
)

Diffusive fluxes in AtmosModel. Viscosity, diffusivity are calculated in the turbulence subcomponent and accessed within the diffusive flux function. Contributions from subcomponents are then assembled (pointwise).

source
flux_second_order!(::HBModel)

calculates the parabolic flux contribution to state variables this computation is done pointwise at each nodal point

arguments:

  • m: model in this case HBModel
  • F: array of fluxes for each state variable
  • Q: array of state variables
  • D: array of diff variables
  • A: array of aux variables
  • t: time, not used

computations

∂ᵗu = -∇⋅(ν∇u) ∂ᵗθ = -∇⋅(κ∇θ)

source
flux_second_order!(::HBModel)

calculates the parabolic flux contribution to state variables this computation is done pointwise at each nodal point

arguments:

  • m: model in this case HBModel
  • F: array of fluxes for each state variable
  • Q: array of state variables
  • D: array of diff variables
  • A: array of aux variables
  • t: time, not used

computations

∂ᵗu = -∇⋅(ν∇u) ∂ᵗθ = -∇⋅(κ∇θ)

source
ClimateMachine.DGmethods.source!Function
source!(
    ::L,
    source::Vars,
    state_conservative::Vars,
    diffusive::Vars,
    state_auxiliary::Vars,
    t::Real
)

Compute non-conservative source terms in balance law equation

source
source!(
    m::AtmosModel,
    source::Vars,
    state::Vars,
    diffusive::Vars,
    aux::Vars,
    t::Real,
    direction::Direction
)

Computes (and assembles) source terms S(Y) in:

∂Y
-- = - ∇ • F + S(Y)
∂t
source
source!(::HBModel)
calculates the source term contribution to state variables
this computation is done pointwise at each nodal point

arguments:
m -> model in this case HBModel
F -> array of fluxes for each state variable
Q -> array of state variables
A -> array of aux variables
t -> time, not used

computations
∂ᵗu = -f×u
∂ᵗη = w|(z=0)
source

Integral kernels

Gradient/Laplacian kernels

ClimateMachine.DGmethods.compute_gradient_flux!Function
compute_gradient_flux!(
    ::L,
    state_gradient_flux::Vars,
    ∇transformstate::Grad,
    state_auxiliary::Vars,
    t::Real
)

transformation of gradients to the diffusive variables

source
compute_gradient_flux!(::TurbulenceClosure, _...)

Post-gradient-transformed variables specific to turbulence models.

source
compute_gradient_flux!(::HBModel)

copy ∇u and ∇θ to var_diffusive this computation is done pointwise at each nodal point

arguments:

  • m: model in this case HBModel
  • D: array of diffusive variables
  • G: array of gradient variables
  • Q: array of state variables
  • A: array of aux variables
  • t: time, not used
source
compute_gradient_flux!(::LinearHBModel)

copy ν∇u and κ∇θ to var_diffusive this computation is done pointwise at each nodal point

arguments:

  • m: model in this case HBModel
  • D: array of diffusive variables
  • G: array of gradient variables
  • Q: array of state variables
  • A: array of aux variables
  • t: time, not used
source
ClimateMachine.DGmethods.compute_gradient_argument!Function
compute_gradient_argument!(
    ::L,
    transformstate::Vars,
    state_conservative::Vars,
    state_auxiliary::Vars,
    t::Real
)

transformation of state variables to variables of which gradients are computed

source
compute_gradient_argument!

Assign pre-gradient-transform variables specific to turbulence models.

source
compute_gradient_argument!(::HBModel)

copy u and θ to var_gradient this computation is done pointwise at each nodal point

arguments:

  • m: model in this case HBModel
  • G: array of gradient variables
  • Q: array of state variables
  • A: array of aux variables
  • t: time, not used
source
compute_gradient_argument!(::LinearHBModel)

copy u and θ to var_gradient this computation is done pointwise at each nodal point

arguments:

  • m: model in this case HBModel
  • G: array of gradient variables
  • Q: array of state variables
  • A: array of aux variables
  • t: time, not used
source

Auxiliary kernels

ClimateMachine.DGmethods.boundary_state!Function
boundary_state!(
    ::NumericalFluxGradient,
    ::L,
    state_conservative⁺::Vars,
    state_auxiliary⁺::Vars,
    normal⁻,
    state_conservative⁻::Vars,
    state_auxiliary⁻::Vars,
    bctype,
    t
)
boundary_state!(
    ::NumericalFluxFirstOrder,
    ::L,
    state_conservative⁺::Vars,
    state_auxiliary⁺::Vars,
    normal⁻,
    state_conservative⁻::Vars,
    state_auxiliary⁻::Vars,
    bctype,
    t
)
boundary_state!(
    ::NumericalFluxSecondOrder,
    ::L,
    state_conservative⁺::Vars,
    state_gradient_flux⁺::Vars,
    state_auxiliary⁺:
    Vars, normal⁻,
    state_conservative⁻::Vars,
    state_gradient_flux⁻::Vars,
    state_auxiliary⁻::Vars,
    bctype,
    t
)

Apply boundary conditions for

  • NumericalFluxGradient numerical flux (internal method)
  • NumericalFluxFirstOrder first-order unknowns
  • NumericalFluxSecondOrder second-order unknowns
source