MFEM v4.8.0
Finite element discretization library
Loading...
Searching...
No Matches
mfem::PetscODESolver Class Reference

Abstract class for PETSc's ODE solvers. More...

#include <petsc.hpp>

Inheritance diagram for mfem::PetscODESolver:
[legend]
Collaboration diagram for mfem::PetscODESolver:
[legend]

Public Types

enum  Type { ODE_SOLVER_LINEAR , ODE_SOLVER_GENERAL }
 

Public Member Functions

 PetscODESolver (MPI_Comm comm, const std::string &prefix=std::string())
 
virtual ~PetscODESolver ()
 
virtual void Init (TimeDependentOperator &f_, enum PetscODESolver::Type type)
 Initialize the ODE solver.
 
virtual void Init (TimeDependentOperator &f_)
 Associate a TimeDependentOperator with the ODE solver.
 
void SetType (PetscODESolver::Type)
 
PetscODESolver::Type GetType () const
 
void SetJacobianType (Operator::Type type)
 
virtual void Step (Vector &x, real_t &t, real_t &dt)
 Perform a time step from time t [in] to time t [out] based on the requested step size dt [in].
 
virtual void Run (Vector &x, real_t &t, real_t &dt, real_t t_final)
 Perform time integration from time t [in] to time tf [in].
 
 operator petsc::TS () const
 Conversion function to PETSc's TS type.
 
- Public Member Functions inherited from mfem::PetscSolver
 PetscSolver ()
 Construct an empty PetscSolver. Initialize protected objects to NULL.
 
virtual ~PetscSolver ()
 Destroy the PetscParVectors allocated (if any).
 
void Customize (bool customize=true) const
 Customize object with options set.
 
int GetConverged ()
 
int GetNumIterations ()
 
real_t GetFinalNorm ()
 
void SetMonitor (PetscSolverMonitor *ctx)
 Sets user-defined monitoring routine.
 
void SetBCHandler (PetscBCHandler *bch)
 Sets the object to handle essential boundary conditions.
 
void SetPreconditionerFactory (PetscPreconditionerFactory *factory)
 Sets the object for the creation of the preconditioner.
 
 operator PetscObject () const
 Conversion function to PetscObject.
 
MPI_Comm GetComm () const
 Get the associated MPI communicator.
 
void SetTol (real_t tol)
 
void SetRelTol (real_t tol)
 
void SetAbsTol (real_t tol)
 
void SetMaxIter (int max_iter)
 
void SetPrintLevel (int plev)
 
- Public Member Functions inherited from mfem::ODESolver
 ODESolver ()
 
virtual int GetStateSize ()
 Returns how many State vectors the ODE requires.
 
virtual ~ODESolver ()
 

Additional Inherited Members

- Static Public Member Functions inherited from mfem::ODESolver
static MFEM_EXPORT std::unique_ptr< ODESolver > Select (const int ode_solver_type)
 
static MFEM_EXPORT std::unique_ptr< ODESolver > SelectExplicit (const int ode_solver_type)
 
static MFEM_EXPORT std::unique_ptr< ODESolver > SelectImplicit (const int ode_solver_type)
 
- Static Public Attributes inherited from mfem::ODESolver
static MFEM_EXPORT std::string ExplicitTypes
 
static MFEM_EXPORT std::string ImplicitTypes
 
static MFEM_EXPORT std::string Types
 
- Protected Member Functions inherited from mfem::PetscSolver
void CreatePrivateContext ()
 
void FreePrivateContext ()
 
- Protected Attributes inherited from mfem::PetscSolver
bool clcustom
 Boolean to handle SetFromOptions calls.
 
PetscObject obj
 The actual PETSc object (KSP, PC, SNES or TS).
 
PetscClassId cid
 The class id of the actual PETSc object.
 
PetscParVector * B
 Right-hand side and solution vector.
 
PetscParVector * X
 
PetscBCHandler * bchandler
 Handler for boundary conditions.
 
void * private_ctx
 Private context for solver.
 
bool operatorset
 Boolean to handle SetOperator calls.
 
- Protected Attributes inherited from mfem::ODESolver
TimeDependentOperator * f
 Pointer to the associated TimeDependentOperator.
 
MemoryType mem_type
 

Detailed Description

Abstract class for PETSc's ODE solvers.

Definition at line 949 of file petsc.hpp.

