81 "--enable-petsc, --enable-trilinos, or --enable-eigen");
84 GetPot infile(
"vector_fe_ex9.in");
87 infile.parse_command_line(argc, argv);
90 const unsigned int dimension = 2;
91 const unsigned int grid_size = infile(
"grid_size", 2);
92 const bool mms = infile(
"mms",
true);
93 const Real nu = infile(
"nu", 1.);
94 const bool cavity = infile(
"cavity",
false);
97 libmesh_example_requires(dimension <= LIBMESH_DIM, dimension <<
"D support");
106 const std::string elem_str = infile(
"element_type", std::string(
"TRI6"));
108 libmesh_error_msg_if(elem_str !=
"TRI6" && elem_str !=
"TRI7",
111 <<
" but this example must be run with TRI6, TRI7, QUAD8, or QUAD9 in 2d" 112 <<
" or with TET14, or HEX27 in 3d.");
116 mesh, grid_size, grid_size, 0., 2., -1, 1., Utility::string_to_enum<ElemType>(elem_str));
119 mesh, grid_size, grid_size, -1, 1, -1, 1., Utility::string_to_enum<ElemType>(elem_str));
128 Utility::string_to_enum<ElemType>(elem_str));
155 if (system.has_static_condensation())
157 sc = &system.get_static_condensation();
163 hdg.system = &system;
164 hdg.dof_map = &system.get_dof_map();
165 hdg.vector_fe = FEVectorBase::build(dimension, vector_fe_type);
166 hdg.scalar_fe = FEBase::build(dimension, scalar_fe_type);
167 hdg.qrule = QBase::build(
QGAUSS, dimension,
FIFTH);
168 hdg.qface = QBase::build(
QGAUSS, dimension - 1,
FIFTH);
169 hdg.vector_fe_face = FEVectorBase::build(dimension, vector_fe_type);
170 hdg.scalar_fe_face = FEBase::build(dimension, scalar_fe_type);
171 hdg.lm_fe_face = FEBase::build(dimension, lm_fe_type);
175 system.nonlinear_solver->residual_object = &hdg;
176 system.nonlinear_solver->jacobian_object = &hdg;
181 equation_systems.init();
182 equation_systems.print_info();
193 equation_systems.parameters.set<
const ExactSoln *>(
"vel_x_exact_sol") = &hdg.u_true_soln;
194 equation_systems.parameters.set<
const ExactSoln *>(
"vel_y_exact_sol") = &hdg.v_true_soln;
195 equation_systems.parameters.set<
const ExactSoln *>(
"pressure_exact_sol") = &hdg.p_true_soln;
200 exact_sol.compute_error(
"HDG",
"vel_x");
201 exact_sol.compute_error(
"HDG",
"vel_y");
202 exact_sol.compute_error(
"HDG",
"pressure");
205 libMesh::out <<
"L2 error for u is: " << exact_sol.l2_error(
"HDG",
"vel_x") << std::endl;
206 libMesh::out <<
"L2 error for v is: " << exact_sol.l2_error(
"HDG",
"vel_y") << std::endl;
207 libMesh::out <<
"L2 error for pressure is: " << exact_sol.l2_error(
"HDG",
"pressure")
211 #ifdef LIBMESH_HAVE_EXODUS_API 216 #endif // #ifdef LIBMESH_HAVE_EXODUS_API class FEType hides (possibly multiple) FEFamily and approximation orders, thereby enabling specialize...
This class handles the computation of the L2 and/or H1 error for the Systems in the EquationSystems o...
This is the EquationSystems class.
The ExodusII_IO class implements reading meshes in the ExodusII file format from Sandia National Labs...
Number compute_error(const Point &p, const Parameters ¶ms, const std::string &, const std::string &unknown_name)
The LibMeshInit class, when constructed, initializes the dependent libraries (e.g.
void dont_condense_vars(const std::unordered_set< unsigned int > &vars)
Add vars to the list of variables not to condense.
SolverPackage default_solver_package()
virtual void init(const numeric_index_type m, const numeric_index_type n, const numeric_index_type m_l, const numeric_index_type n_l, const numeric_index_type nnz=30, const numeric_index_type noz=10, const numeric_index_type blocksize=1) override
Initialize SparseMatrix with the specified sizes.
virtual void write_equation_systems(const std::string &fname, const EquationSystems &es, const std::set< std::string > *system_names=nullptr) override
Writes out the solution for no specific time or timestep.
void print_info(std::ostream &os=libMesh::out, const unsigned int verbosity=0, const bool global=true) const
Prints relevant information about the mesh.
void init(triangulateio &t)
Initializes the fields of t to nullptr/0 as necessary.
Manages consistently variables, degrees of freedom, coefficient vectors, matrices and non-linear solv...
unsigned int add_variable(std::string_view var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
Adds the variable var to the list of variables for this system.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void attach_exact_value(unsigned int sys_num, FunctionBase< Number > *f)
Clone and attach an arbitrary functor which computes the exact value of the system sys_num solution a...
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.