140 #if !defined(LIBMESH_HAVE_PETSC) && (!defined(LIBMESH_TRILINOS_HAVE_NOX) || !defined(LIBMESH_TRILINOS_HAVE_EPETRA)) 141 libmesh_example_requires(
false,
"--enable-petsc or --enable-trilinos");
146 libMesh::err <<
"This example requires a NonlinearSolver, and therefore does not " 147 <<
"support --use-eigen on the command line." 152 #ifndef LIBMESH_ENABLE_AMR 153 libmesh_example_requires(
false,
"--enable-amr");
157 GetPot command_line (argc, argv);
160 libmesh_error_msg_if(argc < 3,
"Usage:\n" <<
"\t " << argv[0] <<
" -r 2");
166 for (
int i=1; i<argc; i++)
175 std::string order =
"FIRST";
180 std::string family =
"LAGRANGE";
185 libmesh_error_msg_if((family ==
"MONOMIAL") || (family ==
"XYZ"),
186 "This example requires a C^0 (or higher) FE basis.");
190 #ifdef LIBMESH_HAVE_PETSC 192 # if PETSC_VERSION_LESS_THAN(3,7,0) 193 PetscOptionsSetValue(
"-snes_mf_operator",
194 LIBMESH_PETSC_NULLPTR);
196 PetscOptionsSetValue(LIBMESH_PETSC_NULLPTR,
"-snes_mf_operator",
197 LIBMESH_PETSC_NULLPTR);
200 libMesh::err <<
"Must be using PETSc to use jacobian based preconditioning" << std::endl;
204 #endif //LIBMESH_HAVE_PETSC 208 libmesh_example_requires(2 <= LIBMESH_DIM,
"2D support");
216 if (order !=
"FIRST")
235 equation_systems.parameters.set<
Real> (
"nonlinear solver tolerance") = 1.e-12;
236 equation_systems.parameters.set<
unsigned int> (
"nonlinear solver maximum iterations") = 50;
242 Utility::string_to_enum<Order> (order),
243 Utility::string_to_enum<FEFamily>(family));
253 equation_systems.init();
256 equation_systems.print_info();
260 equation_systems.get_system(
"Laplace-Young").solve();
265 libMesh::out <<
"Laplace-Young system solved at nonlinear iteration " 267 <<
" , final nonlinear residual norm: " 271 #ifdef LIBMESH_HAVE_EXODUS_API 275 #endif // #ifdef LIBMESH_HAVE_EXODUS_API 276 #endif // #ifndef LIBMESH_ENABLE_AMR
T command_line_next(std::string name, T default_value)
Use GetPot's search()/next() functions to get following arguments from the command line...
This is the EquationSystems class.
virtual void read(const std::string &name, void *mesh_data=nullptr, bool skip_renumber_nodes_and_elements=false, bool skip_find_neighbors=false)=0
Interfaces for reading/writing a mesh to/from a file.
std::unique_ptr< NonlinearSolver< Number > > nonlinear_solver
The NonlinearSolver defines the default interface used to solve the nonlinear_implicit system...
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 ...
The ExodusII_IO class implements reading meshes in the ExodusII file format from Sandia National Labs...
unsigned int n_nonlinear_iterations() const
The LibMeshInit class, when constructed, initializes the dependent libraries (e.g.
Real final_nonlinear_residual() const
Implements (adaptive) mesh refinement algorithms for a MeshBase.
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.
A class which provides the residual and jacobian assembly functions for the Laplace-Young system of e...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void all_second_order(const bool full_ordered=true)
Calls the range-based version of this function with a range consisting of all elements in the mesh...
bool on_command_line(std::string arg)
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
void uniformly_refine(unsigned int n=1)
Uniformly refines the mesh n times.