Go to the documentation of this file.
28 #include "libmesh/equation_systems.h"
29 #include "libmesh/getpot.h"
30 #include "libmesh/exodusII_io.h"
31 #include "libmesh/mesh.h"
32 #include "libmesh/mesh_generation.h"
33 #include "libmesh/exact_solution.h"
34 #include "libmesh/string_to_enum.h"
35 #include "libmesh/enum_solver_package.h"
36 #include "libmesh/enum_norm_type.h"
39 #include "curl_curl_system.h"
40 #include "libmesh/diff_solver.h"
41 #include "libmesh/steady_solver.h"
42 #include "solution_function.h"
49 int main (
int argc,
char ** argv)
56 "--enable-petsc, --enable-trilinos, or --enable-eigen");
59 GetPot infile(
"vector_fe_ex3.in");
62 const unsigned int grid_size = infile(
"grid_size", 2);
65 libmesh_example_requires(3 <= LIBMESH_DIM,
"2D/3D support");
74 std::string elem_str =
78 if (elem_str !=
"TRI6" && elem_str !=
"QUAD8" && elem_str !=
"QUAD9")
79 libmesh_error_msg(
"You selected: " \
81 <<
" but this example must be run with TRI6, QUAD8, or QUAD9.");
88 Utility::string_to_enum<ElemType>(elem_str));
102 system.
time_solver = libmesh_make_unique<SteadySolver>(system);
105 equation_systems.
init();
109 solver.
quiet = infile(
"solver_quiet",
true);
131 std::vector<FunctionBase<Number> *> sols(1, &soln_func);
132 std::vector<FunctionBase<Gradient> *> grads(1, &soln_grad);
138 int extra_error_quadrature = infile(
"extra_error_quadrature", 2);
146 << exact_sol.
l2_error(
"CurlCurl",
"u")
155 #ifdef LIBMESH_HAVE_EXODUS_API
160 #endif // #ifdef LIBMESH_HAVE_EXODUS_API
This class handles the computation of the L2 and/or H1 error for the Systems in the EquationSystems o...
void attach_exact_derivs(const std::vector< FunctionBase< Gradient > * > &g)
Clone and attach arbitrary functors which compute the exact gradients of the EquationSystems' solutio...
virtual void solve() override
Invokes the solver associated with the system.
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
virtual System & add_system(const std::string &system_type, const std::string &name)
Add the system of type system_type named name to the systems array.
FEMSystem, TimeSolver and NewtonSolver will handle most tasks, but we must specify element residuals.
The libMesh namespace provides an interface to certain functionality in the library.
int main(int argc, char **argv)
This is a generic class that defines a solver to handle ImplicitSystem classes, including NonlinearIm...
SolverPackage default_solver_package()
The ExodusII_IO class implements reading meshes in the ExodusII file format from Sandia National Labs...
Real hcurl_error(const std::string &sys_name, const std::string &unknown_name)
std::unique_ptr< TimeSolver > time_solver
A pointer to the solver object we're going to use.
void init(triangulateio &t)
Initializes the fields of t to nullptr/0 as necessary.
void extra_quadrature_order(const int extraorder)
Increases or decreases the order of the quadrature rule used for numerical integration.
Real relative_step_tolerance
bool verbose
The DiffSolver may print a lot more to libMesh::out if verbose is set to true; default is false.
virtual void init()
Initialize all the systems.
Real error_norm(const std::string &sys_name, const std::string &unknown_name, const FEMNormType &norm)
T command_line_value(const std::string &, T)
The LibMeshInit class, when constructed, initializes the dependent libraries (e.g.
Real l2_error(const std::string &sys_name, const std::string &unknown_name)
void compute_error(const std::string &sys_name, const std::string &unknown_name)
Computes and stores the error in the solution value e = u-u_h, the gradient grad(e) = grad(u) - grad(...
void print_info(std::ostream &os=libMesh::out) const
Prints information about the equation systems, by default to libMesh::out.
This is the EquationSystems class.
virtual void write_equation_systems(const std::string &, const EquationSystems &, const std::set< std::string > *system_names=nullptr)
This method implements writing a mesh with data to a specified file where the data is taken from the ...
void attach_exact_values(const std::vector< FunctionBase< Number > * > &f)
Clone and attach arbitrary functors which compute the exact values of the EquationSystems' solutions ...
bool quiet
The DiffSolver should not print anything to libMesh::out unless quiet is set to false; default is tru...
Real relative_residual_tolerance
Real absolute_residual_tolerance
The DiffSolver should exit after the residual is reduced to either less than absolute_residual_tolera...
void print_info(std::ostream &os=libMesh::out) const
Prints relevant information about the mesh.
unsigned int max_linear_iterations
Each linear solver step should exit after max_linear_iterations is exceeded.
unsigned short int variable_number(const std::string &var) const
unsigned int max_nonlinear_iterations
The DiffSolver should exit in failure if max_nonlinear_iterations is exceeded and continue_after_max_...
double initial_linear_tolerance
Any required linear solves will at first be done with this tolerance; the DiffSolver may tighten the ...