HArD::Core2D
Hybrid Arbitrary Degree::Core 2D - Library to implement 2D schemes with edge and cell polynomials as unknowns
Loading...
Searching...
No Matches
Classes | Typedefs | Functions
HHO2D

Class providing helper methods and assemble and solve routines for general 2D HHO schemes. More...

Classes

class  HHO2D
 

Typedefs

typedef std::function< Eigen::MatrixXd(Cell *, ElementQuad &)> MatrixFType
 type for the global operator as a function of a Cell and an ElementQuad
 
typedef std::function< Eigen::VectorXd(Cell *, ElementQuad &)> VectorFType
 type for the load vector as a function of a Cell and an ElementQuad
 

Functions

 HHO2D::HHO2D (HybridCore &, const size_t, const size_t, const bool use_threads=true, size_t doeT=0, size_t doeF=0)
 Class constructor: initialises the model by providing a HybridCore object, and the exact solution and boundary conditions of the model.
 
void HHO2D::assemble ()
 A general assemble routine that calculates the statically condensed matrices required by solve.
 
UVector HHO2D::solve ()
 Solves the statically condensed system.
 
UVector HHO2D::neumann_solve ()
 Solves the system when the model is ill posed (not yet running)
 
double HHO2D::energy_norm (const UVector)
 Returns the energy norm of a given UVector.
 
void HHO2D::set_global_operator (const MatrixFType &)
 Set the global operator.
 
void HHO2D::set_load_vector (const VectorFType &)
 Set the load vector.
 
void HHO2D::plot (const std::string, const UVector &, const FType< double > &)
 Plot the numerical and exact solutions.
 
VectorFType HHO2D::standard_load_vector (const CellFType< double > &)
 Returns the standard load vector (f, v_T)_T with no Neumann boundary conditions.
 
VectorFType HHO2D::standard_load_vector (const CellFType< double > &, const CellFType< VectorRd > &, const BoundaryConditions &)
 Returns the standard load vector (f, v_T)_T.
 
VectorFType HHO2D::standard_load_vector (const CellFType< double > &, const FType< double > &, const BoundaryConditions &)
 Returns the standard load vector (f, v_T)_T.
 
void HHO2D::set_dirichlet (const FType< double > &, const size_t)
 Set the Dirichlet boundary conditions.
 
void HHO2D::set_dirichlet (const size_t)
 Set the Dirichlet boundary condition to zero.
 
Eigen::SparseMatrix< double > HHO2D::get_SysMat ()
 Return the (statically condensed) matrix system.
 
double HHO2D::get_assembly_time () const
 CPU time to assemble the scheme.
 
double HHO2D::get_solving_time () const
 CPU time to solve the scheme.
 
double HHO2D::get_solving_error () const
 Residual after solving the scheme.
 

Detailed Description

Class providing helper methods and assemble and solve routines for general 2D HHO schemes.

The HHO2D class contains methods applicable to a general 2D HHO model. It contains assemble and solve routines usable by any scheme. The global operator and load vector are passed to the model through setters and are then accessible by assemble and solve. The class also contains helper methods for writing HHO schemes.

Typedef Documentation

◆ MatrixFType

typedef std::function<Eigen::MatrixXd(Cell *, ElementQuad &)> MatrixFType

type for the global operator as a function of a Cell and an ElementQuad

◆ VectorFType

typedef std::function<Eigen::VectorXd(Cell *, ElementQuad &)> VectorFType

type for the load vector as a function of a Cell and an ElementQuad

Function Documentation

◆ assemble()

void HHO2D::assemble ( )

A general assemble routine that calculates the statically condensed matrices required by solve.

◆ energy_norm()

double HHO2D::energy_norm ( const UVector  Xh)

Returns the energy norm of a given UVector.

◆ get_assembly_time()

double HHO2D::get_assembly_time ( ) const
inline

CPU time to assemble the scheme.

◆ get_solving_error()

double HHO2D::get_solving_error ( ) const
inline

Residual after solving the scheme.

◆ get_solving_time()

double HHO2D::get_solving_time ( ) const
inline

CPU time to solve the scheme.

◆ get_SysMat()

Eigen::SparseMatrix< double > HHO2D::get_SysMat ( )
inline

Return the (statically condensed) matrix system.

◆ HHO2D()

HHO2D::HHO2D ( HybridCore hho,
const size_t  L,
const size_t  K,
const bool  use_threads = true,
size_t  doeT = 0,
size_t  doeF = 0 
)

Class constructor: initialises the model by providing a HybridCore object, and the exact solution and boundary conditions of the model.

Parameters
hhoA reference to the HybridCore object containing mesh data
LCell polynomial degree
KEdge polynomial degree
use_threadsOptional argument to indicate if threads should be used
doeTOptional argument to set cell quadrature degree. Default is L + K + 1
doeFOptional argument to set edge quadrature degree. Default is 2 * K + 1

◆ neumann_solve()

UVector HHO2D::neumann_solve ( )

Solves the system when the model is ill posed (not yet running)

◆ plot()

void HHO2D::plot ( const std::string  plot_file,
const UVector sol,
const FType< double > &  exact_sol 
)

Plot the numerical and exact solutions.

Parameters
plot_filePlot file
solNumerical solution
exact_solExact solution

◆ set_dirichlet() [1/2]

void HHO2D::set_dirichlet ( const FType< double > &  f,
const size_t  n_dir_edges 
)

Set the Dirichlet boundary conditions.

Parameters
fFunction on the Dirichlet BC edges
n_dir_edgesNumber of Dirichlet edges

◆ set_dirichlet() [2/2]

void HHO2D::set_dirichlet ( const size_t  n_dir_edges)

Set the Dirichlet boundary condition to zero.

Parameters
n_dir_edgesNumber of Dirichlet edges

◆ set_global_operator()

void HHO2D::set_global_operator ( const MatrixFType AT)

Set the global operator.

◆ set_load_vector()

void HHO2D::set_load_vector ( const VectorFType bT)

Set the load vector.

◆ solve()

UVector HHO2D::solve ( )

Solves the statically condensed system.

◆ standard_load_vector() [1/3]

VectorFType HHO2D::standard_load_vector ( const CellFType< double > &  source)

Returns the standard load vector (f, v_T)_T with no Neumann boundary conditions.

Parameters
sourceSource term

◆ standard_load_vector() [2/3]

VectorFType HHO2D::standard_load_vector ( const CellFType< double > &  source,
const CellFType< VectorRd > &  f,
const BoundaryConditions BC 
)

Returns the standard load vector (f, v_T)_T.

Parameters
sourceSource term
fGradient to be dotted with the normal vector on each Neumann edge
BCA reference to the BC to determine Neumann edges

◆ standard_load_vector() [3/3]

VectorFType HHO2D::standard_load_vector ( const CellFType< double > &  source,
const FType< double > &  f,
const BoundaryConditions BC 
)

Returns the standard load vector (f, v_T)_T.

Parameters
sourceSource term
fFunction on the Neumann BC edges
BCA reference to the BC to determine Neumann edges