70 #ifndef LIBMESH_HAVE_EXODUS_API
71 libmesh_example_requires(
false,
"--enable-exodus");
75 libmesh_example_requires(LIBMESH_DIM > 2,
"--disable-1D-only --disable-2D-only");
78 #ifndef LIBMESH_ENABLE_DIRICHLET
79 libmesh_example_requires(
false,
"--enable-dirichlet");
85 GetPot infile(
"systems_of_equations_ex8.in");
86 const std::string approx_order = infile(
"approx_order",
"FIRST");
87 const std::string fe_family = infile(
"fe_family",
"LAGRANGE");
89 const Real young_modulus = infile(
"Young_modulus", 1.0);
90 const Real poisson_ratio = infile(
"poisson_ratio", 0.3);
92 const Real nonlinear_abs_tol = infile(
"nonlinear_abs_tol", 1.e-8);
93 const Real nonlinear_rel_tol = infile(
"nonlinear_rel_tol", 1.e-8);
94 const unsigned int nonlinear_max_its = infile(
"nonlinear_max_its", 50);
95 const Real contact_penalty = infile(
"contact_penalty", 1.e2);
96 const Real gap_function_tol = infile(
"gap_function_tol", 1.e-8);
100 mesh.
read(
"systems_of_equations_ex8.exo");
113 Utility::string_to_enum<Order> (approx_order),
114 Utility::string_to_enum<FEFamily>(fe_family));
118 Utility::string_to_enum<Order> (approx_order),
119 Utility::string_to_enum<FEFamily>(fe_family));
123 Utility::string_to_enum<Order> (approx_order),
124 Utility::string_to_enum<FEFamily>(fe_family));
138 equation_systems.parameters.set<
Real> (
"nonlinear solver absolute residual tolerance") = nonlinear_abs_tol;
139 equation_systems.parameters.set<
Real> (
"nonlinear solver relative residual tolerance") = nonlinear_rel_tol;
140 equation_systems.parameters.set<
unsigned int> (
"nonlinear solver maximum iterations") = nonlinear_max_its;
144 equation_systems.parameters.set<
Real>(
"young_modulus") = young_modulus;
145 equation_systems.parameters.set<
Real>(
"poisson_ratio") = poisson_ratio;
147 #ifdef LIBMESH_ENABLE_DIRICHLET
150 std::set<boundary_id_type> clamped_boundaries;
151 clamped_boundaries.insert(MIN_Z_BOUNDARY);
153 std::vector<unsigned int> uvw;
154 uvw.push_back(u_var);
155 uvw.push_back(v_var);
156 uvw.push_back(w_var);
167 std::set<boundary_id_type> clamped_boundaries;
168 clamped_boundaries.insert(MAX_Z_BOUNDARY);
170 std::vector<unsigned int> uv;
181 std::set<boundary_id_type> clamped_boundaries;
182 clamped_boundaries.insert(MAX_Z_BOUNDARY);
184 std::vector<unsigned int> w;
195 #endif // LIBMESH_ENABLE_DIRICHLET
197 le.initialize_contact_load_paths();
199 libMesh::out <<
"Mesh before adding edge connectors" << std::endl;
201 le.add_contact_edge_elements();
203 libMesh::out <<
"Mesh after adding edge connectors" << std::endl;
206 equation_systems.init();
207 equation_systems.print_info();
209 libMesh::out <<
"Contact penalty: " << contact_penalty << std::endl << std::endl;
211 Real current_max_gap_function = std::numeric_limits<Real>::max();
213 const unsigned int max_outer_iterations = 10;
214 for (
unsigned int outer_iteration = 0;
215 outer_iteration != max_outer_iterations; ++outer_iteration)
217 if (current_max_gap_function <= gap_function_tol)
223 libMesh::out <<
"Starting outer iteration " << outer_iteration << std::endl;
232 std::pair<Real, Real> least_and_max_gap_function = le.get_least_and_max_gap_function();
233 Real least_gap_fn = least_and_max_gap_function.first;
234 Real max_gap_fn = least_and_max_gap_function.second;
236 libMesh::out <<
"Finished outer iteration, least gap function: "
238 <<
", max gap function: "
243 current_max_gap_function = std::max(
std::abs(least_gap_fn),
std::abs(max_gap_fn));
248 le.compute_stresses();
250 std::stringstream filename;
251 filename <<
"solution.exo";