23#include "libmesh/string_to_enum.h"
26#include "libmesh/enum_solver_package.h"
29#include "libmesh/mesh.h"
30#include "libmesh/mesh_generation.h"
31#include "libmesh/mesh_modification.h"
34#include "libmesh/dense_matrix.h"
35#include "libmesh/sparse_matrix.h"
36#include "libmesh/dense_vector.h"
37#include "libmesh/numeric_vector.h"
40#include "libmesh/fe.h"
41#include "libmesh/fe_interface.h"
42#include "libmesh/elem.h"
45#include "libmesh/quadrature_gauss.h"
46#include "libmesh/enum_quadrature_type.h"
49#include "libmesh/dof_map.h"
52#include "libmesh/equation_systems.h"
53#include "libmesh/nonlinear_implicit_system.h"
54#include "libmesh/nonlinear_solver.h"
55#include "libmesh/static_condensation.h"
58#include "libmesh/exact_solution.h"
59#include "libmesh/enum_norm_type.h"
63#include "libmesh/getpot.h"
64#include "libmesh/exodusII_io.h"
72main(
int argc,
char ** argv)
82 GetPot infile(
"vector_fe_ex9.in");
85 infile.parse_command_line(argc, argv);
88 const unsigned int dimension = 2;
89 const unsigned int grid_size = infile(
"grid_size", 2);
90 const bool mms = infile(
"mms",
true);
91 const Real nu = infile(
"nu", 1.);
92 const bool cavity = infile(
"cavity",
false);
95 libmesh_example_requires(dimension <= LIBMESH_DIM, dimension <<
"D support");
98#if !defined(LIBMESH_HAVE_EIGEN_DENSE)
100 libmesh_example_requires(
false,
"--enable-eigen");
110 const std::string elem_str = infile(
"element_type", std::string(
"TRI6"));
112 libmesh_error_msg_if(elem_str !=
"TRI6" && elem_str !=
"TRI7",
115 <<
" but this example must be run with TRI6, TRI7, QUAD8, or QUAD9 in 2d"
116 <<
" or with TET14, or HEX27 in 3d.");
120 mesh, grid_size, grid_size, 0., 2., -1, 1., Utility::string_to_enum<ElemType>(elem_str));
123 mesh, grid_size, grid_size, -1, 1, -1, 1., Utility::string_to_enum<ElemType>(elem_str));
132 Utility::string_to_enum<ElemType>(elem_str));
159 if (system.has_static_condensation())
161 sc = &system.get_static_condensation();
168 hdg.
dof_map = &system.get_dof_map();
179 system.nonlinear_solver->residual_object = &hdg;
180 system.nonlinear_solver->jacobian_object = &hdg;
185 equation_systems.
init();
215#ifdef LIBMESH_HAVE_EXODUS_API
This is the EquationSystems class.
void print_info(std::ostream &os=libMesh::out) const
Prints information about the equation systems, by default to libMesh::out.
Parameters parameters
Data structure holding arbitrary parameters.
virtual void init()
Initialize all the systems.
virtual System & add_system(std::string_view system_type, std::string_view name)
Add the system of type system_type named name to the systems array.
This class handles the computation of the L2 and/or H1 error for the Systems in the EquationSystems o...
Real l2_error(std::string_view sys_name, std::string_view unknown_name)
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...
void compute_error(std::string_view sys_name, std::string_view unknown_name)
Computes and stores the error in the solution value e = u-u_h, the gradient grad(e) = grad(u) - grad(...
The ExodusII_IO class implements reading meshes in the ExodusII file format from Sandia National Labs...
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.
static std::unique_ptr< FEGenericBase > build(const unsigned int dim, const FEType &type)
Builds a specific finite element type.
class FEType hides (possibly multiple) FEFamily and approximation orders, thereby enabling specialize...
std::unique_ptr< FEVectorBase > vector_fe_face
std::unique_ptr< FEBase > scalar_fe
std::unique_ptr< QBase > qrule
std::unique_ptr< QBase > qface
std::unique_ptr< FEBase > scalar_fe_face
std::unique_ptr< FEVectorBase > vector_fe
std::unique_ptr< FEBase > lm_fe_face
The LibMeshInit class, when constructed, initializes the dependent libraries (e.g.
void print_info(std::ostream &os=libMesh::out, const unsigned int verbosity=0, const bool global=true) const
Prints relevant information about the mesh.
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Manages consistently variables, degrees of freedom, coefficient vectors, matrices and non-linear solv...
T & set(const std::string &)
static std::unique_ptr< QBase > build(std::string_view name, const unsigned int dim, const Order order=INVALID_ORDER)
Builds a specific quadrature rule based on the name string.
void dont_condense_vars(const std::unordered_set< unsigned int > &vars)
Add vars to the list of variables not to condense.
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.
The libMesh namespace provides an interface to certain functionality in the library.
SolverPackage default_solver_package()
Number compute_error(const Point &p, const Parameters ¶ms, const std::string &, const std::string &unknown_name)
bool on_command_line(std::string arg)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real