Manicore
Library to implement schemes on n-dimensionnal manifolds.
Public Types | Public Member Functions | Static Public Attributes | List of all members
Manicore::MaxwellProblem Class Reference

2 dimensional Maxwell equation on a manifold without boundary More...

#include <maxwell.hpp>

Collaboration diagram for Manicore::MaxwellProblem:
Collaboration graph
[legend]

Public Types

typedef Eigen::SparseMatrix< double > SystemMatrixType
 Type used to store the system. More...
 
typedef Eigen::SparseLU< SystemMatrixType, Eigen::COLAMDOrdering< int > > SolverType
 Type used to store the solver. More...
 

Public Member Functions

 MaxwellProblem (const Mesh< 2 > &mesh, int degree, double timestep, bool use_threads=true, std::array< int, 2 > const *dqr=nullptr, std::ostream &output=std::cout)
 
size_t dimensionH () const
 Return the number of unknowns attached to the space of harmonic 0 forms. More...
 
size_t dimensionG () const
 Return the number of unknowns attached to the space of 0 forms. More...
 
size_t dimensionE () const
 Return the number of unknowns attached to the space of 1 forms. More...
 
size_t dimensionB () const
 Return the number of unknowns attached to the space of 2 forms. More...
 
size_t dimensionSystem () const
 Return the total number of unknowns. More...
 
DDR_Spaces< 2 > const & ddrcore () const
 Return the associated DDR_Spaces. More...
 
double timeStep () const
 Return the time-step. More...
 
void assembleRHS (Eigen::Ref< const Eigen::VectorXd > const &rho, Eigen::Ref< const Eigen::VectorXd > const &J, Eigen::Ref< const Eigen::VectorXd > const &EOld, Eigen::Ref< const Eigen::VectorXd > const &BOld)
 Assemble the Right-Hand side from the given interpolates. More...
 
void compute ()
 Setup the solver. More...
 
bool validateSolution (Eigen::Ref< const Eigen::VectorXd > const &u) const
 Check if the vector u if a solution up to a given relative accuracy. More...
 
Eigen::VectorXd solve ()
 Solve the system and return the solution. More...
 
Eigen::VectorXd solve (const Eigen::VectorXd &rhs)
 Solve the system for the given Right-Hand side and return the solution. More...
 
template<typename Derived >
double norm (Eigen::MatrixBase< Derived > const &E, size_t k) const
 Compute the discrete norm of a \(k\)-form. More...
 
template<typename Derived >
double normd (Eigen::MatrixBase< Derived > const &E, size_t k) const
 Compute the discrete norm of the differential of a \(k\)-form. More...
 

Static Public Attributes

static constexpr std::string_view SolverName = "SparseLU"
 Name of the solver. More...
 

Detailed Description

2 dimensional Maxwell equation on a manifold without boundary

Provides the logic to assemble and solve the system See the related paper.

Member Typedef Documentation

◆ SolverType

typedef Eigen::SparseLU<SystemMatrixType,Eigen::COLAMDOrdering<int> > Manicore::MaxwellProblem::SolverType

Type used to store the solver.

◆ SystemMatrixType

typedef Eigen::SparseMatrix<double> Manicore::MaxwellProblem::SystemMatrixType

Type used to store the system.

Constructor & Destructor Documentation

◆ MaxwellProblem()

Manicore::MaxwellProblem::MaxwellProblem ( const Mesh< 2 > &  mesh,
int  degree,
double  timestep,
bool  use_threads = true,
std::array< int, 2 > const *  dqr = nullptr,
std::ostream &  output = std::cout 
)
Parameters
meshMesh to use
degreePolynomial degree
timestepTime-step to use in the scheme
use_threadsEnable pthreads parallelism
dqrDegree of quadrature used to generate the mass matrices. It cannot be exact for generic metric and default to a pretty high degree. Use a lower degree if the metric and cells are almost flat.
outputOutput stream for status messages.

Member Function Documentation

◆ assembleRHS()

void Manicore::MaxwellProblem::assembleRHS ( Eigen::Ref< const Eigen::VectorXd > const &  rho,
Eigen::Ref< const Eigen::VectorXd > const &  J,
Eigen::Ref< const Eigen::VectorXd > const &  EOld,
Eigen::Ref< const Eigen::VectorXd > const &  BOld 
)

Assemble the Right-Hand side from the given interpolates.

Parameters
rhoInterpolate of the electric charge (0 form)
JInterpolate of the current (1 form)
EOldPrevious value of E_h
BOldPrevious value of B_h

◆ compute()

void Manicore::MaxwellProblem::compute ( )

Setup the solver.

◆ ddrcore()

DDR_Spaces<2> const& Manicore::MaxwellProblem::ddrcore ( ) const
inline

Return the associated DDR_Spaces.

◆ dimensionB()

size_t Manicore::MaxwellProblem::dimensionB ( ) const
inline

Return the number of unknowns attached to the space of 2 forms.

◆ dimensionE()

size_t Manicore::MaxwellProblem::dimensionE ( ) const
inline

Return the number of unknowns attached to the space of 1 forms.

◆ dimensionG()

size_t Manicore::MaxwellProblem::dimensionG ( ) const
inline

Return the number of unknowns attached to the space of 0 forms.

◆ dimensionH()

size_t Manicore::MaxwellProblem::dimensionH ( ) const
inline

Return the number of unknowns attached to the space of harmonic 0 forms.

◆ dimensionSystem()

size_t Manicore::MaxwellProblem::dimensionSystem ( ) const
inline

Return the total number of unknowns.

◆ norm()

template<typename Derived >
double Manicore::MaxwellProblem::norm ( Eigen::MatrixBase< Derived > const &  E,
size_t  k 
) const

Compute the discrete norm of a \(k\)-form.

Compute \( \Vert E \Vert_{h,k} \)

Parameters
EDiscrete form
kForm degree

◆ normd()

template<typename Derived >
double Manicore::MaxwellProblem::normd ( Eigen::MatrixBase< Derived > const &  E,
size_t  k 
) const

Compute the discrete norm of the differential of a \(k\)-form.

Compute \( \Vert d_h^k E \Vert_{h,k+1} \)

Parameters
EDiscrete form
kForm degree

◆ solve() [1/2]

Eigen::VectorXd Manicore::MaxwellProblem::solve ( )

Solve the system and return the solution.

◆ solve() [2/2]

Eigen::VectorXd Manicore::MaxwellProblem::solve ( const Eigen::VectorXd &  rhs)

Solve the system for the given Right-Hand side and return the solution.

◆ timeStep()

double Manicore::MaxwellProblem::timeStep ( ) const
inline

Return the time-step.

◆ validateSolution()

bool Manicore::MaxwellProblem::validateSolution ( Eigen::Ref< const Eigen::VectorXd > const &  u) const

Check if the vector u if a solution up to a given relative accuracy.

Member Data Documentation

◆ SolverName

constexpr std::string_view Manicore::MaxwellProblem::SolverName = "SparseLU"
staticconstexpr

Name of the solver.


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