73 int main(
int argc,
char *argv[])
75 const char *mesh_file =
"../../data/star.mesh";
79 bool visualization =
true;
82 args.
AddOption(&mesh_file,
"-m",
"--mesh",
"Mesh file to use.");
83 args.
AddOption(&ref_levels,
"-r",
"--refine",
84 "Number of times to refine the mesh uniformly.");
85 args.
AddOption(&order,
"-o",
"--order",
"Polynomial degree.");
87 "FE type. h for H1, n for Hcurl, r for Hdiv, l for L2");
88 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
90 "Enable or disable GLVis visualization.");
93 bool H1 =
false, ND =
false, RT =
false, L2 =
false;
94 if (
string(fe) ==
"h") { H1 =
true; }
95 else if (
string(fe) ==
"n") { ND =
true; }
96 else if (
string(fe) ==
"r") { RT =
true; }
97 else if (
string(fe) ==
"l") { L2 =
true; }
98 else { MFEM_ABORT(
"Bad FE type. Must be 'h', 'n', 'r', or 'l'."); }
101 double kappa = (order+1)*(order+1);
103 Mesh mesh(mesh_file, 1, 1);
105 MFEM_VERIFY(dim == 2 || dim == 3,
"Spatial dimension must be 2 or 3.");
111 int b1 = BasisType::GaussLobatto, b2 = BasisType::IntegratedGLL;
112 unique_ptr<FiniteElementCollection> fec;
119 cout <<
"Number of DOFs: " << fes.
GetTrueVSize() << endl;
123 if (!L2) { fes.GetBoundaryTrueDofs(ess_dofs); }
165 #ifdef MFEM_USE_SUITESPARSE
184 cout <<
"L2 error: " << er << endl;
191 mesh.
Save(
"mesh.mesh");
Class for domain integration L(v) := (f, v)
virtual void Save(const char *fname, int precision=16) const
Conjugate gradient method.
Class for grid function - Vector with associated FE space.
void SetCycle(int c)
Set time cycle (for time-dependent simulations)
virtual double ComputeL2Error(Coefficient &exsol, const IntegrationRule *irs[]=NULL) const
virtual void Mult(const Vector &b, Vector &x) const
Operator application: y=A(x).
Helper class for ParaView visualization data.
Integrator for (curl u, curl v) for Nedelec elements.
Pointer to an Operator of a specified type.
(Q div u, div v) for RT elements
virtual void Save(std::ostream &out) const
Save the GridFunction to an output stream.
virtual void RegisterField(const std::string &field_name, GridFunction *gf)
Add a grid function to the collection.
virtual void SetPrintLevel(int print_lvl)
Legacy method to set the level of verbosity of the solver output.
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
void SetMaxIter(int max_it)
void u_vec(const Vector &xvec, Vector &u)
void SetHighOrderOutput(bool high_order_output_)
virtual int GetTrueVSize() const
Return the number of vector true (conforming) dofs.
void SetTime(double t)
Set physical time (for time-dependent simulations)
Arbitrary order H(div)-conforming Raviart-Thomas finite elements.
A general vector function coefficient.
void SetAbsTol(double atol)
void SetRelTol(double rtol)
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
void AddOption(bool *var, const char *enable_short_name, const char *enable_long_name, const char *disable_short_name, const char *disable_long_name, const char *description, bool required=false)
Add a boolean option and set 'var' to receive the value. Enable/disable tags are used to set the bool...
virtual void ProjectCoefficient(Coefficient &coeff)
Project coeff Coefficient to this GridFunction. The projection computation depends on the choice of t...
void SetLevelsOfDetail(int levels_of_detail_)
for VectorFiniteElements (Nedelec, Raviart-Thomas)
virtual void SetOperator(const Operator &op)
Also calls SetOperator for the preconditioner if there is one.
A general function coefficient.
Arbitrary order H(curl)-conforming Nedelec finite elements.
void f_vec(const Vector &xvec, Vector &f)
virtual void SetPreconditioner(Solver &pr)
This should be called before SetOperator.
Arbitrary order H1-conforming (continuous) finite elements.
virtual void Save() override
double u(const Vector &xvec)
void ParseCheck(std::ostream &out=mfem::out)
void SetPrefixPath(const std::string &prefix)
Set the path where the DataCollection will be saved.
Represents a solver of type SolverType created using the low-order refined version of the given Bilin...
Arbitrary order "L2-conforming" discontinuous finite elements.
double f(const Vector &p)