GridapROMs.ParamODEs
This module provides the parametric ODE infrastructure, including time-stepping schemes (θ-method, Generalized-α) and the TimeCombination framework that encodes how each scheme combines contributions from different time levels.
Time combinations
A TimeCombination stores the parameters of an ODE time-marching scheme and provides the coefficients needed to combine snapshots from successive time levels in the reduced-basis context. Each operator in the semi-discrete ODE (stiffness, damping, mass) is assigned a CombinationOrder, which selects the appropriate set of coefficients.
Full API
GridapROMs.ParamODEs — Module
module ParamODEsParametric FE operators and solutions for transient parametric PDEs.
Extends ParamSteady to the time-dependent setting, building on Gridap's ODEs machinery. Key components:
- Time derivatives —
∂ₚtand∂ₚtt, parameter-aware analogues of Gridap's∂t/∂tt, for use inside weak forms. - Transient trial spaces —
TransientTrialParamFESpaceadd time-varying Dirichlet conditions to parametric FE spaces. - ODE operators —
ODEParamOperatortranslates a transient parametric weak form into the residual/Jacobian signature expected by Gridap's time-marching schemes. - Stage operators —
ParamStageOperatorwraps a single ODE stage solve, keeping track of the current time, stage coefficients, and parameter realisation. - Transient FE operators —
TransientParamFEOperatorand specialisations (TransientLinearParamFEOperator, …) combine the spatial FE machinery with time-derivative information. - ODE solutions —
ODEParamSolutioniterates over time steps, yielding(realisation, FEFunction)pairs;TransientParamFESolutionwraps this iterator into aParamFEFunctionper time step.
Modules RBTransient and Extensions depend on the abstractions defined here.
GridapROMs.ParamODEs.CombinationOrder — Type
struct CombinationOrder{A<:TimeCombination, N} <: TimeCombination
combination::A
endWraps a TimeCombination and selects the N-th derivative order for coefficient retrieval. In a $p$-th order ODE, the time-marching scheme produces $p+1$ operators (e.g. stiffness, damping, mass for $p=2$); CombinationOrder{A,N} isolates the coefficients for the $N$-th one.
The type parameter N is a positive integer:
N = 1— zeroth-derivative operator (stiffness $A$).N = 2— first-derivative operator (mass $M$ for first-order; damping for second-order).N = 3— second-derivative operator (mass $M$ for second-order).
Convenience aliases:
ThetaMethodStrategy{N}=CombinationOrder{ThetaMethodCombination, N}GenAlpha1Strategy{N}=CombinationOrder{GenAlpha1Combination, N}GenAlpha2Strategy{N}=CombinationOrder{GenAlpha2Combination, N}
GridapROMs.ParamODEs.GenAlpha1Combination — Type
struct GenAlpha1Combination <: TimeCombination
dt::Real
αf::Real
αm::Real
γ::Real
endTimeCombination for the Generalized-α method for first-order ODEs. Stores dt, αf, αm, and γ.
Two CombinationOrder levels are defined (stiffness and mass/damping).
GridapROMs.ParamODEs.GenAlpha1Strategy — Type
const GenAlpha1Strategy{N} = CombinationOrder{GenAlpha1Combination, N}Specialised alias for CombinationOrder with a GenAlpha1Combination. Orders 1 and 2 correspond to the stiffness and mass/damping operators of a first-order Generalized-α scheme.
GridapROMs.ParamODEs.GenAlpha2Combination — Type
struct GenAlpha2Combination <: TimeCombination
dt::Real
αf::Real
αm::Real
γ::Real
β::Real
endTimeCombination for the Generalized-α method for second-order ODEs (Newmark family). Stores dt, αf, αm, γ, and β.
Three CombinationOrder levels are defined (stiffness, damping, mass).
GridapROMs.ParamODEs.GenAlpha2Strategy — Type
const GenAlpha2Strategy{N} = CombinationOrder{GenAlpha2Combination, N}Specialised alias for CombinationOrder with a GenAlpha2Combination. Orders 1, 2, and 3 correspond to the stiffness, damping, and mass operators of a second-order Generalized-α (Newmark) scheme.
GridapROMs.ParamODEs.LinearNonlinearODEParamOperator — Type
const LinearNonlinearODEParamOperator = ODEParamOperator{LinearNonlinearParamODE}GridapROMs.ParamODEs.LinearNonlinearParamODE — Type
struct LinearNonlinearParamODE <: ODEParamOperatorType endGridapROMs.ParamODEs.LinearParamODE — Type
struct LinearParamODE <: ODEParamOperatorType endGridapROMs.ParamODEs.NonlinearParamODE — Type
struct NonlinearParamODE <: ODEParamOperatorType endGridapROMs.ParamODEs.ODEParamOperator — Type
const ODEParamOperator{O<:ODEParamOperatorType} = ParamOperator{O}Transient extension of the type ParamOperator.
GridapROMs.ParamODEs.ODEParamOperatorType — Type
abstract type ODEParamOperatorType <: UnEvalOperatorType endParametric extension of the type ODEOperatorType in Gridap.
Subtypes:
GridapROMs.ParamODEs.ODEParamSolution — Type
struct ODEParamSolution{V} <: ODESolution
solver::ODESolver
odeop::ODEParamOperator
r::TransientRealisation
us0::Tuple{Vararg{V}}
endGridapROMs.ParamODEs.ParamStageOperator — Type
struct ParamStageOperator <: NonlinearParamOperator
op::ODEParamOperator
r::TransientRealisation
state_update::Function
ws::Tuple{Vararg{Real}}
paramcache::AbstractParamCache
endStage operator to solve a parametric ODE with a time marching scheme
GridapROMs.ParamODEs.ThetaMethodCombination — Type
struct ThetaMethodCombination <: TimeCombination
dt::Real
θ::Real
endTimeCombination for the θ-method applied to a first-order ODE. Stores the time step dt and the implicitness parameter θ.
Two CombinationOrder levels are defined:
- Order 1 (stiffness $A$): coefficients $(\theta,\, 1-\theta)$.
- Order 2 (mass $M$): coefficients $(1/\Delta t,\, -1/\Delta t)$.
GridapROMs.ParamODEs.ThetaMethodStrategy — Type
const ThetaMethodStrategy{N} = CombinationOrder{ThetaMethodCombination, N}Specialised alias for CombinationOrder with a ThetaMethodCombination. N = 1 yields stiffness coefficients $(\theta,\, 1-\theta)$; N = 2 yields mass coefficients $(1/\Delta t,\, -1/\Delta t)$.
GridapROMs.ParamODEs.TimeCombination — Type
abstract type TimeCombination endEncodes how an ODE time-marching scheme combines contributions from different time levels when building a reduced space-time system.
For every ODE solver there is exactly one TimeCombination that stores the scheme parameters (time step, weights, …). Use the constructor
TimeCombination(odesolver::ODESolver)to obtain the appropriate concrete subtype:
| Solver | TimeCombination subtype |
|---|---|
ThetaMethod | ThetaMethodCombination |
GeneralizedAlpha1 | GenAlpha1Combination |
GeneralizedAlpha2 | GenAlpha2Combination |
The per-order time-level weights are accessed through get_coefficients, while time_combination applies the full combination to a parametric solution vector.
See also: CombinationOrder, TransientHyperReduction.
GridapROMs.ParamODEs.TimeMarchingCombination — Type
struct TimeMarchingCombination{A<:TimeCombination} <: TimeCombination
combination::A
endWrapper of a TimeCombination used by ROMs that are reduced in space only, and thus still march in time online
GridapROMs.ParamODEs.TransientLinearParamFEOpFromWeakForm — Type
const TransientLinearParamFEOpFromWeakForm = TransientParamFEOpFromWeakForm{LinearParamODE}GridapROMs.ParamODEs.TransientParamFEOpFromWeakForm — Type
struct TransientParamFEOpFromWeakForm{O<:ODEParamOperatorType} <: TransientParamFEOperator{O}
res::Union{Function,Bundle}
jacs::Tuple{Vararg{Union{Function,Bundle,Nothing}}}
tpspace::TransientParamSpace
assem::Assembler
trial::FESpace
test::FESpace
domains::Union{FEDomains,Bundle}
order::Integer
endInstance of TransientParamFEOperator, used for nonlinear (O=NonlinearParamODE), linear (O=LinearParamODE), and linear+nonlinear split (O=LinearNonlinearParamODE, res/domains a Bundle) transient problems alike. For a split operator, jacs is always a tuple of Bundles of length order+1, one per temporal derivative order; after splitting into get_linear_part/get_nonlinear_part, an entry may be nothing (that order has no linear, resp. no nonlinear, part, e.g. a mass term is purely linear)
GridapROMs.ParamODEs.TransientParamFEOperator — Type
const TransientParamFEOperator{O<:ODEParamOperatorType} = ParamFEOperator{O}Parametric extension of a TransientFEOperator in Gridap. Compared to a standard TransientFEOperator, there are the following novelties:
- a
TransientParamSpaceis provided, so that parametric realisations can be extracted directly from theTransientParamFEOperator - a function representing a norm matrix is provided, so that errors in the desired norm can be automatically computed
Subtypes:
GridapROMs.ParamODEs.TransientParamFEOperator — Method
TransientParamFEOperator(res::Bundle,jacs::Tuple{Vararg{Bundle}},tpspace,trial,test,domains::Bundle=Bundle(FEDomains(),FEDomains())
) -> TransientParamFEOperator{LinearNonlinearParamODE}Returns a transient parametric FE operator that bundles a linear and a nonlinear part. jacs is a plain tuple; individual entries may themselves be a Bundle (see TransientParamFEOpFromWeakForm)
GridapROMs.ParamODEs.TransientParamFESolution — Type
struct TransientParamFESolution{V} <: TransientFESolution
odesol::ODEParamSolution{V}
trial
endWrapper around a TransientParamFEOperator and ODESolver that represents the parametric solution at a set of time steps. It is an iterator that computes the solution at each time step in a lazy fashion when accessing the solution.
GridapROMs.ParamODEs.TransientTrialParamFESpace — Type
const TransientTrialParamFESpace = UnEvalTrialFESpace
TransientTrialParamFESpace(space::SingleFieldFESpace[,dirichlet]) -> UnEvalTrialFESpaceTransient trial space of the test space space, with Dirichlet datum dirichlet (a function (μ,t) -> TransientParamFunction, or a vector of them, one per Dirichlet tag). Without dirichlet, the datum is zero. Evaluate it at a realisation and a time, U(μ,t), to obtain a FE space
GridapROMs.ParamODEs.TransientLinearParamFEOperator — Method
TransientLinearParamFEOperator(res::Function,forms::Tuple{Vararg{Function}}, tpspace,trial,test;kwargs...) -> TransientLinearParamFEOpFromWeakForm
Returns a linear parametric FE operator
GridapROMs.ParamODEs.TransientLinearParamOperator — Method
TransientLinearParamOperator(rhs,jacs,tpspace,trial,test[,domains]) -> ODEParamOperatorLinear transient parametric operator, built from the right-hand side rhs(μ,t,v), the tuple of Jacobians jacs, with respect to u, ∂t(u), ..., in the form jac(μ,t,du,v), a TransientParamSpace tpspace, the trial and test spaces, and optionally the FEDomains on which rhs and jacs are integrated
GridapROMs.ParamODEs.TransientParamOperator — Method
TransientParamOperator(res,jacs,tpspace,trial,test[,domains]) -> ODEParamOperatorTransient parametric operator, built from the residual res(μ,t,u,v), the tuple of Jacobians jacs, with respect to u, ∂t(u), ..., in the form jac(μ,t,u,du,v), a TransientParamSpace tpspace, the trial and test spaces, and optionally the FEDomains on which res and jacs are integrated. When res, the entries of jacs and domains are Bundles, the operator is split into a linear and a nonlinear part
GridapROMs.ParamODEs.add_initial_conditions — Method
add_initial_conditions(solver::ODESolver,odeop::ODEParamOperator,r::TransientRealisation,us0) -> TupleCompletes the initial conditions us0 with the additional states required by the time-marching scheme of solver
GridapROMs.ParamODEs.allocate_spacetime_cache — Method
allocate_spacetime_cache(c,odeop,r,u,us0) -> (usx,paramcache)Like allocate_spacetime_residual/allocate_spacetime_jacobian, but stops short of allocating the residual/jacobian itself. Callers that need to evaluate the weak form anyway (e.g. to then allocate_vector/allocate_matrix from its own vecdata/matdata) should use this instead, to avoid evaluating the same DomainContribution twice: once (discarded) inside allocate_residual/ allocate_jacobian just to learn its shape, and again for the real values
GridapROMs.ParamODEs.allocate_time_combination — Method
allocate_time_combination(u::AbstractVector,us0::Tuple) -> TupleAllocates the output of time_combination
GridapROMs.ParamODEs.get_coefficients — Method
get_coefficients(c::TimeCombination, args...) -> NTuple{N,Real}Return the tuple of coefficients that the combination c uses to weight snapshots at successive time levels. The length of the tuple equals the number of time levels involved (the stencil width of the scheme for the corresponding CombinationOrder).
GridapROMs.ParamODEs.initial_conditions — Method
initial_conditions(sol) -> TupleInitial conditions of the transient solution sol
GridapROMs.ParamODEs.spacetime_jacobian — Method
spacetime_jacobian(c::TimeCombination,odeop::ODEParamOperator,s) -> Tuple
spacetime_jacobian(c::TimeCombination,odeop::ODEParamOperator,r,u,us0) -> TupleSame as spacetime_residual, for the Jacobians of odeop, one per time derivative
GridapROMs.ParamODEs.spacetime_residual — Method
spacetime_residual(c::TimeCombination,odeop::ODEParamOperator,s) -> AbstractParamVector
spacetime_residual(c::TimeCombination,odeop::ODEParamOperator,r,u,us0) -> AbstractParamVectorResiduals of odeop at every time step, evaluated at the states obtained by combining the solution snapshots s (or the values u and the initial conditions us0) according to the time-marching scheme c
GridapROMs.ParamODEs.time_combination! — Method
time_combination!(usx,c::TimeCombination,u,us0) -> TupleIn-place version of time_combination
GridapROMs.ParamODEs.time_combination — Method
time_combination(c::TimeCombination, u, us0) -> NTuple{N,AbstractVector}Apply the time combination c to the parametric solution vector u and the N initial-condition vectors us0. Returns an N-tuple of combined vectors, one per derivative order of the ODE (e.g. $u_{\theta}$ and $\dot{u}_{\theta}$ for a first-order scheme).
GridapROMs.ParamODEs.zero_time_combination! — Method
zero_time_combination!(usx,c::TimeCombination,us0) -> TupleIn-place version of zero_time_combination
GridapROMs.ParamODEs.zero_time_combination — Method
zero_time_combination(c::TimeCombination,u,us0) -> TupleSame as time_combination, with a zero solution u: only the initial conditions us0 contribute. Used in linear problems
GridapROMs.ParamODEs.∂ₚt — Method
∂ₚt(f) -> FunctionTime derivative of a TransientParamFunction, or of a parameterised FE function
GridapROMs.ParamODEs.∂ₚtt — Method
∂ₚtt(f) -> FunctionSecond time derivative of a TransientParamFunction, or of a parameterised FE function
GridapROMs.Utils.get_linear_part — Method
get_linear_part(op::TransientParamFEOpFromWeakForm{LinearNonlinearParamODE}) -> TransientParamFEOpFromWeakForm{LinearParamODE}
get_nonlinear_part(op::TransientParamFEOpFromWeakForm{LinearNonlinearParamODE}) -> TransientParamFEOpFromWeakForm{NonlinearParamODE}jacs is a tuple whose entries are each a Bundle; either half of a given order's Bundle may be nothing (that order has no linear, resp. no nonlinear, part, e.g. a mass term is purely linear). get_linear_part/get_nonlinear_part truncate order to the last non-nothing entry of their respective half, so that code iterating 1:order+1 never indexes into a trailing nothing