OGS
NumLib::TimeDiscretizedODESystem< ODESystemTag::FirstOrderImplicitQuasilinear, NonlinearSolverTag::Picard > Class Referencefinal

Detailed Description

Time discretized first order implicit quasi-linear ODE; to be solved using the Picard fixpoint iteration method for resolving nonlinearities.

See also
ODESystemTag::FirstOrderImplicitQuasilinear

Definition at line 169 of file TimeDiscretizedODESystem.h.

#include <TimeDiscretizedODESystem.h>

Inheritance diagram for NumLib::TimeDiscretizedODESystem< ODESystemTag::FirstOrderImplicitQuasilinear, NonlinearSolverTag::Picard >:
[legend]
Collaboration diagram for NumLib::TimeDiscretizedODESystem< ODESystemTag::FirstOrderImplicitQuasilinear, NonlinearSolverTag::Picard >:
[legend]

Public Types

using ODE = ODESystem<ODETag, NonlinearSolverTag::Picard>
 The type of ODE.
using MatTrans = MatrixTranslator<ODETag>
using TimeDisc = TimeDiscretization
 A shortcut for a general time discretization scheme.

Public Member Functions

 TimeDiscretizedODESystem (const int process_id, ODE &ode, TimeDisc &time_discretization)
 Constructs a new instance.
 ~TimeDiscretizedODESystem () override
void assemble (std::vector< GlobalVector * > const &x_new_timestep, std::vector< GlobalVector * > const &x_prev, int const process_id) override
std::vector< GlobalIndexTypegetIndicesOfResiduumWithoutInitialCompensation () const override
void setReleaseNodalForces (GlobalVector const *r_neq, int const process_id) override
void getA (GlobalMatrix &A) const override
void getRhs (GlobalVector const &x_prev, GlobalVector &rhs) const override
void getAandRhsNormalized (GlobalMatrix &A, GlobalVector &rhs) const override
void computeKnownSolutions (GlobalVector const &x, int const process_id) override
void applyKnownSolutions (GlobalVector &x) const override
void applyKnownSolutionsPicard (GlobalMatrix &A, GlobalVector &rhs, GlobalVector &x, MathLib::DirichletBCApplicationMode const mode) const override
bool isLinear () const override
bool requiresNormalization () const override
void preIteration (const unsigned iter, GlobalVector const &x) override
IterationResult postIteration (GlobalVector const &x) override
TimeDiscgetTimeDiscretization () override
 Exposes the used time discretization scheme.
MathLib::MatrixSpecifications getMatrixSpecifications (const int process_id) const override
MathLib::LinearSolverBehaviour linearSolverNeedsToCompute () const override

Static Public Attributes

static const ODESystemTag ODETag
 A tag indicating the type of ODE.

Private Types

using Index = MathLib::MatrixVectorTraits<GlobalMatrix>::Index

Private Attributes

ODE_ode
 ode the ODE being wrapped
TimeDisc_time_disc
 the time discretization to being used
std::unique_ptr< MatTrans_mat_trans
 the object used to compute the matrix/vector for the nonlinear solver
std::vector< NumLib::IndexValueVector< Index > > const * _known_solutions
 stores precomputed values for known solutions
GlobalMatrix_M
 Matrix \( M \).
GlobalMatrix_K
 Matrix \( K \).
GlobalVector_b
 Matrix \( b \).
std::size_t _M_id = 0u
 ID of the _M matrix.
std::size_t _K_id = 0u
 ID of the _K matrix.
std::size_t _b_id = 0u
 ID of the _b vector.

Member Typedef Documentation

◆ Index

◆ MatTrans

The auxiliary class that computes the matrix/vector used by the nonlinear solver.

Definition at line 182 of file TimeDiscretizedODESystem.h.

◆ ODE

◆ TimeDisc

A shortcut for a general time discretization scheme.

Definition at line 184 of file TimeDiscretizedODESystem.h.

Constructor & Destructor Documentation

◆ TimeDiscretizedODESystem()

NumLib::TimeDiscretizedODESystem< ODESystemTag::FirstOrderImplicitQuasilinear, NonlinearSolverTag::Picard >::TimeDiscretizedODESystem ( const int process_id,
ODE & ode,
TimeDisc & time_discretization )
explicit

Constructs a new instance.

Definition at line 187 of file TimeDiscretizedODESystem.cpp.