Member Enumeration Documentation

◆ Type

The type of the ODE. Use ODE_SOLVER_LINEAR if the Jacobians are linear and independent of time.

Enumerator
ODE_SOLVER_LINEAR 
ODE_SOLVER_GENERAL 

Definition at line 954 of file petsc.hpp.

Constructor & Destructor Documentation

◆ PetscODESolver()

mfem::PetscODESolver::PetscODESolver ( MPI_Comm comm,
const std::string & prefix = std::string() )

Definition at line 4159 of file petsc.cpp.

◆ ~PetscODESolver()

mfem::PetscODESolver::~PetscODESolver ( )
virtual

Definition at line 4184 of file petsc.cpp.

Member Function Documentation

◆ GetType()

PetscODESolver::Type mfem::PetscODESolver::GetType ( ) const

Definition at line 4281 of file petsc.cpp.

◆ Init() [1/2]

virtual void mfem::PetscODESolver::Init ( TimeDependentOperator & f_)
inlinevirtual

Associate a TimeDependentOperator with the ODE solver.

This method has to be called:

Reimplemented from mfem::ODESolver.

Definition at line 966 of file petsc.hpp.

◆ Init() [2/2]

void mfem::PetscODESolver::Init ( TimeDependentOperator & f_,
enum PetscODESolver::Type type )
virtual

Initialize the ODE solver.

Definition at line 4192 of file petsc.cpp.

◆ operator petsc::TS()

mfem::PetscODESolver::operator petsc::TS ( ) const
inline

Conversion function to PETSc's TS type.

Definition at line 979 of file petsc.hpp.

◆ Run()

void mfem::PetscODESolver::Run ( Vector & x,
mfem::real_t & t,
mfem::real_t & dt,
mfem::real_t tf )
virtual

Perform time integration from time t [in] to time tf [in].

Parameters
[in,out]xApproximate solution.
[in,out]tTime associated with the approximate solution x.
[in,out]dtTime step size.
[in]tfRequested final time.

The default implementation makes consecutive calls to Step() until reaching tf. The following rules describe the common behavior of the method:

  • The input x [in] is the approximate solution for the input time t [in].
  • The input dt [in] is the initial time step size.
  • The output dt [out] is the last time step taken by the method which may be smaller or larger than the input dt [in] value, e.g. because of time step control.
  • The output value of t [out] is not smaller than tf [in].

Reimplemented from mfem::ODESolver.

Definition at line 4343 of file petsc.cpp.

◆ SetJacobianType()

void mfem::PetscODESolver::SetJacobianType ( Operator::Type type)

Specifies the desired format of the Jacobian in case a PetscParMatrix is not returned by the GetGradient methods

Definition at line 4275 of file petsc.cpp.

◆ SetType()

void mfem::PetscODESolver::SetType ( PetscODESolver::Type type)

Definition at line 4287 of file petsc.cpp.

◆ Step()

void mfem::PetscODESolver::Step ( Vector & x,
real_t & t,
real_t & dt )
virtual

Perform a time step from time t [in] to time t [out] based on the requested step size dt [in].

Parameters
[in,out]xApproximate solution.
[in,out]tTime associated with the approximate solution x.
[in,out]dtTime step size.

The following rules describe the common behavior of the method:

  • The input x [in] is the approximate solution for the input time t [in].
  • The input dt [in] is the desired time step size, defining the desired target time: t [target] = t [in] + dt [in].
  • The output x [out] is the approximate solution for the output time t [out].
  • The output dt [out] is the last time step taken by the method which may be smaller or larger than the input dt [in] value, e.g. because of time step control.
  • The method may perform more than one time step internally; in this case dt [out] is the last internal time step size.
  • The output value of t [out] may be smaller or larger than t [target], however, it is not smaller than t [in] + dt [out], if at least one internal time step was performed.
  • The value x [out] may be obtained by interpolation using internally stored data.
  • In some cases, the contents of x [in] may not be used, e.g. when x [out] from a previous Step() call was obtained by interpolation.
  • In consecutive calls to this method, the output t [out] of one Step() call has to be the same as the input t [in] to the next Step() call.
  • If the previous rule has to be broken, e.g. to restart a time stepping sequence, then the ODE solver must be re-initialized by calling Init() between the two Step() calls.

Implements mfem::ODESolver.

Definition at line 4305 of file petsc.cpp.


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