proteus.TimeIntegration module
A class hierarchy of time discretizations
- class proteus.TimeIntegration.TI_base(transport, integrateInterpolationPoints=False)[source]
Bases:
object
The base class for time discretizations of tightly coupled systems of transport equations.
The purpose of time integration objects is to construct approximations:
m_t, dm_t – the time derivatives and their derivatives w.r.t. u u_*, du_* – the solution variables and their derivatives w.r.t. u f_*, df_*,… –the coefficients and their derivatives w.r.t. u
The objects provide a set_dt function for setting the time step as well as functions for SUGGESTING the time step. The StepController objects have the final responsibility for choosing the time step (by calling set_dt).
The objects can also enforce a tolerance on an a posteriori error estimate using the lastStepErrorOK member function.
If any of the coefficient approximations are not implicit, a flag can be set to pass that information to the transport object.
This base class implements no time integration method and results in the steady state scalar transport equation:
deld ( f - a grad phi) + r = 0
NoIntegration is an alias for this class.
Set flags that indicate that all terms are implicit.
- calculateElementCoefficients(q)[source]
Calculate m_t, and dm_t and recalculate any of the other coefficients on element interiors
- calculateElementBoundaryCoefficients(ebq)[source]
Calculate m_t, and dm_t and recalculate any of the other coefficients on element boundaries
- calculateExteriorElementBoundaryCoefficients(ebqe)[source]
Calculate m_t, and dm_t and recalculate any of the other coefficients on global element boundaries
- calculateStrongElementSpatialResidual(q)[source]
Recalculate the part of the element residual due to spatial terms
- calculateElementSpatialResidual(elementResidual)[source]
Recalculate the part of the element residual due to spatial terms
- calculateElementSpatialJacobian(elementJacobian)[source]
Recalculate the part of the element Jacobian due to the spatial terms
- calculateElementSpatialBoundaryJacobian(elementBoundaryJacobian, elementBoundaryJacobian_eb)[source]
Recalculate the part of the element Jacobian due to the spatial terms along element boundaries
- calculateExteriorElementSpatialBoundaryJacobian(exteriorElementBoundaryJacobian)[source]
Recalculate the part of the element Jacobian due to the spatial terms along element boundaries
- calculateGeneralizedInterpolationCoefficients(cip)[source]
Calculate m_t, and dm_t and recalculate any of the other coefficients on element interiors
- initializeTimeHistory(resetFromDOF=True)[source]
Push necessary information into time history arrays
- proteus.TimeIntegration.NoIntegration[source]
alias of
proteus.TimeIntegration.TI_base
- class proteus.TimeIntegration.BackwardEuler(transport, integrateInterpolationPoints=False)[source]
Bases:
proteus.TimeIntegration.TI_base
Set flags that indicate that all terms are implicit.
- calculateElementCoefficients(q)[source]
Calculate m_t, and dm_t and recalculate any of the other coefficients on element interiors
- calculateGeneralizedInterpolationCoefficients(cip)[source]
Calculate m_t, and dm_t and recalculate any of the other coefficients on element interiors
- class proteus.TimeIntegration.BackwardEuler_cfl(transport, runCFL=0.9, integrateInterpolationPoints=False)[source]
Bases:
proteus.TimeIntegration.BackwardEuler
Take a fraction of the max (over all components and elements)
Set flags that indicate that all terms are implicit.
- class proteus.TimeIntegration.SSP(transport, runCFL=0.9, integrateInterpolationPoints=False)[source]
Bases:
proteus.TimeIntegration.BackwardEuler_cfl
Set flags that indicate that all terms are implicit.
- class proteus.TimeIntegration.FLCBDF(transport)[source]
Bases:
proteus.TimeIntegration.TI_base
Set flags that indicate that all terms are implicit.
- initializeTimeHistory(resetFromDOF=False)[source]
Push necessary information into time history arrays
- calculateElementCoefficients(q)[source]
Calculate m_t, and dm_t and recalculate any of the other coefficients on element interiors
- class proteus.TimeIntegration.PsiTCtte(transport)[source]
Bases:
proteus.TimeIntegration.BackwardEuler_cfl
Set flags that indicate that all terms are implicit.
- initializeTimeHistory(resetFromDOF=True)[source]
Push necessary information into time history arrays
- class proteus.TimeIntegration.PsiTCtte_new(transport)[source]
Bases:
proteus.TimeIntegration.BackwardEuler
Set flags that indicate that all terms are implicit.
- class proteus.TimeIntegration.ForwardEuler(transport, runCFL=0.45)[source]
Bases:
proteus.TimeIntegration.TI_base
Set flags that indicate that all terms are implicit.
- calculateElementSpatialJacobian(elementJacobian)[source]
Recalculate the part of the element Jacobian due to the spatial terms
- calculateElementBoundaryCoefficients(ebq)[source]
Calculate m_t, and dm_t and recalculate any of the other coefficients on element boundaries do I need these to be synchronized with q or do the elementBoundary quad values get lagged in the spatial residual
- calculateElementSpatialBoundaryJacobian(elementBoundaryJacobian, elementBoundaryJacobian_eb)[source]
Recalculate the part of the element Jacobian due to the spatial terms along element boundaries
- calculateExteriorElementSpatialBoundaryJacobian(elementBoundaryJacobian)[source]
Recalculate the part of the element Jacobian due to the spatial terms along element boundaries
- calculateElementCoefficients(q)[source]
Calculate m_t, and dm_t and recalculate any of the other coefficients on element interiors
- calculateStrongElementSpatialResidual(q)[source]
Recalculate the part of the element residual due to spatial terms
- class proteus.TimeIntegration.ForwardEuler_A(transport, runCFL=0.45, limiterType=None)[source]
Bases:
proteus.TimeIntegration.TI_base
Set flags that indicate that all terms are implicit.
- calculateElementCoefficients(q)[source]
Calculate m_t, and dm_t and recalculate any of the other coefficients on element interiors
- calculateElementBoundaryCoefficients(ebq)[source]
Calculate m_t, and dm_t and recalculate any of the other coefficients on element boundaries
- class proteus.TimeIntegration.ForwardEuler_H(transport, runCFL=0.45)[source]
Bases:
proteus.TimeIntegration.TI_base
Set flags that indicate that all terms are implicit.
- calculateElementCoefficients(q)[source]
Calculate m_t, and dm_t and recalculate any of the other coefficients on element interiors
- calculateElementBoundaryCoefficients(ebq)[source]
Calculate m_t, and dm_t and recalculate any of the other coefficients on element boundaries
- calculateElementSpatialResidual(elementResidual)[source]
Recalculate the part of the element residual due to spatial terms
- class proteus.TimeIntegration.OuterTheta(transport, runCFL=0.9, thetaAdvection=0.5, thetaDiffusion=0.5, thetaReaction=0.5, thetaHamiltonian=0.5)[source]
Bases:
proteus.TimeIntegration.TI_base
Set flags that indicate that all terms are implicit.
- calculateElementCoefficients(q)[source]
Calculate m_t, and dm_t and recalculate any of the other coefficients on element interiors
- class proteus.TimeIntegration.VBDF(transport, timeOrder=2, integrateInterpolationPoints=False)[source]
Bases:
proteus.TimeIntegration.TI_base
Variable coefficient bdf’s just first and second order
Set flags that indicate that all terms are implicit.
- calculateElementCoefficients(q)[source]
Calculate m_t, and dm_t and recalculate any of the other coefficients on element interiors
- initialize_dt(t0, tOut, q)[source]
This routine is bad right now, because we don’t want to compute an internal dt anymore just the error estimates
Controller now has to take care of self.t and self.dt
- choose_dt()[source]
This routine is bad right now, because we don’t want to compute an internal dt anymore just the error estimates
Controller now has to take care of self.t and self.dt
- setInitialGuess()[source]
set an initial guess for the next step need to figure out how to synchronize this
predictor necessary for error estimates
- lastStepErrorOk()[source]
was the last time step acceptable or not This routine now just computes the error estimate …
- initializeTimeHistory(resetFromDOF=True)[source]
Push necessary information into time history arrays
- postAdaptUpdate(oldTime)[source]
This looks exactly like updateTimeHistory with the exeption of setting self.tLast=self.t
- computeErrorEstimate()[source]
calculate :math:` ec{e}^{n+1}`
depending on order of approximation To be consistent, this must be called after step taken but before update time history
Initially, use
\[(\]ec y^{n+1}- ec y^{n+1,p})/2
for first order and
ec y^{n+1}-(1+r) ec y^{n}+r ec y^{n-1})
for second order.
- class proteus.TimeIntegration.ExplicitRK_base(transport, timeOrder=1, nStages=1, runCFL=0.1, usingDTinMass=True)[source]
Bases:
proteus.TimeIntegration.TI_base
base class for explicit RK schemes which can be written in the Shu Osher 88 (Cockburn Shu 89) style generic formula
u^0 = u^n u^l = sum_{k=0}^{l-1}lpha_{l,k}u^k + eta_{l,k} Delta t L(u^{k},t^n + d_{k} Delta t^n) u^{n+1} = u^{m}
We will try to include these schemes in a Rothe framework rather than MOL
so in calculate element coefficients, at stage number l, u_t will be replaced with
u_t –> (u - sum_{k=0}^{l-1} lpha_{l,k} u^k)/Delta t
or
u_t –> (u - sum_{k=0}^{l-1} lpha_{l,k} u^k)
depending on whether Delta t is assumed to be in the mass matrix or not
The spatial residual at stage l will be replaced with (in calculateElementSpatialResidual)
r –> sum_{k=0,l-1} eta_{l,k} r_k
or
r –> Delta t sum_{k=0,l-1} eta_{l,k} r_k
depending on whether Delta t is assumed to be in the mass matrix or not Here r_k corresponds to
L(u^{k},t^n + d_{k} Delta t^n)
Substeps in NumericalSolution framework correspond to stage values in the RK integration. These are setup in generateSubsteps. The indexing is a little confusing, since the residuals are ‘cached’ when they come into calculateElementResidual in order to be used at the next stage. This means the time levels in substep have to be for the following stage level. This is modulo the number of stages so t^{n+1} at the last stage –> t^n for the next time step
Set flags that indicate that all terms are implicit.
- setCoefficients()[source]
set alpha,beta, d for
\[u^0 = u^n u^l = \sum_{k=0}^{l-1}lpha_{l,k}u^k + eta_{l,k} \Delta t L(u^{k},t^n + d_{k} \Delta t^n) u^{n+1} = u^{m}\]must be implemented in derived class
Note that
\[alpha[l,k] --> alpha_{l+1,k} beta[l,k] --> beta_{l+1,k} dcoefs[k] --> d_{k+1}\]because of the whole cachingdelayed eval deal second index (k) is actual level
- calculateElementCoefficients(q)[source]
set m_t as
m_t –> (m - sum_{k=0}^{l-1} lpha_{l,k} m^k)/Delta t
- calculateElementCoefficientsNoDtInMass(q)[source]
set m_t as
m_t –> (m - sum_{k=0}^{l-1} lpha_{l,k} m^k)
- calculateElementSpatialResidual(elementResidual)[source]
The spatial residual at stage l will be replaced with (in calculateElementSpatialResidual)
r –> sum_{k=0,l-1} eta_{l,k} r_k
- calculateElementSpatialResidualNoDtInMass(elementResidual)[source]
The spatial residual at stage l will be replaced with (in calculateElementSpatialResidual)
r –> Delta t sum_{k=0,l-1} eta_{l,k} r_k
- calculateElementSpatialJacobian(elementJacobian)[source]
Recalculate the part of the element Jacobian due to the spatial terms
- calculateElementBoundaryCoefficients(ebq)[source]
Calculate m_t, and dm_t and recalculate any of the other coefficients on element boundaries do I need these to be synchronized with q or do the elementBoundary quad values get lagged in the spatial residual
- calculateElementSpatialBoundaryJacobian(elementBoundaryJacobian, elementBoundaryJacobian_eb)[source]
Recalculate the part of the element Jacobian due to the spatial terms along element boundaries
- calculateExteriorElementSpatialBoundaryJacobian(elementBoundaryJacobian)[source]
Recalculate the part of the element Jacobian due to the spatial terms along element boundaries
- generateSubsteps(tList)[source]
create list of substeps over time values given in tList. These correspond to stages so need to have the right number set. For the SSP RK schemes here, t^m = t^{n+1} for all the stages except the first, I believe
The order here is a little confusing. Since the residuals are ‘cached’ when they come into calculateElementResidual in order to be used at the next stage, the time levels have to be for the next stage This is modulo the number of stages so t^{n+1} at the last stage –> t^n for the next time step
- setInitialStageValues()[source]
setup all the stage values if we assume that the initial condition has been loaded into lstage+1
- class proteus.TimeIntegration.LinearSSPRKintegration(transport, order=1, runCFL=0.1, usingSSPRKNewton=False)[source]
Bases:
proteus.TimeIntegration.ExplicitRK_base
implementation of Explicit RK schemes for ODE that are SSP for linear operators (aka) spatial discretizations in
\[\od{\]ec y}{t} = mat{L} ec y
See Gottlieb, Shu, Tadmor siam review article and notes
Their formulation for this scheme is
\[ \begin{align}\begin{aligned}u^0 = u^n u^l = u^{l-1} + \Delta t L(u^{l-1}) l = 1,...,m-1 u^m = \sum_{k=0}^{l-1}lpha_{m,k}u^k + lpha_{m,m-1} \Delta t L(u^{m-1}) u^{n+1} = u^m\\so lpha_{l,l-1} = 1, eta_{l,l-1} = 1.0 l < m, eta_{m,m-1} = lph_{m,m-1}\end{aligned}\end{align} \]Apparently,
\[d_{l} = l \Delta t l < m, d_m = 1.0\]which doesn’t make a lot of sense for time dependent problems
Set flags that indicate that all terms are implicit.
- setCoefficients()[source]
alpha matrix in Gottlieb, Shu, Tadmor review paper
u^{l} = sum_{k=0}^{l-1}lpha_{l,k}u^k
so lpha_{l,l-1} = 1 for l < m
- beta matrix multiplies
eta_{l,k} Delta t L(u^{k},t^n + d_{k} Delta t^n)
- so
eta_{l,l-1} = 1.0 for l < m eta_{m,m-1} = lpha_{m,m-1}
- Note that
alpha[l,k] –> alpha_{l+1,k} beta[l,k] –> beta_{l+1,k} dcoefs[k] –> d_{k+1} because of the whole cachingdelayed eval deal
second index (k) is actual level
- class proteus.TimeIntegration.SSPRKPIintegration(transport, order=1, runCFL=0.1, limiterType=None, usingSSPRKNewton=False)[source]
Bases:
proteus.TimeIntegration.ExplicitRK_base
- So called SSP RK integration with limiting step at end of each
phase This one holds the original TVD RK schemes up to 3rd order 1st order is Forward Euler
2nd order
\[u^1 = u^n + \Delta t L(u^n) u^2 = 0.5(u^n + u^1) + 0.5\Delta t L(u^1,t^n + \Delta t^n), same stage values etc linear SSPRK\]3rd order
\[u^1 = u^n + \Delta t L(u^n,t^n) u^2 = 0.75 u^n + 0.25u^1 + 0.25\Delta t L(u^1,t^n + \Delta t^n), u^3 = 1/3 u^n + 2/3 u^2 + 2/3 \Delta t L(u^2,t^n + 0.5\Delta t^n)\]generic formula is
\[u^0 = u^n u^l = \sum_{k=0}^{l-1}lpha_{l,k}u^k + eta_l \Delta t L(u^{l-1},t^n + d_{l-1} \Delta t^n) u^{n+1} = u^{m}\]so \(beta_l --> beta_{l,k-1}\) in our basic framework
Try to put this into Rothe paradigm with linear implicit mass matrix evaluation by saying at stage l
\[m_t pprox\]
rac{u^l - sum_{k=0}^{l-1}lpha_{l,k}u^k}{Delta t}
spatial residual –> spatial residual * beta_l
and solve system for \(u^l\)
The limiting right now assumes same space for each component
Set flags that indicate that all terms are implicit.
- class proteus.TimeIntegration.LinearSSPRKPIintegration(transport, order=1, runCFL=0.1, limiterType=None, usingSSPRKNewton=False)[source]
Bases:
proteus.TimeIntegration.LinearSSPRKintegration
Linear SSP RK integration with limiting step at end of each phase, this one just uses linear SSP RK coefficients so not really correct NL SSP (TVD) RK for 3rd order (or higher)
Way limiter right now assumes same space for everything
Later on, pass in limiter object I guess
- class proteus.TimeIntegration.DGlimiterP1Lagrange1d(mesh, nSpace, u, transport=None, limiterFlag=0)[source]
Bases:
object
canonical (I hope) 1d DG limiting procedure when original local approximation space has P1 Lagrange basis assumes all solution fem spaces are identical
- class proteus.TimeIntegration.DGlimiterP2Lagrange1d(mesh, nSpace, u, transport=None, limiterFlag=0)[source]
Bases:
object
canonical (I hope) 1d DG limiting procedure when original local approximation space has P2 Lagrange basis
- projectToLimitedSpace(solndofs, ci=0)[source]
project fem function from femSpaceSolution with dofs held in solndofs to ulim which is DG_AffineQuadraticOnSimplexWithNodalBasis
nodal interpolant will not preserve mass necessarily
- class proteus.TimeIntegration.DGlimiterPkMonomial1d(mesh, nSpace, u, transport=None, limiterFlag=0)[source]
Bases:
object
canonical (I hope) 1d DG limiting procedure when original local approximation space has Pk monomial basis
- projectToLimitedSpace(solndofs, ci=0)[source]
project fem function from femSpaceSolution with dofs held in solndofs to ulim which is DG_LinearQuadraticOnSimplexWithNodalBasis
try more or less generic L2 projection on reference element
- class proteus.TimeIntegration.DGlimiterP1Lagrange2d(mesh, nSpace, u, transport=None, nu=1.5, M=0.0)[source]
Bases:
proteus.TimeIntegration.CockburnNotesLimiter2d_base
apply standard, Cockburn RKDG limiter in 2d (maybe)
- class proteus.TimeIntegration.DGlimiterP2Lagrange2d(mesh, nSpace, u, transport=None, nu=1.5, M=0.0)[source]
Bases:
proteus.TimeIntegration.CockburnNotesLimiter2d_base
canonical (I hope) 2d DG limiting procedure when original local approximation space has P2 Lagrange basis go ahead and use a generic L2 projection though
- TODO
move projection steps to c
- projectToLimitedSpace(solndofs, ci=0)[source]
project fem function from femSpaceSolution with dofs held in solndofs to ulim which is DG_AffineLinearOnSimplexWithNodalBasis
try more or less generic L2 projection on reference element
- class proteus.TimeIntegration.DGlimiterPkMonomial2d(mesh, nSpace, u, transport=None, nu=1.5, M=0.0)[source]
Bases:
proteus.TimeIntegration.CockburnNotesLimiter2d_base
canonical (I hope) 2d DG limiting procedure when original local approximation space has Pk monomial basis
- projectToLimitedSpace(solndofs, ci=0)[source]
project fem function from femSpaceSolution with dofs held in solndofs to ulim which is DG_AffineQuadraticOnSimplexWithNodalBasis
try more or less generic L2 projection on reference element
- class proteus.TimeIntegration.DGlimiterDurlofskyP1Lagrange2d(mesh, nSpace, u, transport=None, killExtrema=1, allowMinWithUndershoot=0)[source]
- class proteus.TimeIntegration.DGlimiterDurlofskyP1Lagrange3d(mesh, nSpace, u, transport=None, killExtrema=1, allowMinWithUndershoot=1)[source]
- class proteus.TimeIntegration.DGlimiterP1Lagrange1d_Sw(mesh, nSpace, u, transport=None, limiterFlag=0, h_eps=0.001)[source]
Bases:
proteus.TimeIntegration.DGlimiterP1Lagrange1d
- DGP1 version of limiting that applies minmod limiting for h < h_eps
and more aggressive limiting elsewhere
- applySlopeLimiting(uIn, uDofOut)[source]
Apply limiting procedure directly using dofs using standard approach Then go through and eliminate negative values of water height
for cells that have average (h_bar < h_eps)
if average height is negative, then zero
if both vertices are positive leave alone (could kill slope)
if one of the vertices is negative choose slope so that this value is exactly zero
zero discharge at this vertex
May need to add additional step that limits discharge where h is much less than h_eps
- class proteus.TimeIntegration.DGlimiterP2Lagrange1d_Sw(mesh, nSpace, u, transport=None, limiterFlag=0, h_eps=0.01)[source]
Bases:
proteus.TimeIntegration.DGlimiterP2Lagrange1d
- DGP1 version of limiting that applies minmod limiting for h < h_eps
and more aggressive limiting elsewhere
- applySlopeLimiting(uIn, uDofOut)[source]
Apply limiting procedure directly using dofs using standard approach Then go through and eliminate negative values of water height
for cells that have average (h_bar < h_eps)
if average height is negative, then zero
if both vertices are positive leave alone (could kill slope)
if one of the vertices is negative, choose slope so that this value is exactly zero, zero discharge at this vertex
May need to add additional step that limits discharge where h is much less than h_eps
- class proteus.TimeIntegration.DGlimiterPkMonomial1d_Sw(mesh, nSpace, u, transport=None, limiterFlag=0, h_eps=0.1)[source]
Bases:
proteus.TimeIntegration.DGlimiterPkMonomial1d
- DGPk version of limiting that applies minmod limiting for h < h_eps
and more aggressive limiting elsewhere
- class proteus.TimeIntegration.DGlimiterDurlofskyP1Lagrange2d_Sw(mesh, nSpace, u, transport=None, killExtrema=1, allowMinWithUndershoot=0, h_eps=0.02)[source]
Bases:
proteus.TimeIntegration.DGlimiterDurlofskyP1Lagrange2d
- class proteus.TimeIntegration.ForwardIntegrator(mlvtran, mlnl, dtMeth, nOptions, stepExact=False)[source]
Bases:
object
class that is responsible for basic process of integrating a problem forward in time given a VectorTranport Problem, Nonlinear Solver, and a Time Integration method
mlvTran — multilevel vector transport object for system being integrated mlNL — multilevel nonlinear solver to solve discrete system dtMet — time integration method to use nOptions — configuration options
- class proteus.TimeIntegration.SteadyStateIntegrator(mlvtran, mlnl, dtMeth, nOptions, ssatol=0.001, ssrtol=0.001, maxsteps=50, stepExact=True, ignoreFailure=False)[source]
Bases:
proteus.TimeIntegration.ForwardIntegrator
apply some form of pseudo-transient continuation or direct solve to compute steady state solution regardless of requested time step
mlvTran — multilevel vector transport object for system being integrated mlNL — multilevel nonlinear solver to solve discrete system dtMet — time integration method to use nOptions — configuration options
- class proteus.TimeIntegration.SignedDistanceIntegrator(mlvtran, mlnl, dtMeth, nOptions, stepExact=False, nSteps=3)[source]
Bases:
proteus.TimeIntegration.ForwardIntegrator
apply some form of pseudo-transient continuation or direct solve to compute steady state solution regardless of requested time step
mlvTran — multilevel vector transport object for system being integrated mlNL — multilevel nonlinear solver to solve discrete system dtMet — time integration method to use nOptions — configuration options
- class proteus.TimeIntegration.FLCBDF_TwophaseDarcy_fc(transport)[source]
Bases:
proteus.TimeIntegration.FLCBDF
Set flags that indicate that all terms are implicit.
- class proteus.TimeIntegration.CentralDifference_2ndD(transport, integrateInterpolationPoints=False)[source]
Bases:
proteus.TimeIntegration.TI_base
Set flags that indicate that all terms are implicit.
- calculateElementCoefficients(q)[source]
Calculate m_t, and dm_t and recalculate any of the other coefficients on element interiors
- calculateGeneralizedInterpolationCoefficients(cip)[source]
Calculate m_t, and dm_t and recalculate any of the other coefficients on element interiors