49 int main(
int argc,
char *argv[])
52 const char *mesh_file =
"../data/beam-tet.mesh";
54 bool static_cond =
false;
55 bool visualization = 1;
58 args.
AddOption(&mesh_file,
"-m",
"--mesh",
61 "Finite element order (polynomial degree).");
62 args.
AddOption(&
freq,
"-f",
"--frequency",
"Set the frequency for the exact"
64 args.
AddOption(&static_cond,
"-sc",
"--static-condensation",
"-no-sc",
65 "--no-static-condensation",
"Enable static condensation.");
66 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
68 "Enable or disable GLVis visualization.");
81 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
91 (int)floor(log(50000./mesh->
GetNE())/log(2.)/
dim);
92 for (
int l = 0; l < ref_levels; l++)
103 cout <<
"Number of finite element unknowns: "
156 cout <<
"Size of linear system: " << A.
Height() << endl;
158 #ifndef MFEM_USE_SUITESPARSE
162 PCG(A, M, B, X, 1, 500, 1e-12, 0.0);
166 umf_solver.
Control[UMFPACK_ORDERING] = UMFPACK_ORDERING_METIS;
168 umf_solver.
Mult(B, X);
175 cout <<
"\n|| E_h - E ||_{L^2} = " << x.
ComputeL2Error(E) <<
'\n' << endl;
180 ofstream mesh_ofs(
"refined.mesh");
181 mesh_ofs.precision(8);
182 mesh->
Print(mesh_ofs);
183 ofstream sol_ofs(
"sol.gf");
184 sol_ofs.precision(8);
191 char vishost[] =
"localhost";
194 sol_sock.precision(8);
195 sol_sock <<
"solution\n" << *mesh << x << flush;
215 E(0) = sin(
kappa * x(1));
216 E(1) = sin(
kappa * x(2));
217 E(2) = sin(
kappa * x(0));
221 E(0) = sin(
kappa * x(1));
222 E(1) = sin(
kappa * x(0));
223 if (x.
Size() == 3) { E(2) = 0.0; }
239 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.
int main(int argc, char *argv[])
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 *)
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 void ReorientTetMesh()
void PrintUsage(std::ostream &out) const
int SpaceDimension() const
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
double Control[UMFPACK_CONTROL]
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: y=A(x).
virtual void SetOperator(const Operator &op)
Factorize the given Operator op which must be a SparseMatrix.
virtual void Print(std::ostream &out=std::cout) const