You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: demos/goal_based_adaptivity_bvp/goal_based_adaptivity_bvp.py.rst
+8-7Lines changed: 8 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,18 +68,18 @@ We now specify options for how the goal-based adaptivity should proceed. We choo
68
68
where the adjoint solution is approximated in a higher-degree function space, and where both the adjoint and primal residuals
69
69
are employed for the error estimate. This requires four solves on every grid (primal and adjoint solutions with degree :math:`p`
70
70
and :math:`p+1`), and gives a provably efficient and reliable error estimator under a saturation assumption up to a term that is cubic in the error :cite:`Endtmayer2024`.
71
-
It is possible to employ cheaper and more practical approximations by setting the parameters for the :code:`GoalAdaptiveNonlinearVariationalSolver`
71
+
It is possible to employ cheaper and more practical approximations by setting the options for the :code:`GoalAdaptiveNonlinearVariationalSolver`
72
72
appropriately, as discussed below. ::
73
73
74
-
dwr_parameters = {
74
+
goal_adaptive_options = {
75
75
"max_iterations": 100,
76
76
"use_adjoint_residual": True,
77
77
"dual_low_method": "solve",
78
78
"primal_low_method": "solve",
79
79
"dorfler_alpha": 0.5,
80
80
"dual_extra_degree": 1,
81
81
"run_name": "p-laplace",
82
-
"output_dir": "output/p-laplace",
82
+
"output_dir": "./output",
83
83
}
84
84
85
85
We then solve the problem, passing the goal functional :math:`J` and our specified tolerance. We also pass the exact solution, so that
@@ -88,9 +88,10 @@ the DWR automation can compute effectivity indices, but this is not generally re
The initial error in the goal functional is :math:`-3.5\times10^{-2}`. The solver terminates with the goal functional computed to :math:`10^{-4}` after 4 refinements. Each nonlinear solve only required one Newton iteration. The error estimates :math:`\eta` are very accurate: their effectivity indices
@@ -123,7 +124,7 @@ Changing the tolerance to :math:`10^{-8}` takes 40 refinements. The resulting me
123
124
:align:center
124
125
:width:60%
125
126
126
-
We now discuss more practical variants. The configuration above solves four PDEs per adaptive step (primal and adjoint, degree :math:`p` and :math:`p+1`). Changing the DWR parameters to `{"use_adjoint_residual": False, "dual_low_method": "interpolate"}` instead only solves two PDEs per adaptive step (primal at degree :math:`p`, and adjoint at degree :math:`p+1`), and is thus much faster. For this problem with tolerance :math:`10^{-4}` this barely makes a difference to the effectivity indices: most are around 1, with only one step where :math:`I \approx1.25`. We therefore recommend this as the default settings for production use.
127
+
We now discuss more practical variants. The configuration above solves four PDEs per adaptive step (primal and adjoint, degree :math:`p` and :math:`p+1`). Changing `goal_adaptive_options` to `{"use_adjoint_residual": False, "dual_low_method": "interpolate"}` instead only solves two PDEs per adaptive step (primal at degree :math:`p`, and adjoint at degree :math:`p+1`), and is thus much faster. For this problem with tolerance :math:`10^{-4}` this barely makes a difference to the effectivity indices: most are around 1, with only one step where :math:`I \approx1.25`. We therefore recommend this as the default settings for production use.
127
128
128
129
:demo:`A Python script version of this demo can be found here
0 commit comments