78int main(
int argc,
char *argv[])
83 const char *mesh_file =
"../../data/star.mesh";
84 int ser_ref_levels = 1, par_ref_levels = 1;
87 const char *device_config =
"cpu";
88 bool visualization =
true;
91 args.
AddOption(&mesh_file,
"-m",
"--mesh",
"Mesh file to use.");
92 args.
AddOption(&ser_ref_levels,
"-rs",
"--refine-serial",
93 "Number of times to refine the mesh uniformly in serial.");
94 args.
AddOption(&par_ref_levels,
"-rp",
"--refine-parallel",
95 "Number of times to refine the mesh uniformly in parallel.");
96 args.
AddOption(&order,
"-o",
"--order",
"Polynomial degree.");
98 "FE type. h for H1, n for Hcurl, r for Hdiv, l for L2");
99 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
100 "--no-visualization",
101 "Enable or disable GLVis visualization.");
102 args.
AddOption(&device_config,
"-d",
"--device",
103 "Device configuration string, see Device::Configure().");
106 Device device(device_config);
109 bool H1 =
false, ND =
false, RT =
false, L2 =
false;
110 if (
string(fe) ==
"h") { H1 =
true; }
111 else if (
string(fe) ==
"n") { ND =
true; }
112 else if (
string(fe) ==
"r") { RT =
true; }
113 else if (
string(fe) ==
"l") { L2 =
true; }
114 else { MFEM_ABORT(
"Bad FE type. Must be 'h', 'n', 'r', or 'l'."); }
118 Mesh serial_mesh(mesh_file, 1, 1);
121 MFEM_VERIFY(
dim == 2 ||
dim == 3,
"Mesh dimension must be 2 or 3.");
122 MFEM_VERIFY(!L2 ||
dim == sdim,
"DG surface meshes not supported.");
124 ParMesh mesh(MPI_COMM_WORLD, serial_mesh);
128 if (mesh.
ncmesh && (RT || ND))
129 { MFEM_ABORT(
"LOR AMS and ADS solvers are not supported with AMR meshes."); }
133 u_vec_coeff(sdim,
u_vec);
136 unique_ptr<FiniteElementCollection> fec;
144 if (
Mpi::Root()) { cout <<
"Number of DOFs: " << ndofs << endl; }
170 if (!L2 && (H1 || sdim ==
dim)) {
a.SetAssemblyLevel(AssemblyLevel::PARTIAL); }
189 a.FormLinearSystem(ess_dofs, x,
b, A, X, B);
191 unique_ptr<Solver> solv_lor;
196 else if (RT &&
dim == 3)
214 a.RecoverFEMSolution(X,
b, x);
220 if (
Mpi::Root()) { cout <<
"L2 error: " << er << endl; }
@ GaussLobatto
Closed type.
@ IntegratedGLL
Integrated GLL indicator functions.
Conjugate gradient method.
virtual void SetOperator(const Operator &op)
Also calls SetOperator for the preconditioner if there is one.
virtual void Mult(const Vector &b, Vector &x) const
Iterative solution of the linear system using the Conjugate Gradient method.
Integrator for for Nedelec elements.
virtual void RegisterField(const std::string &field_name, GridFunction *gf)
Add a grid function to the collection.
void SetCycle(int c)
Set time cycle (for time-dependent simulations)
void SetTime(real_t t)
Set physical time (for time-dependent simulations)
void SetPrefixPath(const std::string &prefix)
Set the path where the DataCollection will be saved.
The MFEM Device class abstracts hardware devices such as GPUs, as well as programming models such as ...
void Print(std::ostream &out=mfem::out)
Print the configuration of the MFEM virtual device object.
for Raviart-Thomas elements
Class for domain integration .
void GetBoundaryTrueDofs(Array< int > &boundary_dofs, int component=-1)
Get a list of all boundary true dofs, boundary_dofs. For spaces with 'vdim' > 1, the 'component' para...
A general function coefficient.
Arbitrary order H1-conforming (continuous) finite elements.
static void Init()
Initialize hypre by calling HYPRE_Init() and set default options. After calling Hypre::Init(),...
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)
void SetAbsTol(real_t atol)
Arbitrary order "L2-conforming" discontinuous finite elements.
Represents a solver of type SolverType created using the low-order refined version of the given Bilin...
void Clear()
Clear the contents of the Mesh.
int Dimension() const
Dimension of the reference space used within the elements.
int SpaceDimension() const
Dimension of the physical space containing the mesh.
NCMesh * ncmesh
Optional nonconforming mesh extension.
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
static bool Root()
Return true if the rank in MPI_COMM_WORLD is zero.
static void Init(int &argc, char **&argv, int required=default_thread_required, int *provided=nullptr)
Singleton creation with Mpi::Init(argc, argv).
Arbitrary order H(curl)-conforming Nedelec finite elements.
Pointer to an Operator of a specified type.
void ParseCheck(std::ostream &out=mfem::out)
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...
Abstract parallel finite element space.
HYPRE_BigInt GlobalTrueVSize() const
Class for parallel grid function.
void Save(std::ostream &out) const override
real_t ComputeL2Error(Coefficient *exsol[], const IntegrationRule *irs[]=NULL, const Array< int > *elems=NULL) const override
void ProjectCoefficient(Coefficient &coeff) override
Project coeff Coefficient to this GridFunction. The projection computation depends on the choice of t...
Class for parallel meshes.
void Save(const std::string &fname, int precision=16) const override
Helper class for ParaView visualization data.
void SetHighOrderOutput(bool high_order_output_)
void SetLevelsOfDetail(int levels_of_detail_)
virtual void Save() override
Arbitrary order H(div)-conforming Raviart-Thomas finite elements.
for VectorFiniteElements (Nedelec, Raviart-Thomas)
A general vector function coefficient.
real_t u(const Vector &xvec)
void u_vec(const Vector &xvec, Vector &u)
std::function< void(const Vector &, Vector &)> f_vec(bool grad_div_problem)
std::function< real_t(const Vector &)> f(real_t mass_coeff)