Manicore
Library to implement schemes on n-dimensionnal manifolds.
|
2 dimensional Maxwell equation on a manifold without boundary More...
#include <maxwell.hpp>
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... | |
2 dimensional Maxwell equation on a manifold without boundary
Provides the logic to assemble and solve the system See the related paper.
typedef Eigen::SparseLU<SystemMatrixType,Eigen::COLAMDOrdering<int> > Manicore::MaxwellProblem::SolverType |
Type used to store the solver.
typedef Eigen::SparseMatrix<double> Manicore::MaxwellProblem::SystemMatrixType |
Type used to store the system.
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 |
||
) |
mesh | Mesh to use |
degree | Polynomial degree |
timestep | Time-step to use in the scheme |
use_threads | Enable pthreads parallelism |
dqr | Degree 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. |
output | Output stream for status messages. |
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.
rho | Interpolate of the electric charge (0 form) |
J | Interpolate of the current (1 form) |
EOld | Previous value of E_h |
BOld | Previous value of B_h |
void Manicore::MaxwellProblem::compute | ( | ) |
Setup the solver.
|
inline |
Return the associated DDR_Spaces.
|
inline |
Return the number of unknowns attached to the space of 2 forms.
|
inline |
Return the number of unknowns attached to the space of 1 forms.
|
inline |
Return the number of unknowns attached to the space of 0 forms.
|
inline |
Return the number of unknowns attached to the space of harmonic 0 forms.
|
inline |
Return the total number of unknowns.
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} \)
E | Discrete form |
k | Form degree |
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} \)
E | Discrete form |
k | Form degree |
Eigen::VectorXd Manicore::MaxwellProblem::solve | ( | ) |
Solve the system and return the solution.
Eigen::VectorXd Manicore::MaxwellProblem::solve | ( | const Eigen::VectorXd & | rhs | ) |
Solve the system for the given Right-Hand side and return the solution.
|
inline |
Return the time-step.
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.
|
staticconstexpr |
Name of the solver.