60 int main(
int argc,
char *argv[])
63 Mpi::Init(argc, argv);
64 int num_procs = Mpi::WorldSize();
65 int myid = Mpi::WorldRank();
69 const char *mesh_file =
"../data/beam-tet.mesh";
71 bool static_cond =
false;
73 const char *device_config =
"cpu";
74 bool visualization =
true;
80 args.
AddOption(&mesh_file,
"-m",
"--mesh",
83 "Finite element order (polynomial degree).");
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(&pa,
"-pa",
"--partial-assembly",
"-no-pa",
89 "--no-partial-assembly",
"Enable Partial Assembly.");
90 args.
AddOption(&device_config,
"-d",
"--device",
91 "Device configuration string, see Device::Configure().");
92 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
94 "Enable or disable GLVis visualization.");
96 args.
AddOption(&useAmgX,
"-amgx",
"--useAmgX",
"-no-amgx",
98 "Enable or disable AmgX in MatrixFreeAMS.");
118 Device device(device_config);
119 if (myid == 0) { device.
Print(); }
124 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
133 int ref_levels = (int)floor(
log(1000./mesh->
GetNE())/
log(2.)/
dim);
134 for (
int l = 0; l < ref_levels; l++)
146 int par_ref_levels = 2;
147 for (
int l = 0; l < par_ref_levels; l++)
160 cout <<
"Number of finite element unknowns: " << size << endl;
219 MatrixFreeAMS ams(*a, *A, *fespace, muinv, sigma, NULL, ess_bdr, useAmgX);
221 MatrixFreeAMS ams(*a, *A, *fespace, muinv, sigma, NULL, ess_bdr);
235 cout <<
"Size of linear system: "
259 cout <<
"\n|| E_h - E ||_{L^2} = " << error <<
'\n' << endl;
266 ostringstream mesh_name, sol_name;
267 mesh_name <<
"mesh." << setfill(
'0') << setw(6) << myid;
268 sol_name <<
"sol." << setfill(
'0') << setw(6) << myid;
270 ofstream mesh_ofs(mesh_name.str().c_str());
271 mesh_ofs.precision(8);
272 pmesh->
Print(mesh_ofs);
274 ofstream sol_ofs(sol_name.str().c_str());
275 sol_ofs.precision(8);
285 sol_sock <<
"parallel " << num_procs <<
" " << myid <<
"\n";
286 sol_sock.precision(8);
287 sol_sock <<
"solution\n" << *pmesh << x << flush;
315 if (x.
Size() == 3) { E(2) = 0.0; }
331 if (x.
Size() == 3) {
f(2) = 0.0; }
int Size() const
Return the logical size of the array.
virtual void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list, int component=-1)
Conjugate gradient method.
OpType * As() const
Return the Operator pointer statically cast to a specified OpType. Similar to the method Get()...
The Auxiliary-space Maxwell Solver in hypre.
A coefficient that is constant across space and time.
virtual void Mult(const Vector &b, Vector &x) const
Operator application: y=A(x).
Integrator for (curl u, curl v) for Nedelec elements.
Pointer to an Operator of a specified type.
HYPRE_BigInt GlobalTrueVSize() const
int Size() const
Returns the size of the vector.
int GetNE() const
Returns number of elements.
virtual void Save(std::ostream &out) const
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...
void SetPrintLevel(int print_lvl)
An auxiliary Maxwell solver for a high-order curl-curl system without high-order assembly.
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 ...
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
void SetMaxIter(int max_it)
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
void PrintUsage(std::ostream &out) const
Print the usage message.
void SetMaxIter(int max_iter)
A general vector function coefficient.
int SpaceDimension() const
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
void SetRelTol(double rtol)
FDualNumber< tbase > sin(const FDualNumber< tbase > &f)
sin([dual number])
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...
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
void f_exact(const Vector &, Vector &)
FDualNumber< tbase > log(const FDualNumber< tbase > &f)
log([dual number])
virtual double ComputeL2Error(Coefficient *exsol[], const IntegrationRule *irs[]=NULL) const
void SetPreconditioner(HypreSolver &precond)
Set the hypre solver to be used as a preconditioner.
void PrintOptions(std::ostream &out) const
Print the options.
void E_exact(const Vector &, Vector &)
for VectorFiniteElements (Nedelec, Raviart-Thomas)
virtual void SetOperator(const Operator &op)
Also calls SetOperator for the preconditioner if there is one.
Arbitrary order H(curl)-conforming Nedelec finite elements.
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.
virtual void Mult(const HypreParVector &b, HypreParVector &x) const
Solve Ax=b with hypre's PCG.
Class for parallel meshes.
double f(const Vector &p)
double sigma(const Vector &x)
bool Good() const
Return true if the command line options were parsed successfully.