v0.15.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
MoFEM::SnesMethod Struct Reference

Data structure for SNES (nonlinear solver) context. More...

#include "src/interfaces/LoopMethods.hpp"

Inheritance diagram for MoFEM::SnesMethod:
[legend]
Collaboration diagram for MoFEM::SnesMethod:
[legend]

Public Types

enum  SNESContext { CTX_SNESSETFUNCTION , CTX_SNESSETJACOBIAN , CTX_SNESNONE }
 Context enumeration for SNES solver phases. More...
 

Public Member Functions

MoFEMErrorCode query_interface (boost::typeindex::type_index type_index, UnknownInterface **iface) const
 Query interface for type casting.
 
 SnesMethod ()
 Default constructor.
 
virtual ~SnesMethod ()=default
 Virtual destructor.
 
MoFEMErrorCode copySnes (const SnesMethod &snes)
 Copy SNES data from another instance.
 

Public Attributes

SNESContext snes_ctx
 Current SNES computation context.
 
SNES snes
 PETSc SNES nonlinear solver object.
 
Vec & snes_x
 Reference to current solution state vector.
 
Vec & snes_dx
 Reference to solution update/increment vector.
 
Vec & snes_f
 Reference to residual vector.
 
Mat & snes_A
 Reference to Jacobian matrix.
 
Mat & snes_B
 Reference to preconditioner of Jacobian matrix.
 

Additional Inherited Members

- Protected Types inherited from MoFEM::PetscData
enum  DataContext {
  CTX_SET_NONE = 0 , CTX_SET_F = 1 << 0 , CTX_SET_A = 1 << 1 , CTX_SET_B = 1 << 2 ,
  CTX_SET_X = 1 << 3 , CTX_SET_DX = 1 << 4 , CTX_SET_X_T = 1 << 5 , CTX_SET_X_TT = 1 << 6 ,
  CTX_SET_TIME = 1 << 7
}
 Enumeration for data context flags. More...
 
using Switches = std::bitset< 8 >
 Bitset type for context switches.
 
- Protected Member Functions inherited from MoFEM::PetscData
 PetscData ()
 Default constructor.
 
virtual ~PetscData ()=default
 Virtual destructor.
 
MoFEMErrorCode copyPetscData (const PetscData &petsc_data)
 Copy PETSc data from another instance.
 
- Protected Member Functions inherited from MoFEM::UnknownInterface
template<class IFACE >
MoFEMErrorCode registerInterface (bool error_if_registration_failed=true)
 Register interface.
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE *&iface) const
 Get interface reference to pointer of interface.
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE **const iface) const
 Get interface pointer to pointer of interface.
 
template<class IFACE , typename boost::enable_if< boost::is_pointer< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get interface pointer to pointer of interface.
 
template<class IFACE , typename boost::enable_if< boost::is_reference< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get reference to interface.
 
template<class IFACE >
IFACE * getInterface () const
 Function returning pointer to interface.
 
virtual ~UnknownInterface ()=default
 
- Static Protected Member Functions inherited from MoFEM::UnknownInterface
static MoFEMErrorCode getLibVersion (Version &version)
 Get library version.
 
static MoFEMErrorCode getFileVersion (moab::Interface &moab, Version &version)
 Get database major version.
 
static MoFEMErrorCode setFileVersion (moab::Interface &moab, Version version=Version(MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD))
 Get database major version.
 
static MoFEMErrorCode getInterfaceVersion (Version &version)
 Get database major version.
 
- Protected Attributes inherited from MoFEM::PetscData
Switches data_ctx
 Current data context switches.
 
Vec f
 PETSc residual vector.
 
Mat A
 PETSc Jacobian matrix.
 
Mat B
 PETSc preconditioner matrix.
 
Vec x
 PETSc solution vector.
 
Vec dx
 PETSc solution increment vector.
 
Vec x_t
 PETSc first time derivative vector.
 
Vec x_tt
 PETSc second time derivative vector.
 
- Static Protected Attributes inherited from MoFEM::PetscData
static constexpr Switches CtxSetNone = PetscData::Switches(CTX_SET_NONE)
 No data switch.
 
static constexpr Switches CtxSetF = PetscData::Switches(CTX_SET_F)
 Residual vector switch.
 
static constexpr Switches CtxSetA = PetscData::Switches(CTX_SET_A)
 Jacobian matrix switch.
 
static constexpr Switches CtxSetB = PetscData::Switches(CTX_SET_B)
 Preconditioner matrix switch.
 
static constexpr Switches CtxSetX = PetscData::Switches(CTX_SET_X)
 Solution vector switch.
 
static constexpr Switches CtxSetDX = PetscData::Switches(CTX_SET_DX)
 Solution increment switch.
 
static constexpr Switches CtxSetX_T = PetscData::Switches(CTX_SET_X_T)
 First time derivative switch.
 