190 : _ode(ode),
193{
195 ode.getMatrixSpecifications(process_id), _M_id);
197 ode.getMatrixSpecifications(process_id), _K_id);
199 ode.getMatrixSpecifications(process_id), _b_id);
200}
std::unique_ptr< MatTrans > _mat_trans
the object used to compute the matrix/vector for the nonlinear solver

References _b, _b_id, _K, _K_id, _M, _M_id, _mat_trans, _ode, _time_disc, NumLib::createMatrixTranslator(), ODETag, NumLib::Picard, NumLib::GlobalMatrixProvider::provider, and NumLib::GlobalVectorProvider::provider.

◆ ~TimeDiscretizedODESystem()

Member Function Documentation

◆ applyKnownSolutions()

Definition at line 246 of file TimeDiscretizedODESystem.cpp.

247{
249}
std::vector< NumLib::IndexValueVector< Index > > const * _known_solutions
stores precomputed values for known solutions
void applyKnownSolutions(std::vector< Solutions > const *const known_solutions, Vector &x)
Applies known solutions to the solution vector x.

References _known_solutions, detail::applyKnownSolutions(), applyKnownSolutions(), and NumLib::Picard.

Referenced by applyKnownSolutions().

◆ applyKnownSolutionsPicard()

Definition at line 252 of file TimeDiscretizedODESystem.cpp.

256{
257 if (!_known_solutions)
258 {
259 return;
260 }
261
265 for (auto const& bc : *_known_solutions)
266 {
267 ids.insert(end(ids), begin(bc.ids), end(bc.ids));
268 values.insert(end(values), begin(bc.values), end(bc.values));
269 }
271}
void applyKnownSolution(EigenMatrix &A, EigenVector &b, EigenVector &, const std::vector< EigenMatrix::IndexType > &vec_knownX_id, const std::vector< double > &vec_knownX_x, DirichletBCApplicationMode const mode)

References _known_solutions, MathLib::applyKnownSolution(), and NumLib::Picard.

◆ assemble()

void NumLib::TimeDiscretizedODESystem< ODESystemTag::FirstOrderImplicitQuasilinear, NonlinearSolverTag::Picard >::assemble ( std::vector< GlobalVector * > const & x_new_timestep,
std::vector< GlobalVector * > const & x_prev,
int const process_id )
override

Definition at line 212 of file TimeDiscretizedODESystem.cpp.

216{
217 namespace LinAlg = MathLib::LinAlg;
218
219 auto const t = _time_disc.getCurrentTime();
220 auto const dt = _time_disc.getCurrentTimeIncrement();
221 auto const& x_curr = *x_new_timestep[process_id];
222
223 _M->setZero();
224 _K->setZero();
225 _b->setZero();
226
227 _ode.preAssemble(t, dt, x_curr);
228 _ode.assemble(t, dt, x_new_timestep, x_prev, process_id, *_M, *_K, *_b);
229
233}
void finalizeAssembly(PETScMatrix &A)
Definition LinAlg.cpp:191

References _b, _K, _M, _ode, _time_disc, MathLib::LinAlg::finalizeAssembly(), and NumLib::Picard.

◆ computeKnownSolutions()

void NumLib::TimeDiscretizedODESystem< ODESystemTag::FirstOrderImplicitQuasilinear, NonlinearSolverTag::Picard >::computeKnownSolutions ( GlobalVector const & x,
int const process_id )
override

Definition at line 237 of file TimeDiscretizedODESystem.cpp.

239{
241 _ode.getKnownSolutions(_time_disc.getCurrentTime(), x, process_id);
242}

References _known_solutions, _ode, _time_disc, computeKnownSolutions(), and NumLib::Picard.

Referenced by computeKnownSolutions().

◆ getA()

Definition at line 210 of file TimeDiscretizedODESystem.h.

211 {
212 _mat_trans->computeA(*_M, *_K, A);
213 }

References _K, _M, and _mat_trans.

◆ getAandRhsNormalized()

Definition at line 220 of file TimeDiscretizedODESystem.h.

221 {
222 _mat_trans->normalizeAandRhs(A, rhs);
223 }

References _mat_trans.

◆ getIndicesOfResiduumWithoutInitialCompensation()

std::vector< GlobalIndexType > NumLib::TimeDiscretizedODESystem< ODESystemTag::FirstOrderImplicitQuasilinear, NonlinearSolverTag::Picard >::getIndicesOfResiduumWithoutInitialCompensation ( ) const
inlineoverride
Returns
The global indices for the entries of the global residuum vector that do not need initial non-equilibrium compensation.

