61int main(
int argc,
char *argv[])
70 const char *mesh_file =
"../data/beam-tet.mesh";
72 bool static_cond =
false;
75 const char *device_config =
"cpu";
76 bool visualization =
true;
82 args.
AddOption(&mesh_file,
"-m",
"--mesh",
85 "Finite element order (polynomial degree).");
86 args.
AddOption(&
freq,
"-f",
"--frequency",
"Set the frequency for the exact"
88 args.
AddOption(&static_cond,
"-sc",
"--static-condensation",
"-no-sc",
89 "--no-static-condensation",
"Enable static condensation.");
90 args.
AddOption(&pa,
"-pa",
"--partial-assembly",
"-no-pa",
91 "--no-partial-assembly",
"Enable Partial Assembly.");
92 args.
AddOption(&nc,
"-nc",
"--non-conforming",
"-c",
94 "Mark the mesh as nonconforming before partitioning.");
95 args.
AddOption(&device_config,
"-d",
"--device",
96 "Device configuration string, see Device::Configure().");
97 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
99 "Enable or disable GLVis visualization.");
101 args.
AddOption(&useAmgX,
"-amgx",
"--useAmgX",
"-no-amgx",
103 "Enable or disable AmgX in MatrixFreeAMS.");
123 Device device(device_config);
124 if (myid == 0) { device.
Print(); }
129 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
143 int ref_levels = (int)floor(log(1000./mesh->
GetNE())/log(2.)/
dim);
144 for (
int l = 0; l < ref_levels; l++)
156 int par_ref_levels = 2;
157 for (
int l = 0; l < par_ref_levels; l++)
170 cout <<
"Number of finite element unknowns: " << size << endl;
210 if (pa) {
a->SetAssemblyLevel(AssemblyLevel::PARTIAL); }
218 if (static_cond) {
a->EnableStaticCondensation(); }
223 a->FormLinearSystem(ess_tdof_list, x, *
b, A, X, B);
245 cout <<
"Size of linear system: "
250 (
a->StaticCondensationIsEnabled() ?
a->SCParFESpace() : fespace);
262 a->RecoverFEMSolution(X, *
b, x);
269 cout <<
"\n|| E_h - E ||_{L^2} = " << error <<
'\n' << endl;
276 ostringstream mesh_name, sol_name;
277 mesh_name <<
"mesh." << setfill(
'0') << setw(6) << myid;
278 sol_name <<
"sol." << setfill(
'0') << setw(6) << myid;
280 ofstream mesh_ofs(mesh_name.str().c_str());
281 mesh_ofs.precision(8);
282 pmesh->
Print(mesh_ofs);
284 ofstream sol_ofs(sol_name.str().c_str());
285 sol_ofs.precision(8);
295 sol_sock <<
"parallel " << num_procs <<
" " << myid <<
"\n";
296 sol_sock.precision(8);
297 sol_sock <<
"solution\n" << *pmesh << x << flush;
317 E(0) = sin(
kappa * x(1));
318 E(1) = sin(
kappa * x(2));
319 E(2) = sin(
kappa * x(0));
323 E(0) = sin(
kappa * x(1));
324 E(1) = sin(
kappa * x(0));
325 if (x.
Size() == 3) { E(2) = 0.0; }
341 if (x.
Size() == 3) {
f(2) = 0.0; }
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
int Size() const
Return the logical size of the array.
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.
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.
Integrator for for Nedelec elements.
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.
Collection of finite elements from the same family in multiple dimensions. This class is used to matc...
The Auxiliary-space Maxwell Solver in hypre.
void SetPrintLevel(int print_lvl)
void SetPreconditioner(HypreSolver &precond)
Set the hypre solver to be used as a preconditioner.
virtual void Mult(const HypreParVector &b, HypreParVector &x) const
Solve Ax=b with hypre's PCG.
void SetMaxIter(int max_iter)
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)
An auxiliary Maxwell solver for a high-order curl-curl system without high-order assembly.
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 EnsureNCMesh(bool simplices_nonconforming=false)
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).
Arbitrary order H(curl)-conforming Nedelec finite elements.
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().
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
void PrintUsage(std::ostream &out) const
Print the usage message.
void PrintOptions(std::ostream &out) const
Print the options.
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...
bool Good() const
Return true if the command line options were parsed successfully.
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
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 Print(std::ostream &out=mfem::out, const std::string &comments="") const override
for VectorFiniteElements (Nedelec, Raviart-Thomas)
A general vector function coefficient.
int Size() const
Returns the size of the vector.
real_t sigma(const Vector &x)
void E_exact(const Vector &, Vector &)
void f_exact(const Vector &, Vector &)
std::function< real_t(const Vector &)> f(real_t mass_coeff)