@@ -472,6 +472,7 @@ public:
472
472
CPPUNIT_TEST ( test3DProjectVectorFEHex20 );
473
473
CPPUNIT_TEST ( test3DProjectVectorFEHex27 );
474
474
#ifdef LIBMESH_HAVE_SOLVER
475
+ CPPUNIT_TEST ( testSetSystemParameterOverEquationSystem );
475
476
CPPUNIT_TEST ( testAssemblyWithDgFemContext );
476
477
#endif
477
478
#endif // LIBMESH_DIM > 2
@@ -1289,8 +1290,9 @@ public:
1289
1290
// Create an equation systems object.
1290
1291
EquationSystems equation_systems (mesh );
1291
1292
1292
- // Set some parameters to the equation system that would cause a failed solve
1293
+ // Set some parameters to the equation system that would cause a failed test
1293
1294
equation_systems .parameters .set < unsigned int > ("linear solver maximum iterations" ) = 0 ;
1295
+ equation_systems .parameters .set < unsigned int > ("nonlinear solver absolute residual tolerance" ) = 1e8 ;
1294
1296
1295
1297
// Setup Linear Implicit system
1296
1298
LinearImplicitSystem & li_system =
@@ -1309,25 +1311,23 @@ public:
1309
1311
nli_system .add_variable ("v" , libMesh ::FIRST );
1310
1312
nli_system .add_variable ("w" , libMesh ::FIRST );
1311
1313
nli_system .attach_assemble_function (assemble_matrix_and_rhs );
1312
- nli_system .get_linear_solver ()-> set_solver_type (JACOBI );
1313
- nli_system .get_linear_solver ()-> set_preconditioner_type (IDENTITY_PRECOND );
1314
1314
1315
1315
// Set some parameters to the system that work for the solve
1316
- li_system .parameters .set < unsigned int > ("linear solver maximum iterations" ) = 100 ;
1317
- nli_system .parameters .set < unsigned int > ("linear solver maximum iterations " ) = 100 ;
1316
+ 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 ;
1318
1318
1319
1319
// See the solve pass, indicating system parameters are used over equation system parameters
1320
1320
equation_systems .init ();
1321
1321
li_system .solve ();
1322
1322
nli_system .solve ();
1323
1323
1324
- // We set the solution to be 1 everywhere, so the final l1 norm of the
1325
- // solution is the product of the number of variables and number of nodes.
1326
- Real ref_l1_norm = static_cast < Real > (mesh .n_nodes () * li_system .n_vars ());
1324
+ // Check that the number of iterations from the systems got obeyed
1325
+ CPPUNIT_ASSERT_EQUAL (li_system .n_linear_iterations (), 5u );
1327
1326
1328
- LIBMESH_ASSERT_FP_EQUAL (li_system .solution -> l1_norm (), ref_l1_norm , TOLERANCE * TOLERANCE );
1329
- LIBMESH_ASSERT_FP_EQUAL (nli_system .solution -> l1_norm (), ref_l1_norm , TOLERANCE * TOLERANCE );
1330
- }
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
+ }
1331
1331
1332
1332
void testAssemblyWithDgFemContext ()
1333
1333
{
0 commit comments