Definition at line 199 of file TimeDiscretizedODESystem.h.

200 {
201 return _ode.getIndicesOfResiduumWithoutInitialCompensation();
202 }

References _ode.

◆ getMatrixSpecifications()

Definition at line 252 of file TimeDiscretizedODESystem.h.

254 {
255 return _ode.getMatrixSpecifications(process_id);
256 }

References _ode.

◆ getRhs()

Definition at line 215 of file TimeDiscretizedODESystem.h.

216 {
217 _mat_trans->computeRhs(*_M, *_K, *_b, x_prev, rhs);
218 }

References _b, _K, _M, and _mat_trans.

◆ getTimeDiscretization()

Exposes the used time discretization scheme.

Implements NumLib::TimeDiscretizedODESystemBase< NonlinearSolverTag::Picard >.

Definition at line 251 of file TimeDiscretizedODESystem.h.

251{ return _time_disc; }

References _time_disc.

◆ isLinear()

Definition at line 234 of file TimeDiscretizedODESystem.h.

234{ return _ode.isLinear(); }

References _ode.

◆ linearSolverNeedsToCompute()

Definition at line 258 of file TimeDiscretizedODESystem.h.

259 {
260 if (_ode.shouldLinearSolverComputeOnlyUponTimestepChange() &&
261 _time_disc.getCurrentTimeIncrement() !=
262 _time_disc.getPreviousTimeIncrement())
263 {
265 }
266 if (_ode.shouldLinearSolverComputeOnlyUponTimestepChange() &&
267 _time_disc.getCurrentTimeIncrement() ==
268 _time_disc.getPreviousTimeIncrement())
269 {
271 }
273 }

References _ode, _time_disc, MathLib::RECOMPUTE, MathLib::RECOMPUTE_AND_STORE, and MathLib::REUSE.

◆ postIteration()

Definition at line 246 of file TimeDiscretizedODESystem.h.

247 {
248 return _ode.postIteration(x);
249 }

References _ode.

◆ preIteration()

void NumLib::TimeDiscretizedODESystem< ODESystemTag::FirstOrderImplicitQuasilinear, NonlinearSolverTag::Picard >::preIteration ( const unsigned iter,
GlobalVector const & x )
inlineoverride

Definition at line 241 of file TimeDiscretizedODESystem.h.

242 {
243 _ode.preIteration(iter, x);
244 }

References _ode.

◆ requiresNormalization()

Definition at line 236 of file TimeDiscretizedODESystem.h.

237 {
238 return _ode.requiresNormalization();
239 }

References _ode.

◆ setReleaseNodalForces()

void NumLib::TimeDiscretizedODESystem< ODESystemTag::FirstOrderImplicitQuasilinear, NonlinearSolverTag::Picard >::setReleaseNodalForces ( GlobalVector const * r_neq,
int const process_id )
inlineoverride

Definition at line 204 of file TimeDiscretizedODESystem.h.

206 {
207 _ode.setReleaseNodalForces(r_neq, process_id);
208 }

References _ode.

Member Data Documentation

◆ _b

◆ _b_id

ID of the _b vector.

Definition at line 292 of file TimeDiscretizedODESystem.h.

Referenced by TimeDiscretizedODESystem().

◆ _K

◆ _K_id

ID of the _K matrix.

Definition at line 291 of file TimeDiscretizedODESystem.h.

Referenced by TimeDiscretizedODESystem().

◆ _known_solutions

Initial value:
=
nullptr

stores precomputed values for known solutions

Definition at line 283 of file TimeDiscretizedODESystem.h.

Referenced by applyKnownSolutions(), applyKnownSolutionsPicard(), and computeKnownSolutions().

◆ _M

◆ _M_id

ID of the _M matrix.

Definition at line 290 of file TimeDiscretizedODESystem.h.

Referenced by TimeDiscretizedODESystem().

◆ _mat_trans

the object used to compute the matrix/vector for the nonlinear solver

Definition at line 280 of file TimeDiscretizedODESystem.h.

Referenced by TimeDiscretizedODESystem(), getA(), getAandRhsNormalized(), and getRhs().

◆ _ode

◆ _time_disc

◆ ODETag


The documentation for this class was generated from the following files: