59 int main(
int argc,
char *argv[])
62 const char *mesh_file =
"../data/beam-tet.mesh";
64 bool static_cond =
false;
66 const char *device_config =
"cpu";
67 bool visualization = 1;
70 args.
AddOption(&mesh_file,
"-m",
"--mesh",
73 "Finite element order (polynomial degree).");
74 args.
AddOption(&
freq,
"-f",
"--frequency",
"Set the frequency for the exact"
76 args.
AddOption(&static_cond,
"-sc",
"--static-condensation",
"-no-sc",
77 "--no-static-condensation",
"Enable static condensation.");
78 args.
AddOption(&pa,
"-pa",
"--partial-assembly",
"-no-pa",
79 "--no-partial-assembly",
"Enable Partial Assembly.");
80 args.
AddOption(&device_config,
"-d",
"--device",
81 "Device configuration string, see Device::Configure().");
82 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
84 "Enable or disable GLVis visualization.");
96 Device device(device_config);
102 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
113 for (
int l = 0; l < ref_levels; l++)
123 cout <<
"Number of finite element unknowns: "
177 cout <<
"Size of linear system: " << A->
Height() << endl;
183 PCG(*A, M, B, X, 1, 1000, 1e-12, 0.0);
187 #ifndef MFEM_USE_SUITESPARSE
191 PCG(*A, M, B, X, 1, 500, 1e-12, 0.0);
196 umf_solver.
Control[UMFPACK_ORDERING] = UMFPACK_ORDERING_METIS;
198 umf_solver.
Mult(B, X);
206 cout <<
"\n|| E_h - E ||_{L^2} = " << x.
ComputeL2Error(E) <<
'\n' << endl;
211 ofstream mesh_ofs(
"refined.mesh");
212 mesh_ofs.precision(8);
213 mesh->
Print(mesh_ofs);
214 ofstream sol_ofs(
"sol.gf");
215 sol_ofs.precision(8);
225 sol_sock.precision(8);
226 sol_sock <<
"solution\n" << *mesh << x << flush;
254 if (x.
Size() == 3) { E(2) = 0.0; }
270 if (x.
Size() == 3) {
f(2) = 0.0; }
int Size() const
Return the logical size of the array.
Class for grid function - Vector with associated FE space.
A coefficient that is constant across space and time.
virtual double ComputeL2Error(Coefficient &exsol, const IntegrationRule *irs[]=NULL) const
Integrator for (curl u, curl v) for Nedelec elements.
Pointer to an Operator of a specified type.
int Size() const
Returns the size of the vector.
virtual void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list, int component=-1)
Get a list of essential true dofs, ess_tdof_list, corresponding to the boundary attributes marked in ...
int GetNE() const
Returns number of elements.
void Print(std::ostream &out=mfem::out)
Print the configuration of the MFEM virtual device object.
Data type for Gauss-Seidel smoother of sparse matrix.
Direct sparse solver using UMFPACK.
virtual void Save(std::ostream &out) const
Save the GridFunction to an output stream.
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
Jacobi smoothing for a given bilinear form (no matrix necessary).
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
void PCG(const Operator &A, Solver &B, const Vector &b, Vector &x, int print_iter, int max_num_iter, double RTOLERANCE, double ATOLERANCE)
Preconditioned conjugate gradient method. (tolerances are squared)
virtual int GetTrueVSize() const
Return the number of vector true (conforming) dofs.
void PrintUsage(std::ostream &out) const
Print the usage message.
A general vector function coefficient.
int SpaceDimension() const
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
double Control[UMFPACK_CONTROL]
FDualNumber< tbase > sin(const FDualNumber< tbase > &f)
sin([dual number])
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
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 f_exact(const Vector &, Vector &)
FDualNumber< tbase > log(const FDualNumber< tbase > &f)
log([dual number])
virtual void Print(std::ostream &os=mfem::out) const
void PrintOptions(std::ostream &out) const
Print the options.
virtual void ProjectCoefficient(Coefficient &coeff)
Project coeff Coefficient to this GridFunction. The projection computation depends on the choice of t...
void E_exact(const Vector &, Vector &)
for VectorFiniteElements (Nedelec, Raviart-Thomas)
Arbitrary order H(curl)-conforming Nedelec finite elements.
The MFEM Device class abstracts hardware devices such as GPUs, as well as programming models such as ...
virtual void Mult(const Vector &b, Vector &x) const
Operator application: y=A(x).
double f(const Vector &p)
virtual void SetOperator(const Operator &op)
Factorize the given Operator op which must be a SparseMatrix.
double sigma(const Vector &x)
bool Good() const
Return true if the command line options were parsed successfully.