Go to the source code of this file.
|
class | LaplaceYoung |
| A class which provides the residual and jacobian assembly functions for the Laplace-Young system of equations. More...
|
|
◆ main()
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 134 of file miscellaneous_ex3.C.
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);
164 libmesh_error_msg(
"Usage:\n" <<
"\t " << argv[0] <<
" -r 2");
173 for (
int i=1; i<argc; i++)
182 if (command_line.search(1,
"-r"))
183 nr = command_line.next(nr);
186 std::string order =
"FIRST";
187 if (command_line.search(2,
"-Order",
"-o"))
188 order = command_line.next(order);
191 std::string family =
"LAGRANGE";
192 if (command_line.search(2,
"-FEFamily",
"-f"))
193 family = command_line.next(family);
196 if ((family ==
"MONOMIAL") || (family ==
"XYZ"))
197 libmesh_error_msg(
"This example requires a C^0 (or higher) FE basis.");
199 if (command_line.search(1,
"-pre"))
201 #ifdef LIBMESH_HAVE_PETSC
203 # if PETSC_VERSION_LESS_THAN(3,7,0)
204 PetscOptionsSetValue(
"-snes_mf_operator", PETSC_NULL);
206 PetscOptionsSetValue(PETSC_NULL,
"-snes_mf_operator", PETSC_NULL);
209 libMesh::err <<
"Must be using PETSc to use jacobian based preconditioning" << std::endl;
213 #endif //LIBMESH_HAVE_PETSC
217 libmesh_example_requires(2 <= LIBMESH_DIM,
"2D support");
225 if (order !=
"FIRST")
244 equation_systems.parameters.set<
Real> (
"nonlinear solver tolerance") = 1.e-12;
245 equation_systems.parameters.set<
unsigned int> (
"nonlinear solver maximum iterations") = 50;
251 Utility::string_to_enum<Order> (order),
252 Utility::string_to_enum<FEFamily>(family));
262 equation_systems.init();
265 equation_systems.print_info();
269 equation_systems.get_system(
"Laplace-Young").solve();
274 libMesh::out <<
"Laplace-Young system solved at nonlinear iteration "
276 <<
" , final nonlinear residual norm: "
280 #ifdef LIBMESH_HAVE_EXODUS_API
284 #endif // #ifdef LIBMESH_HAVE_EXODUS_API
285 #endif // #ifndef LIBMESH_ENABLE_AMR
References libMesh::EquationSystems::add_system(), libMesh::System::add_variable(), libMesh::MeshBase::all_second_order(), libMesh::err, libMesh::NonlinearImplicitSystem::final_nonlinear_residual(), libMesh::EquationSystems::get_system(), libMesh::TriangleWrapper::init(), libMesh::EquationSystems::init(), mesh, libMesh::NonlinearImplicitSystem::n_nonlinear_iterations(), libMesh::NonlinearImplicitSystem::nonlinear_solver, libMesh::on_command_line(), libMesh::out, libMesh::EquationSystems::parameters, libMesh::EquationSystems::print_info(), libMesh::MeshBase::print_info(), libMesh::MeshBase::read(), libMesh::Real, libMesh::Parameters::set(), libMesh::MeshRefinement::uniformly_refine(), and libMesh::MeshOutput< MT >::write_equation_systems().
Real final_nonlinear_residual() const
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
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.
virtual void all_second_order(const bool full_ordered=true)=0
Converts a (conforming, non-refined) mesh with linear elements into a mesh with second-order elements...
The ExodusII_IO class implements reading meshes in the ExodusII file format from Sandia National Labs...
Manages consistently variables, degrees of freedom, coefficient vectors, matrices and non-linear solv...
A class which provides the residual and jacobian assembly functions for the Laplace-Young system of e...
void init(triangulateio &t)
Initializes the fields of t to nullptr/0 as necessary.
Implements (adaptive) mesh refinement algorithms for a MeshBase.
unsigned int add_variable(const std::string &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.
unsigned int n_nonlinear_iterations() const
The LibMeshInit class, when constructed, initializes the dependent libraries (e.g.
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 ...
std::unique_ptr< NonlinearSolver< Number > > nonlinear_solver
The NonlinearSolver defines the default interface used to solve the nonlinear_implicit system.
void print_info(std::ostream &os=libMesh::out) const
Prints relevant information about the mesh.
bool on_command_line(std::string arg)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void uniformly_refine(unsigned int n=1)
Uniformly refines the mesh n times.