IPPL API Reference
Independent Parallel Particle Layer C++ API
Loading...
Searching...
No Matches
ippl::PreconditionedFEMPoissonSolver< FieldLHS, FieldRHS > Class Template Reference

A solver for the poisson equation using finite element methods and Conjugate Gradient (CG) More...

#include <PreconditionedFEMPoissonSolver.h>

+ Inheritance diagram for ippl::PreconditionedFEMPoissonSolver< FieldLHS, FieldRHS >:
+ Collaboration diagram for ippl::PreconditionedFEMPoissonSolver< FieldLHS, FieldRHS >:

Public Types

using Base = Poisson< FieldLHS, FieldRHS >
 
using MeshType = typename FieldRHS::Mesh_t
 
using PCGSolverAlgorithm_t = PCG< lhs_type, lhs_type, lhs_type, lhs_type, lhs_type, FieldLHS, FieldRHS >
 
using ElementType = std::conditional_t< Dim==1, ippl::EdgeElement< Tlhs >, std::conditional_t< Dim==2, ippl::QuadrilateralElement< Tlhs >, ippl::HexahedralElement< Tlhs > > >
 
using QuadratureType = GaussJacobiQuadrature< Tlhs, 5, ElementType >
 
using LagrangeType = LagrangeSpace< Tlhs, Dim, 1, ElementType, QuadratureType, FieldLHS, FieldRHS >
 
using lhs_type = FieldLHS
 
using rhs_type = FieldRHS
 
- Public Types inherited from ippl::Poisson< FieldLHS, FieldRHS >
enum  OutputType { SOL = 0b01 , GRAD = 0b10 , SOL_AND_GRAD = 0b11 }
 
using lhs_type = FieldLHS
 
using rhs_type = FieldRHS
 
using Tlhs = typename FieldLHS::value_type
 
using Trhs = typename FieldRHS::value_type
 
using grad_type = Field< Vector< Tlhs, Dim >, Dim, Mesh, Centering >
 

Public Member Functions

 PreconditionedFEMPoissonSolver (lhs_type &lhs, rhs_type &rhs)
 
void setRhs (rhs_type &rhs) override
 
LagrangeTypegetSpace ()
 Return the LagrangeSpace object.
 
void solve () override
 Solve the poisson equation using finite element methods. The problem is described by -laplace(lhs) = rhs.
 
int getIterationCount ()
 
Tlhs getResidue () const
 
template<typename F >
Tlhs getL2Error (const F &analytic)
 
Tlhs getAvg (bool Vol=false)
 
- Public Member Functions inherited from ippl::Poisson< FieldLHS, FieldRHS >
 Poisson ()
 
 Poisson (lhs_type &lhs, rhs_type &rhs)
 
template<typename T >
void updateParameter (const std::string &key, const T &value)
 
void updateParameters (const ParameterList &params)
 
void mergeParameters (const ParameterList &params)
 
virtual void setLhs (lhs_type &lhs)
 
virtual MField_tgetHessian ()
 
void setGradient (grad_type &grad)
 

Protected Member Functions

virtual void setDefaultParameters () override
 

Protected Attributes

PCGSolverAlgorithm_t pcg_algo_m
 
ElementType refElement_m
 
QuadratureType quadrature_m
 
LagrangeType lagrangeSpace_m
 
- Protected Attributes inherited from ippl::Poisson< FieldLHS, FieldRHS >
ParameterList params_m
 
rhs_type * rhs_mp = nullptr
 
lhs_type * lhs_mp = nullptr
 
grad_typegrad_mp
 

Detailed Description

template<typename FieldLHS, typename FieldRHS = FieldLHS>
class ippl::PreconditionedFEMPoissonSolver< FieldLHS, FieldRHS >

A solver for the poisson equation using finite element methods and Conjugate Gradient (CG)

Template Parameters
FieldLHSfield type for the left hand side
FieldRHSfield type for the right hand side

Member Function Documentation

◆ getAvg()

template<typename FieldLHS , typename FieldRHS = FieldLHS>
Tlhs ippl::PreconditionedFEMPoissonSolver< FieldLHS, FieldRHS >::getAvg ( bool  Vol = false)
inline

Query the average of the solution

Parameters
VolBoolean indicating whether we divide by volume or not
Returns
avg (offset for null space test cases if divided by volume)

◆ getIterationCount()

template<typename FieldLHS , typename FieldRHS = FieldLHS>
int ippl::PreconditionedFEMPoissonSolver< FieldLHS, FieldRHS >::getIterationCount ( )
inline

Query how many iterations were required to obtain the solution the last time this solver was used

Returns
Iteration count of last solve

◆ getL2Error()

template<typename FieldLHS , typename FieldRHS = FieldLHS>
template<typename F >
Tlhs ippl::PreconditionedFEMPoissonSolver< FieldLHS, FieldRHS >::getL2Error ( const F &  analytic)
inline

Query the L2-norm error compared to a given (analytical) sol

Returns
L2 error after last solve

◆ getResidue()

template<typename FieldLHS , typename FieldRHS = FieldLHS>
Tlhs ippl::PreconditionedFEMPoissonSolver< FieldLHS, FieldRHS >::getResidue ( ) const
inline

Query the residue

Returns
Residue norm from last solve

◆ setDefaultParameters()

template<typename FieldLHS , typename FieldRHS = FieldLHS>
virtual void ippl::PreconditionedFEMPoissonSolver< FieldLHS, FieldRHS >::setDefaultParameters ( )
inlineoverrideprotectedvirtual

Utility function for initializing a solver's default parameters (to be overridden for each base class)

Reimplemented from ippl::Poisson< FieldLHS, FieldRHS >.

◆ setRhs()

template<typename FieldLHS , typename FieldRHS = FieldLHS>
void ippl::PreconditionedFEMPoissonSolver< FieldLHS, FieldRHS >::setRhs ( rhs_type &  rhs)
inlineoverridevirtual

Set the problem RHS

Parameters
rhsReference to problem RHS field

Reimplemented from ippl::Poisson< FieldLHS, FieldRHS >.

◆ solve()

template<typename FieldLHS , typename FieldRHS = FieldLHS>
void ippl::PreconditionedFEMPoissonSolver< FieldLHS, FieldRHS >::solve ( )
inlineoverridevirtual

Solve the poisson equation using finite element methods. The problem is described by -laplace(lhs) = rhs.

Implements ippl::Poisson< FieldLHS, FieldRHS >.


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