28#include "libmesh/libmesh.h"
29#include "libmesh/mesh.h"
30#include "libmesh/equation_systems.h"
31#include "libmesh/fpe_disabler.h"
32#include "libmesh/nonlinear_implicit_system.h"
33#include "libmesh/nonlinear_solver.h"
34#include "libmesh/parameters.h"
35#include "libmesh/getpot.h"
36#include "libmesh/enum_solver_package.h"
37#include "libmesh/exodusII_io.h"
38#include "libmesh/mesh_generation.h"
39#include "libmesh/enum_elem_type.h"
63main(
int argc,
char ** argv)
71 "--enable-petsc or --enable-trilinos");
74 GetPot input_file(
"vector_fe_ex5.in");
77 input_file.parse_command_line(argc, argv);
80 const Real epsilon = input_file(
"epsilon", -1);
81 const Real sigma = input_file(
"sigma", 6);
84 const std::size_t nx = input_file(
"nx", 15);
85 const std::size_t ny = input_file(
"ny", 15);
88 const unsigned int approx_order = input_file(
"approx_order", 1);
94 for (
int i = 1; i < argc; i++)
100 libmesh_example_requires(2 <= LIBMESH_DIM,
"2D support");
130 auto & nl_solver = *nl_system.nonlinear_solver;
135 equation_systems.
init();
142 std::unique_ptr<FPEDisabler> maybe_disable_fpe;
144 maybe_disable_fpe = std::make_unique<FPEDisabler>();
148#ifdef LIBMESH_HAVE_EXODUS_API
152 libMesh::out <<
"\nWARNING: The elemental vector order is CONSTANT. The solution" << std::endl
153 <<
"written out to 'out_constant.e' will be trivial." << std::endl;
156 std::vector<std::string> varnames;
161 exo_ptr.
write(
"out_constant.e");
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.
void build_variable_names(std::vector< std::string > &var_names, const FEType *type=nullptr, const std::set< std::string > *system_names=nullptr) const
Fill the input vector var_names with the names of the variables for each system.
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.
The ExodusII_IO class implements reading meshes in the ExodusII file format from Sandia National Labs...
virtual void write(const std::string &fname) override
This method implements writing a mesh to a specified file.
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 set_output_variables(const std::vector< std::string > &output_variables, bool allow_empty=true)
Sets the list of variable names to be included in the output.
void write_element_data(const EquationSystems &es)
Write out element solution.
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...
Provides a uniform interface to vector storage schemes for different linear algebra libraries.
T & set(const std::string &)
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)=0
Initialize SparseMatrix with the specified sizes.
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()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void compute_residual(const NumericVector< Number > &X, NumericVector< Number > &R, NonlinearImplicitSystem &S)
void compute_jacobian(const NumericVector< Number > &X, SparseMatrix< Number > &J, NonlinearImplicitSystem &S)