static constexpr Switches CtxSetX_TT = PetscData::Switches(CTX_SET_X_TT)
 Second time derivative switch.
 
static constexpr Switches CtxSetTime = PetscData::Switches(CTX_SET_TIME)
 Time value switch.
 

Detailed Description

Data structure for SNES (nonlinear solver) context.

This structure extends PetscData to provide context and data management specifically for PETSc SNES (Scalable Nonlinear Equation Solvers). It stores the SNES solver instance and maintains context information about nonlinear solution phases including function evaluation and Jacobian computation.

Definition at line 202 of file LoopMethods.hpp.

Member Enumeration Documentation

◆ SNESContext

Context enumeration for SNES solver phases.

Indicates the current phase of SNES computation, determining which operations are being performed and what data structures are active.

Enumerator
CTX_SNESSETFUNCTION 

Setting up nonlinear function evaluation.

CTX_SNESSETJACOBIAN 

Setting up Jacobian matrix computation.

CTX_SNESNONE 

No specific SNES context.

Definition at line 219 of file LoopMethods.hpp.

219 {
220 CTX_SNESSETFUNCTION, ///< Setting up nonlinear function evaluation
221 CTX_SNESSETJACOBIAN, ///< Setting up Jacobian matrix computation
222 CTX_SNESNONE ///< No specific SNES context
223 };
@ CTX_SNESSETJACOBIAN
Setting up Jacobian matrix computation.
@ CTX_SNESSETFUNCTION
Setting up nonlinear function evaluation.
@ CTX_SNESNONE
No specific SNES context.

Constructor & Destructor Documentation

◆ SnesMethod()

MoFEM::SnesMethod::SnesMethod ( )

Default constructor.

Definition at line 72 of file LoopMethods.cpp.

Vec f
PETSc residual vector.
Vec dx
PETSc solution increment vector.
Vec x
PETSc solution vector.
Mat B
PETSc preconditioner matrix.
Mat A
PETSc Jacobian matrix.
Vec & snes_f
Reference to residual vector.
Vec & snes_x
Reference to current solution state vector.
Vec & snes_dx
Reference to solution update/increment vector.
Mat & snes_B
Reference to preconditioner of Jacobian matrix.
SNESContext snes_ctx
Current SNES computation context.
Mat & snes_A
Reference to Jacobian matrix.

◆ ~SnesMethod()

virtual MoFEM::SnesMethod::~SnesMethod ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ copySnes()

MoFEMErrorCode MoFEM::SnesMethod::copySnes ( const SnesMethod snes)

Copy SNES data from another instance.

Parameters
snesSource SNES method
Returns
Error code

Definition at line 76 of file LoopMethods.cpp.

76 {
79 this->snes_ctx = snes.snes_ctx;
80 this->snes = snes.snes;
82}
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
MoFEMErrorCode copyPetscData(const PetscData &petsc_data)
Copy PETSc data from another instance.
SNES snes
PETSc SNES nonlinear solver object.

◆ query_interface()

MoFEMErrorCode MoFEM::SnesMethod::query_interface ( boost::typeindex::type_index  type_index,
UnknownInterface **  iface 
) const
virtual

Query interface for type casting.

Parameters
type_indexType information for interface querying
ifacePointer to interface object
Returns
Error code

Reimplemented from MoFEM::PetscData.

Definition at line 66 of file LoopMethods.cpp.

67 {
68 *iface = const_cast<SnesMethod *>(this);
69 return 0;
70}
SnesMethod()
Default constructor.

Member Data Documentation

◆ snes

SNES MoFEM::SnesMethod::snes

PETSc SNES nonlinear solver object.

Definition at line 244 of file LoopMethods.hpp.

◆ snes_A

Mat& MoFEM::SnesMethod::snes_A

Reference to Jacobian matrix.

Definition at line 248 of file LoopMethods.hpp.

◆ snes_B

Mat& MoFEM::SnesMethod::snes_B

Reference to preconditioner of Jacobian matrix.

Definition at line 249 of file LoopMethods.hpp.

◆ snes_ctx

SNESContext MoFEM::SnesMethod::snes_ctx

Current SNES computation context.

Examples
mofem/users_modules/basic_finite_elements/nonlinear_elasticity/nonlinear_dynamics.cpp.

Definition at line 242 of file LoopMethods.hpp.

◆ snes_dx

Vec& MoFEM::SnesMethod::snes_dx

Reference to solution update/increment vector.

Definition at line 246 of file LoopMethods.hpp.

◆ snes_f

Vec& MoFEM::SnesMethod::snes_f

Reference to residual vector.

Definition at line 247 of file LoopMethods.hpp.

◆ snes_x

Vec& MoFEM::SnesMethod::snes_x

Reference to current solution state vector.

Definition at line 245 of file LoopMethods.hpp.


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