|
13 | 13 | #include <libmesh/cell_tet4.h>
|
14 | 14 | #include <libmesh/zero_function.h>
|
15 | 15 | #include <libmesh/linear_implicit_system.h>
|
16 |
| -#include <libmesh/nonlinear_implicit_system.h> |
17 | 16 | #include <libmesh/transient_system.h>
|
18 | 17 | #include <libmesh/quadrature_gauss.h>
|
19 | 18 | #include <libmesh/node_elem.h>
|
@@ -1292,41 +1291,37 @@ public:
|
1292 | 1291 |
|
1293 | 1292 | // Set some parameters to the equation system that would cause a failed test
|
1294 | 1293 | equation_systems.parameters.set<unsigned int>("linear solver maximum iterations") = 0;
|
1295 |
| - equation_systems.parameters.set<unsigned int>("nonlinear solver absolute residual tolerance") = 1e8; |
1296 | 1294 |
|
1297 | 1295 | // Setup Linear Implicit system
|
1298 | 1296 | LinearImplicitSystem & li_system =
|
1299 | 1297 | equation_systems.add_system<LinearImplicitSystem> ("test");
|
1300 |
| - li_system.add_variable ("u", libMesh::FIRST); |
1301 |
| - li_system.add_variable ("v", libMesh::FIRST); |
1302 |
| - li_system.add_variable ("w", libMesh::FIRST); |
1303 |
| - li_system.attach_assemble_function (assemble_matrix_and_rhs); |
1304 |
| - li_system.get_linear_solver()->set_solver_type(JACOBI); |
1305 |
| - li_system.get_linear_solver()->set_preconditioner_type(IDENTITY_PRECOND); |
1306 | 1298 |
|
1307 |
| - // Setup nonlinear Implicit system |
1308 |
| - NonlinearImplicitSystem & nli_system = |
1309 |
| - equation_systems.add_system<NonlinearImplicitSystem> ("test"); |
1310 |
| - nli_system.add_variable ("u", libMesh::FIRST); |
1311 |
| - nli_system.add_variable ("v", libMesh::FIRST); |
1312 |
| - nli_system.add_variable ("w", libMesh::FIRST); |
1313 |
| - nli_system.attach_assemble_function (assemble_matrix_and_rhs); |
| 1299 | + // We must use a discontinuous variable type in this test or |
| 1300 | + // else the sparsity pattern will not be correct |
| 1301 | + li_system.add_variable("u", FIRST, L2_LAGRANGE); |
| 1302 | + |
| 1303 | + MeshTools::Generation::build_cube (mesh, |
| 1304 | + 5, 5, 5, |
| 1305 | + 0., 1., 0., 1., 0., 1., |
| 1306 | + HEX8); |
| 1307 | + |
| 1308 | + li_system.attach_assemble_function (assembly_with_dg_fem_context); |
| 1309 | + li_system.get_linear_solver()->set_solver_type(GMRES); |
| 1310 | + // Need 5 iterations, dont overdo the preconditioning |
| 1311 | + li_system.get_linear_solver()->set_preconditioner_type(IDENTITY_PRECOND); |
1314 | 1312 |
|
1315 | 1313 | // Set some parameters to the system that work for the solve
|
1316 | 1314 | li_system.parameters.set<unsigned int>("linear solver maximum iterations") = 5;
|
1317 |
| - nli_system.parameters.set<unsigned int>("nonlinear solver absolute residual tolerance") = 1e-10; |
| 1315 | + li_system.parameters.set<Real>("linear solver tolerance") = 1e-100; |
1318 | 1316 |
|
1319 |
| - // See the solve pass, indicating system parameters are used over equation system parameters |
| 1317 | + // Need to init before we can access the system matrix |
1320 | 1318 | equation_systems.init ();
|
| 1319 | + |
| 1320 | + // See the solve pass, indicating system parameters are used over equation system parameters |
1321 | 1321 | li_system.solve();
|
1322 |
| - nli_system.solve(); |
1323 | 1322 |
|
1324 | 1323 | // Check that the number of iterations from the systems got obeyed
|
1325 | 1324 | CPPUNIT_ASSERT_EQUAL(li_system.n_linear_iterations(), 5u);
|
1326 |
| - |
1327 |
| - // Check that the solution for the nonlinear system is converged |
1328 |
| - Real ref_l1_norm = static_cast<Real>(mesh.n_nodes() * li_system.n_vars()); |
1329 |
| - LIBMESH_ASSERT_FP_EQUAL(nli_system.solution->l1_norm(), ref_l1_norm, TOLERANCE); |
1330 | 1325 | }
|
1331 | 1326 |
|
1332 | 1327 | void testAssemblyWithDgFemContext()
|
|
0 commit comments