Skip to content

Commit a829314

Browse files
committed
Tolerate linear solver failure in non-linear schemes
1 parent 606854e commit a829314

File tree

5 files changed

+21
-20
lines changed

5 files changed

+21
-20
lines changed

.vscode/launch.json

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,22 @@
22
"version": "0.2.0",
33
"configurations": [
44
{
5-
"name": "(gdb) Launch",
5+
"name": "C++ Launch",
66
"type": "cppdbg",
77
"request": "launch",
88
// Resolved by CMake Tools:
9-
"program": "${command:cmake.launchTargetPath}",
9+
"program": "${workspaceFolder}/build/aspect-debug",
1010
// *** replace --test by the name of the .prm file you want to run: ***
11-
"args": ["--test"],
11+
"args": ["TwoDSubduction_skip_expensive_stokes.prm"],
1212
"stopAtEntry": true,
1313
// *** append to the path here if you want to run inside some directory like /cookbooks/ ***
14-
"cwd": "${workspaceFolder}",
14+
"cwd": "/home/lochy/Softwares/aspect/dtemp",
1515
"environment": [
1616
{
1717
// add the directory where our target was built to the PATHs
1818
// it gets resolved by CMake Tools:
19-
"name": "PATH",
20-
"value": "${env:PATH}:${command:cmake.getLaunchTargetDirectory}"
21-
},
22-
{
23-
"name": "OTHER_VALUE",
24-
"value": "Something something"
25-
}
26-
],
27-
"externalConsole": false,
28-
"MIMode": "gdb",
29-
"setupCommands": [
30-
{
31-
"description": "Enable pretty-printing for gdb",
32-
"text": "-enable-pretty-printing",
33-
"ignoreFailures": true
19+
"name": "config",
20+
"value": "Debug"
3421
}
3522
]
3623
}

include/aspect/parameters.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,8 @@ namespace aspect
549549
*/
550550
typename NonlinearSolver::Kind nonlinear_solver;
551551
typename NonlinearSolverFailureStrategy::Kind nonlinear_solver_failure_strategy;
552+
// todo_solver
553+
bool continue_nonlinear_solver_loop_after_linear_solver_failure;
552554

553555
typename AdvectionStabilizationMethod::Kind advection_stabilization_method;
554556
double nonlinear_tolerance;

source/simulator/newton.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ namespace aspect
185185
"true, the derivatives are slowly introduced by the following equation: $\\max(0.0, "
186186
"(1.0-(residual/switch\\_initial\\_residual)))$, where switch\\_initial\\_residual is the "
187187
"residual at the time when the Newton solver is switched on.");
188-
188+
189189
prm.declare_entry ("Maximum linear Stokes solver tolerance", "1e-2",
190190
Patterns::Double (0., 1.),
191191
"The linear Stokes solver tolerance is dynamically chosen for the Newton solver, based "

source/simulator/parameters.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,14 @@ namespace aspect
283283
"This parameter is only relevant if the `Nonlinear solver scheme' does nonlinear "
284284
"iterations, in other words, if it is set to something other than "
285285
"`single Advection, single Stokes' or `single Advection, no Stokes'.");
286+
287+
// todo_solver
288+
prm.declare_entry ("Continue nonlinear solver loop after linear solver failure", "false",
289+
Patterns::Bool (),
290+
"This method allows to continue nonlinear solver loop after linear solver fails "
291+
"If set to false, the linear solver failure is thrown as normally. When this is "
292+
"set to true, the failure is tolerated and the nonlinear solver continues with "
293+
"the next linear solve.");
286294

287295
prm.declare_entry ("Pressure normalization", "surface",
288296
Patterns::Selection ("surface|volume|no"),
@@ -1611,6 +1619,8 @@ namespace aspect
16111619
}
16121620
nonlinear_solver_failure_strategy = NonlinearSolverFailureStrategy::parse(
16131621
prm.get("Nonlinear solver failure strategy"));
1622+
// todo_solver
1623+
continue_nonlinear_solver_loop_after_linear_solver_failure = prm.get_bool("Continue nonlinear solver loop after linear solver failure");
16141624

16151625
prm.enter_subsection ("Solver parameters");
16161626
{

source/simulator/solver_schemes.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,8 @@ namespace aspect
682682
// We get here if the Stokes solve above failed. Let's see first
683683
// why that happened:
684684

685+
// todo_solver
686+
685687
// If the exception we got is not one of the two documented by
686688
// throw_linear_solver_failure_exception(), then we have a genuine
687689
// problem here, and will need to get outta here right away:

0 commit comments

Comments
 (0)