59 int main(
int argc,
char *argv[])
62 Mpi::Init(argc, argv);
63 int num_procs = Mpi::WorldSize();
64 int myid = Mpi::WorldRank();
68 const char *mesh_file =
"../data/star.mesh";
71 bool static_cond =
false;
72 bool hybridization =
false;
74 const char *device_config =
"cpu";
75 bool visualization = 1;
78 args.
AddOption(&mesh_file,
"-m",
"--mesh",
81 "Finite element order (polynomial degree).");
82 args.
AddOption(&set_bc,
"-bc",
"--impose-bc",
"-no-bc",
"--dont-impose-bc",
83 "Impose or not essential boundary conditions.");
84 args.
AddOption(&
freq,
"-f",
"--frequency",
"Set the frequency for the exact" 86 args.
AddOption(&static_cond,
"-sc",
"--static-condensation",
"-no-sc",
87 "--no-static-condensation",
"Enable static condensation.");
88 args.
AddOption(&hybridization,
"-hb",
"--hybridization",
"-no-hb",
89 "--no-hybridization",
"Enable hybridization.");
90 args.
AddOption(&pa,
"-pa",
"--partial-assembly",
"-no-pa",
91 "--no-partial-assembly",
"Enable Partial Assembly.");
92 args.
AddOption(&device_config,
"-d",
"--device",
93 "Device configuration string, see Device::Configure().");
94 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
96 "Enable or disable GLVis visualization.");
114 Device device(device_config);
115 if (myid == 0) { device.
Print(); }
120 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
130 (int)floor(log(1000./mesh->
GetNE())/log(2.)/
dim);
131 for (
int l = 0; l < ref_levels; l++)
143 int par_ref_levels = 2;
144 for (
int l = 0; l < par_ref_levels; l++)
157 cout <<
"Number of finite element unknowns: " << size << endl;
168 ess_bdr = set_bc ? 1 : 0;
196 if (pa) {
a->SetAssemblyLevel(AssemblyLevel::PARTIAL); }
209 a->EnableStaticCondensation();
211 else if (hybridization)
222 a->FormLinearSystem(ess_tdof_list, x, *
b, A, X, B);
224 if (myid == 0 && !pa)
226 cout <<
"Size of linear system: " 245 (
a->StaticCondensationIsEnabled() ?
a->SCParFESpace() : fespace);
254 a->RecoverFEMSolution(X, *
b, x);
261 cout <<
"\n|| F_h - F ||_{L^2} = " << error <<
'\n' << endl;
268 ostringstream mesh_name, sol_name;
269 mesh_name <<
"mesh." << setfill(
'0') << setw(6) << myid;
270 sol_name <<
"sol." << setfill(
'0') << setw(6) << myid;
272 ofstream mesh_ofs(mesh_name.str().c_str());
273 mesh_ofs.precision(8);
274 pmesh->
Print(mesh_ofs);
276 ofstream sol_ofs(sol_name.str().c_str());
277 sol_ofs.precision(8);
287 sol_sock <<
"parallel " << num_procs <<
" " << myid <<
"\n";
288 sol_sock.precision(8);
289 sol_sock <<
"solution\n" << *pmesh << x << flush;
virtual void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list, int component=-1)
Conjugate gradient method.
The Auxiliary-space Maxwell Solver in hypre.
The Auxiliary-space Divergence Solver in hypre.
A coefficient that is constant across space and time.
void PrintOptions(std::ostream &out) const
Print the options.
int Dimension() const
Dimension of the reference space used within the elements.
void f_exact(const Vector &, Vector &)
void PrintUsage(std::ostream &out) const
Print the usage message.
Pointer to an Operator of a specified type.
int main(int argc, char *argv[])
virtual void Mult(const Vector &b, Vector &x) const
Operator application: y=A(x).
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
void Print(std::ostream &out=mfem::out)
Print the configuration of the MFEM virtual device object.
bool Good() const
Return true if the command line options were parsed successfully.
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
void F_exact(const Vector &, Vector &)
The BoomerAMG solver in hypre.
virtual void SetPrintLevel(int print_lvl)
Legacy method to set the level of verbosity of the solver output.
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
Jacobi smoothing for a given bilinear form (no matrix necessary).
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
void SetMaxIter(int max_it)
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.
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
double p(const Vector &x, double t)
void SetRelTol(double rtol)
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
Collection of finite elements from the same family in multiple dimensions. This class is used to matc...
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...
int SpaceDimension() const
Dimension of the physical space containing the mesh.
virtual void Save(std::ostream &out) const
int GetNE() const
Returns number of elements.
OpType * As() const
Return the Operator pointer statically cast to a specified OpType. Similar to the method Get()...
int Size() const
Return the logical size of the array.
for VectorFiniteElements (Nedelec, Raviart-Thomas)
virtual void SetOperator(const Operator &op)
Also calls SetOperator for the preconditioner if there is one.
virtual void SetPreconditioner(Solver &pr)
This should be called before SetOperator.
void Print(std::ostream &out=mfem::out) const override
Class for parallel grid function.
The MFEM Device class abstracts hardware devices such as GPUs, as well as programming models such as ...
Wrapper for hypre's ParCSR matrix class.
Class for parallel meshes.
double f(const Vector &p)