36 mfem::out <<
"Saving iterations into: " << file_name << endl;
38 os <<
"it,res,sol" << endl;
39 os << fixed << setprecision(precision);
45 os << it <<
"," <<
norm <<
",";
71 mg_owned = !(AssemblyLevel::LEGACY == assembly_level);
80void AbsL1GeometricMultigrid::ConstructCoarseOperatorAndSolver(
83 ConstructBilinearForm(coarse_fespace);
95 coarse_mat->
AbsMult(local_ones, result);
99 Solver* coarse_solver =
nullptr;
103 coarse_solver =
new SLISolver(MPI_COMM_WORLD);
106 coarse_solver =
new CGSolver(MPI_COMM_WORLD);
122 AddLevel(coarse_mat.
Ptr(), coarse_solver, mg_owned,
true);
125void AbsL1GeometricMultigrid::ConstructOperatorAndSmoother(
129 ConstructBilinearForm(fespace);
141 level_mat->
AbsMult(local_ones, result);
145 AddLevel(level_mat.
Ptr(), smoother, mg_owned,
true);
148void AbsL1GeometricMultigrid::ConstructBilinearForm(
153 switch (integrator_type)
166 mfem_error(
"Invalid integrator type! Check ParBilinearForm");
178 for (
int i = 0; i < form.
ParFESpace()->GetNE(); ++i)
187 for (
int j = 0; j < emat_i.
Height(); ++j)
189 for (
int k = 0; k < emat_i.
Width(); ++k)
191 temp_emat_i(j, k) = std::pow(std::abs(emat_i(j, k)),
p);
206 temp_emat_i.
Mult(right, temp);
208 if (1.0 + q -
p!= 0.0)
212 left.
Pow(1.0 + q -
p);
234 return sin(
kappa * x(0)) * sin(
kappa * x(1)) * sin(
kappa * x(2)) + 1.0;
238 return sin(
kappa * x(0)) * sin(
kappa * x(1)) + 1.0;
267 if (x.
Size() == 3) {
u(2) = 0.0; }
283 if (x.
Size() == 3) {
f(2) = 0.0; }
AbsL1GeometricMultigrid(ParFiniteElementSpaceHierarchy &fes_hierarchy, Array< int > &ess_bdr, IntegratorType it, SolverType st, AssemblyLevel al)
void MonitorResidual(int it, real_t norm, const Vector &x, bool final)
Monitor the residual vector r.
DataMonitor(string file_name, int ndigits)
void MonitorSolution(int it, real_t norm, const Vector &x, bool final)
Monitor the solution vector x.
Conjugate gradient method.
Integrator for for Nedelec elements.
Data type dense matrix using column-major storage.
void GetDiag(Vector &d) const
Returns the diagonal of the matrix.
void Mult(const real_t *x, real_t *y) const
Matrix vector multiplication.
void Diag(real_t c, int n)
Creates n x n diagonal matrix with diagonal elements c.
void Clear()
Delete the matrix data array (if owned) and reset the matrix state.
int GetNumLevels() const
Returns the number of levels in the hierarchy.
Geometric multigrid associated with a hierarchy of finite element spaces.
Array< Array< int > * > essentialTrueDofs
Array< BilinearForm * > bfs
void AssembleDiagonal(Vector &diag) const override
Return the diagonal of the matrix (Operator interface).
Abstract base class for iterative solver.
void SetRelTol(real_t rtol)
virtual void SetPreconditioner(Solver &pr)
This should be called before SetOperator.
virtual void SetPrintLevel(int print_lvl)
Legacy method to set the level of verbosity of the solver output.
void SetMaxIter(int max_it)
static bool Root()
Return true if the rank in MPI_COMM_WORLD is zero.
void AddLevel(Operator *op, Solver *smoother, bool ownOperator, bool ownSmoother)
Adds a level to the multigrid operator hierarchy.
Pointer to an Operator of a specified type.
void SetOperatorOwner(bool own=true)
Set the ownership flag for the held Operator.
void SetType(Operator::Type tid)
Invoke Clear() and set a new type id.
Operator * Ptr() const
Access the underlying Operator pointer.
Jacobi smoothing for a given bilinear form (no matrix necessary).
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
int Width() const
Get the width (size of input) of the Operator. Synonym with NumCols().
@ ANY_TYPE
ID for the base class Operator, i.e. any type.
virtual void AbsMult(const Vector &x, Vector &y) const
Action of the absolute-value operator: y=|A|(x). The default behavior in class Operator is to generat...
const ParFiniteElementSpace & GetFESpaceAtLevel(int level) const override
Returns the finite element space at the given level.
Abstract parallel finite element space.
Stationary linear iteration: x <- x + B (b - A x)
virtual void SetOperator(const Operator &op)=0
Set/update the solver for the given operator.
void Pow(const real_t p)
(*this)(i) = pow((*this)(i), p)
int Size() const
Returns the size of the vector.
void Abs()
(*this)(i) = abs((*this)(i))
real_t * GetData() const
Return a pointer to the beginning of the Vector data.
const int * ess_tdof_list
real_t f(const Vector &p)
real_t diffusion_source(const Vector &x)
void maxwell_source(const Vector &x, Vector &f)
void maxwell_solution(const Vector &x, Vector &u)
void AssembleElementLpqJacobiDiag(ParBilinearForm &form, real_t p, real_t q, Vector &diag)
real_t diffusion_solution(const Vector &x)
real_t u(const Vector &xvec)
void mfem_error(const char *msg)
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
AssemblyLevel
Enumeration defining the assembly level for bilinear and nonlinear form classes derived from Operator...
real_t p(const Vector &x, real_t t)
MFEM_HOST_DEVICE real_t norm(const Complex &z)