Skip to content

Commit

Permalink
Merge pull request #6164 from gassmoeller/update_nonlinear_channel_fl…
Browse files Browse the repository at this point in the history
…ow_benchmark

Update nonlinear channel flow benchmark
  • Loading branch information
MFraters authored Dec 2, 2024
2 parents f37c7fc + 0e3a60b commit e14c1ad
Show file tree
Hide file tree
Showing 29 changed files with 2,165 additions and 759 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ can be used to recreate the nonlinear channel flow figures from
{cite:t}`fraters:etal:2019`.
Start by compiling the `simple_nonlinear` plugin in this directory as described (at the example of another benchmark)
in {ref}`sec:benchmark-run` .
After compiling the plugin adjust `metabash.sh` and/or `bash.sh` to reflect
the parameter search you are interested in and run the script.
Running the `bash.sh` script without changes will recreate the model runs of Fig. 1 and Fig. 2 in {cite:t}`fraters:etal:2019`
After compiling the plugin you can run (or adjust) the script `run.sh`, which will run all the models necessary
to recreate Fig. 1 and Fig. 2 of {cite:t}`fraters:etal:2019` and the other figures on this page
(by default the script will assume your processor has 4 compute cores, but you can adjust the number in the script).
After running the model series you can use the gnuplot files in `plotfiles/` to recreate the following figures.
After running the model series you can use the gnuplot files `plot_v.gnuplot` and `plot_t.gnuplot` to recreate the following figures.

```{figure-md} fig:benchmark-newton-nonlinear-channel-flow-tractions
<img src="doc/figure_t.png" />
Expand All @@ -24,3 +23,31 @@ Convergence history for several methods for a rheology with n = 3 where in- and
```

The nonlinear convergence behavior is shown in {numref}`fig:benchmark-newton-nonlinear-channel-flow-tractions` and {numref}`fig:benchmark-newton-nonlinear-channel-flow-velocities`.

Note, that the linear residual is stalling in some cases. This is related to the choice of boundary velocity (in {numref}`fig:benchmark-newton-nonlinear-channel-flow-velocities`)
and boundary traction (in {numref}`fig:benchmark-newton-nonlinear-channel-flow-tractions`). You can adjust the base input files `input_t.prm` and `input_v.prm` to
test what happens when varying the boundary tractions or velocities.

Also note that compared to the original paper we have added a new model series to the figure that uses the default Picard solver `single Advection, iterated Stokes` (purple lines). You can see that this solver converges at about the same rate as the defect correction Picard solver, however its residual eventually stagnates at a fixed value. This is the expected behavior of a solver that computes the actual solution vector instead of an update to the solution vector. The accuracy of the linear solver in these cases limits the accuracy that the nonlinear solver can reach and changing the linear solver tolerance controls the exact residual at which the nonlinear solver stagnates. At the same time this illustrates the advantage of defect-correction solvers (using either Picard or Newton iterations). Even with a coarse linear solver tolerance these nonlinear solvers continue to converge to the actual solution.

Since the publication of {cite:t}`fraters:etal:2019` we have continued to work on improving and optimizing the Newton solver implementation and parameters. The result of this work are default parameters that can solve many models faster than using the parameters originally used. In particular two choices influence the solver convergence and are discussed here:

- We can make use of a coarser maximum linear solver tolerance than the one used for the publications (here `1e-20`). See the parameter [](parameters:Solver_20parameters/Newton_20solver_20parameters/Maximum_20linear_20Stokes_20solver_20tolerance). For the example with velocity boundary conditions this change cuts the cost for the linear Stokes solver in half, while not affecting the number of nonlinear iterations significantly.

- Choosing less (but not 0) line search iterations actually benefits the stability of the Newton solver. This is because too many line search iterations will prevent the Newton solver from modifying the solution to a value that has a higher residual. In other words if the solver gets stuck in a local minimum there is no way for it to leave this minimum behind. Therefore by default we now limit the number of line-search iterations. See the parameter [](parameters:Solver_20parameters/Newton_20solver_20parameters/Max_20Newton_20line_20search_20iterations) for more details.

Applying these modifications here is a version of the figures above that was run with the current (as of version 3.0) default parameters of ASPECT:

```{figure-md} fig:benchmark-newton-nonlinear-channel-flow-tractions-default-parameters
<img src="doc/figure_t_default_parameters.png" />
As above for the model with pressure boundary conditions, but using the updated default solver parameters.
```

```{figure-md} fig:benchmark-newton-nonlinear-channel-flow-velocities-default-parameters
<img src="doc/figure_v_default_parameters.png" />
As above for the model with velocity boundary conditions, but using the updated default solver parameters.
```

You can easily recreate these figures by replacing `mLT_1e-8` with `mLT_1e-2`, and by replacing `LS_100` with `LS_5` in the plotting scripts.

This file was deleted.

171 changes: 0 additions & 171 deletions benchmarks/newton_solver_benchmark_set/nonlinear_channel_flow/bash.sh

This file was deleted.

This file was deleted.

Loading

0 comments on commit e14c1ad

Please sign in to comment.