Skip to content

Commit ecfbfa1

Browse files
committed
Remove nonlinear system parameter test
Simplify linear system parameter test
1 parent 75d6027 commit ecfbfa1

File tree

1 file changed

+17
-22
lines changed

1 file changed

+17
-22
lines changed

tests/systems/systems_test.C

+17-22
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <libmesh/cell_tet4.h>
1414
#include <libmesh/zero_function.h>
1515
#include <libmesh/linear_implicit_system.h>
16-
#include <libmesh/nonlinear_implicit_system.h>
1716
#include <libmesh/transient_system.h>
1817
#include <libmesh/quadrature_gauss.h>
1918
#include <libmesh/node_elem.h>
@@ -1292,41 +1291,37 @@ public:
12921291

12931292
// Set some parameters to the equation system that would cause a failed test
12941293
equation_systems.parameters.set<unsigned int>("linear solver maximum iterations") = 0;
1295-
equation_systems.parameters.set<unsigned int>("nonlinear solver absolute residual tolerance") = 1e8;
12961294

12971295
// Setup Linear Implicit system
12981296
LinearImplicitSystem & li_system =
12991297
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);
13061298

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);
13141312

13151313
// Set some parameters to the system that work for the solve
13161314
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;
13181316

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
13201318
equation_systems.init ();
1319+
1320+
// See the solve pass, indicating system parameters are used over equation system parameters
13211321
li_system.solve();
1322-
nli_system.solve();
13231322

13241323
// Check that the number of iterations from the systems got obeyed
13251324
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);
13301325
}
13311326

13321327
void testAssemblyWithDgFemContext()

0 commit comments

Comments
 (0)