75 int main(
int argc,
char *argv[])
80 const char *mesh_file =
"../../data/star.mesh";
81 int ser_ref_levels = 1, par_ref_levels = 1;
84 const char *device_config =
"cpu";
85 bool visualization =
true;
88 args.
AddOption(&mesh_file,
"-m",
"--mesh",
"Mesh file to use.");
89 args.
AddOption(&ser_ref_levels,
"-rs",
"--refine-serial",
90 "Number of times to refine the mesh uniformly in serial.");
91 args.
AddOption(&par_ref_levels,
"-rp",
"--refine-parallel",
92 "Number of times to refine the mesh uniformly in parallel.");
93 args.
AddOption(&order,
"-o",
"--order",
"Polynomial degree.");
95 "FE type. h for H1, n for Hcurl, r for Hdiv, l for L2");
96 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
98 "Enable or disable GLVis visualization.");
99 args.
AddOption(&device_config,
"-d",
"--device",
100 "Device configuration string, see Device::Configure().");
103 Device device(device_config);
104 if (Mpi::Root()) { device.
Print(); }
106 bool H1 =
false, ND =
false, RT =
false, L2 =
false;
107 if (
string(fe) ==
"h") { H1 =
true; }
108 else if (
string(fe) ==
"n") { ND =
true; }
109 else if (
string(fe) ==
"r") { RT =
true; }
110 else if (
string(fe) ==
"l") { L2 =
true; }
111 else { MFEM_ABORT(
"Bad FE type. Must be 'h', 'n', 'r', or 'l'."); }
113 double kappa = (order+1)*(order+1);
115 Mesh serial_mesh(mesh_file, 1, 1);
117 MFEM_VERIFY(
dim == 2 ||
dim == 3,
"Spatial dimension must be 2 or 3.");
119 ParMesh mesh(MPI_COMM_WORLD, serial_mesh);
123 if (mesh.
ncmesh && (RT || ND))
124 { MFEM_ABORT(
"LOR AMS and ADS solvers are not supported with AMR meshes."); }
129 int b1 = BasisType::GaussLobatto, b2 = BasisType::IntegratedGLL;
130 unique_ptr<FiniteElementCollection> fec;
138 if (Mpi::Root()) { cout <<
"Number of DOFs: " << ndofs << endl; }
142 if (!L2) { fes.GetBoundaryTrueDofs(ess_dofs); }
163 if (!L2) {
a.SetAssemblyLevel(AssemblyLevel::PARTIAL); }
182 a.FormLinearSystem(ess_dofs, x,
b, A, X, B);
185 unique_ptr<Solver> solv_lor;
190 else if (RT &&
dim == 3)
208 a.RecoverFEMSolution(X,
b, x);
212 if (Mpi::Root()) { cout <<
"L2 error: " << er << endl; }
Class for domain integration L(v) := (f, v)
Conjugate gradient method.
void SetCycle(int c)
Set time cycle (for time-dependent simulations)
int Dimension() const
Dimension of the reference space used within the elements.
int main(int argc, char *argv[])
Helper class for ParaView visualization data.
Integrator for (curl u, curl v) for Nedelec elements.
Pointer to an Operator of a specified type.
virtual void Mult(const Vector &b, Vector &x) const
Operator application: y=A(x).
void Print(std::ostream &out=mfem::out)
Print the configuration of the MFEM virtual device object.
Abstract parallel finite element space.
virtual void ProjectCoefficient(Coefficient &coeff)
Project coeff Coefficient to this GridFunction. The projection computation depends on the choice of t...
(Q div u, div v) for RT elements
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 Save(const std::string &fname, int precision=16) const override
void SetHighOrderOutput(bool high_order_output_)
void SetTime(double t)
Set physical time (for time-dependent simulations)
virtual double ComputeL2Error(Coefficient *exsol[], const IntegrationRule *irs[]=NULL, const Array< int > *elems=NULL) const
HYPRE_BigInt GlobalTrueVSize() const
Arbitrary order H(div)-conforming Raviart-Thomas finite elements.
A general vector function coefficient.
void SetAbsTol(double atol)
std::function< void(const Vector &, Vector &)> f_vec(bool grad_div_problem)
void SetRelTol(double rtol)
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 Save(std::ostream &out) const
NCMesh * ncmesh
Optional nonconforming mesh extension.
void SetLevelsOfDetail(int levels_of_detail_)
void Clear()
Clear the contents of the Mesh.
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.
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)
Class for parallel grid function.
The MFEM Device class abstracts hardware devices such as GPUs, as well as programming models such as ...
Class for parallel meshes.
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)