50 int main(
int argc,
char *argv[])
53 const char *mesh_file =
"../data/beam-tet.mesh";
55 bool static_cond =
false;
56 bool visualization = 1;
59 args.
AddOption(&mesh_file,
"-m",
"--mesh",
62 "Finite element order (polynomial degree).");
63 args.
AddOption(&
freq,
"-f",
"--frequency",
"Set the frequency for the exact"
65 args.
AddOption(&static_cond,
"-sc",
"--static-condensation",
"-no-sc",
66 "--no-static-condensation",
"Enable static condensation.");
67 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
69 "Enable or disable GLVis visualization.");
83 ifstream imesh(mesh_file);
86 cerr <<
"\nCan not open mesh file: " << mesh_file <<
'\n' << endl;
89 mesh =
new Mesh(imesh, 1, 1);
100 (int)floor(log(50000./mesh->
GetNE())/log(2.)/
dim);
101 for (
int l = 0; l < ref_levels; l++)
112 cout <<
"Number of finite element unknowns: "
165 cout <<
"Size of linear system: " << A.
Height() << endl;
167 #ifndef MFEM_USE_SUITESPARSE
171 PCG(A, M, B, X, 1, 500, 1e-12, 0.0);
175 umf_solver.
Control[UMFPACK_ORDERING] = UMFPACK_ORDERING_METIS;
177 umf_solver.
Mult(B, X);
184 cout <<
"\n|| E_h - E ||_{L^2} = " << x.
ComputeL2Error(E) <<
'\n' << endl;
189 ofstream mesh_ofs(
"refined.mesh");
190 mesh_ofs.precision(8);
191 mesh->
Print(mesh_ofs);
192 ofstream sol_ofs(
"sol.gf");
193 sol_ofs.precision(8);
200 char vishost[] =
"localhost";
203 sol_sock.precision(8);
204 sol_sock <<
"solution\n" << *mesh << x << flush;
224 E(0) = sin(
kappa * x(1));
225 E(1) = sin(
kappa * x(2));
226 E(2) = sin(
kappa * x(0));
230 E(0) = sin(
kappa * x(1));
231 E(1) = sin(
kappa * x(0));
232 if (x.
Size() == 3) { E(2) = 0.0; }
248 if (x.
Size() == 3) { f(2) = 0.0; }
int Size() const
Logical size of the array.
Class for grid function - Vector with associated FE space.
Subclass constant coefficient.
Integrator for (curl u, curl v) for Nedelec elements.
virtual void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list)
int Size() const
Returns the size of the vector.
int GetNE() const
Returns number of elements.
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.
double ComputeL2Error(Coefficient &exsol, const IntegrationRule *irs[]=NULL) const
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows.
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
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 void ReorientTetMesh()
void PrintUsage(std::ostream &out) const
int SpaceDimension() const
virtual void Print(std::ostream &out=std::cout) const
Print the mesh to the given stream using the default MFEM mesh format.
Array< int > bdr_attributes
int main(int argc, char *argv[])
double Control[UMFPACK_CONTROL]
Abstract finite element space.
Base class Coefficient that may optionally depend on time.
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)
void f_exact(const Vector &, Vector &)
virtual int GetTrueVSize()
Return the number of vector true (conforming) dofs.
void PrintOptions(std::ostream &out) const
void ProjectCoefficient(Coefficient &coeff)
void E_exact(const Vector &, Vector &)
for VectorFiniteElements (Nedelec, Raviart-Thomas)
Arbitrary order H(curl)-conforming Nedelec finite elements.
Integrator for (Q u, v) for VectorFiniteElements.
virtual void Mult(const Vector &b, Vector &x) const
Operator application.
virtual void SetOperator(const Operator &op)
Set/update the solver for the given operator.