64int main(
int argc,
char *argv[])
73 const char *mesh_file =
"../data/star.mesh";
76 bool static_cond =
false;
77 bool hybridization =
false;
80 const char *device_config =
"cpu";
81 bool visualization = 1;
84 args.
AddOption(&mesh_file,
"-m",
"--mesh",
87 "Finite element order (polynomial degree).");
88 args.
AddOption(&set_bc,
"-bc",
"--impose-bc",
"-no-bc",
"--dont-impose-bc",
89 "Impose or not essential boundary conditions.");
90 args.
AddOption(&
freq,
"-f",
"--frequency",
"Set the frequency for the exact"
92 args.
AddOption(&static_cond,
"-sc",
"--static-condensation",
"-no-sc",
93 "--no-static-condensation",
"Enable static condensation.");
94 args.
AddOption(&hybridization,
"-hb",
"--hybridization",
"-no-hb",
95 "--no-hybridization",
"Enable hybridization.");
96 args.
AddOption(&pa,
"-pa",
"--partial-assembly",
"-no-pa",
97 "--no-partial-assembly",
"Enable Partial Assembly.");
98 args.
AddOption(&ea,
"-ea",
"--element-assembly",
"-no-ea",
99 "--no-element-assembly",
"Enable Element Assembly.");
100 args.
AddOption(&device_config,
"-d",
"--device",
101 "Device configuration string, see Device::Configure().");
102 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
103 "--no-visualization",
104 "Enable or disable GLVis visualization.");
110 Device device(device_config);
111 if (myid == 0) { device.
Print(); }
116 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
126 (int)floor(log(1000./mesh->
GetNE())/log(2.)/
dim);
127 for (
int l = 0; l < ref_levels; l++)
139 int par_ref_levels = 2;
140 for (
int l = 0; l < par_ref_levels; l++)
153 cout <<
"Number of finite element unknowns: " << size << endl;
164 ess_bdr = set_bc ? 1 : 0;
192 if (pa) {
a->SetAssemblyLevel(AssemblyLevel::PARTIAL); }
193 if (ea) {
a->SetAssemblyLevel(AssemblyLevel::ELEMENT); }
206 a->EnableStaticCondensation();
208 else if (hybridization)
221 if (myid == 0 && !pa)
223 cout <<
"Size of linear system: "
242 (
a->StaticCondensationIsEnabled() ?
a->SCParFESpace() : fespace);
251 a->RecoverFEMSolution(X, *
b, x);
258 cout <<
"\n|| F_h - F ||_{L^2} = " << error <<
'\n' << endl;
265 ostringstream mesh_name, sol_name;
266 mesh_name <<
"mesh." << setfill(
'0') << setw(6) << myid;
267 sol_name <<
"sol." << setfill(
'0') << setw(6) << myid;
269 ofstream mesh_ofs(mesh_name.str().c_str());
270 mesh_ofs.precision(8);
271 pmesh->
Print(mesh_ofs);
273 ofstream sol_ofs(sol_name.str().c_str());
274 sol_ofs.precision(8);
284 sol_sock <<
"parallel " << num_procs <<
" " << myid <<
"\n";
285 sol_sock.precision(8);
286 sol_sock <<
"solution\n" << *pmesh << x << flush;
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
int Size() const
Return the logical size of the array.
Conjugate gradient method.
void Mult(const Vector &b, Vector &x) const override
Iterative solution of the linear system using the Conjugate Gradient method.
void SetOperator(const Operator &op) override
Set/update the solver for the given operator.
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
A coefficient that is constant across space and time.
The MFEM Device class abstracts hardware devices such as GPUs, as well as programming models such as ...
void Print(std::ostream &os=mfem::out)
Print the configuration of the MFEM virtual device object.
for Raviart-Thomas elements
Collection of finite elements from the same family in multiple dimensions. This class is used to matc...
The Auxiliary-space Divergence Solver in hypre.
The Auxiliary-space Maxwell Solver in hypre.
The BoomerAMG solver in hypre.
Wrapper for hypre's ParCSR matrix class.
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)
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
int GetNE() const
Returns number of elements.
int Dimension() const
Dimension of the reference space used within the elements.
int SpaceDimension() const
Dimension of the physical space containing the mesh.
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
static int WorldRank()
Return the MPI rank in MPI_COMM_WORLD.
static int WorldSize()
Return the size of MPI_COMM_WORLD.
static void Init(int &argc, char **&argv, int required=default_thread_required, int *provided=nullptr)
Singleton creation with Mpi::Init(argc, argv).
Pointer to an Operator of a specified type.
OpType * As() const
Return the Operator pointer statically cast to a specified OpType. Similar to the method Get().
Jacobi smoothing for a given bilinear form (no matrix necessary).
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.
void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list, int component=-1) const override
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
Returns ||u_ex - u_h||_L2 in parallel for H1 or L2 elements.
void ProjectCoefficient(Coefficient &coeff, ProjectType type=ProjectType::DEFAULT) override
Project coeff Coefficient to this GridFunction. The projection computation depends on the choice of t...
Class for parallel meshes.
void Print(std::ostream &out=mfem::out, const std::string &comments="") const override
Arbitrary order H(div)-conforming Raviart-Thomas finite elements.
for VectorFiniteElements (Nedelec, Raviart-Thomas)
A general vector function coefficient.
int Size() const
Returns the size of the vector.
const int * ess_tdof_list
void f_exact(const Vector &, Vector &)
void F_exact(const Vector &, Vector &)
std::function< real_t(const Vector &)> f(real_t mass_coeff)
real_t p(const Vector &x, real_t t)