Skip to content

Commit 176eb1a

Browse files
authored
some fixes related to Example227 (#84)
1 parent 7c2db7b commit 176eb1a

2 files changed

Lines changed: 10 additions & 14 deletions

File tree

docs/make.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ function make_all(; with_examples::Bool = true, modules = :all, run_examples::Bo
3131
"Example220_ReactionConvectionDiffusion.jl",
3232
"Example225_ObstacleProblem.jl",
3333
"Example226_Thermoforming.jl",
34+
"Example227_ObstacleProblemLVPP.jl",
3435
"Example230_NonlinearElasticity.jl",
3536
"Example235_StokesIteratedPenalty.jl",
3637
"Example240_SVRTEnrichment.jl",

examples/Example227_ObstacleProblemLVPP.jl

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,25 @@ with some right-hand side ``f`` within the set of admissible functions that lie
1919
2020
Opposite to Example225 the solution is computed by the latent variable proximal point (LVPP) method
2121
that solves the problem via a series of nonlinear mixed problems that guarantee the decay of the
22-
energy. Given ``\alpha_k`` and initial guess ``u_0`` and ``\psi_0``, the subproblem for ``k \geq 1``
22+
energy. Given ``\alpha_k`` and initial guesses ``u_0`` and ``\psi_0``, the subproblem for ``k \geq 1``
2323
seeks a solution ``u_{k} \in V := H^1_0(\Omega)`` and ``\psi_{k} \in W := L^\infty(\Omega)`` such that
2424
```math
2525
\begin{aligned}
26-
\alpha_k (\nabla u_k, \nabla v) + (\psi_k, v) = (\alpha_k f + \psi_{k-1},v)
26+
\alpha_k (\nabla u_k, \nabla v)_{L^2} + (\psi_k, v)_{L^2} & = (\alpha_k f + \psi_{k-1},v)_{L^2}
2727
&& \text{for all } v \in V\\
28-
(u_k, w) - (\varchi + \exp(\psi_k), w) & = 0 &&
29-
\text{for all } w \in W
28+
(u_k, w)_{L^2} - (\chi + \exp(\psi_k), w)_{L^2} & = 0
29+
&& \text{for all } w \in W
3030
\end{aligned}
3131
```
3232
The parameter ``\alpha_k`` is initialized with ``\alpha_0 = 1`` and updated according to
33-
``\alpha_k = min(max(r^(q^k) - α), 10^3)`` with ``r = q = 1.5``. The problem for each ``k``
33+
``\alpha_k = \min(\max(r^(q^k) - α), 10^3)`` with ``r = q = 1.5``. The problem for each ``k``
3434
is solved by the Newton method. This implements Algorithm 3 in the reference below.
3535
3636
3737
!!! reference
3838
39-
''Proximal Galerkin: A Structure-Preserving Finite Element Method for Pointwise Bound Constraints''
40-
Brendan Keith, Thomas M. Surowiec, Found Comput Math (2024)
39+
''Proximal Galerkin: A Structure-Preserving Finite Element Method for Pointwise Bound Constraints'',
40+
Brendan Keith, Thomas M. Surowiec, Found Comput Math (2024),
4141
[>Link<](https://doi.org/10.1007/s10208-024-09681-8)
4242
4343
@@ -58,11 +58,7 @@ const b = 9 // 20
5858
const d = sqrt(1 // 4 - b^2)
5959
function χ(x)
6060
r = sqrt(x[1]^2 + x[2]^2)
61-
if r <= b
62-
return sqrt(1 // 4 - r^2)
63-
else
64-
return d + b^2 / d - b * r / d
65-
end
61+
return r <= b ? sqrt(1 // 4 - r^2) : d + b^2 / d - b * r / d
6662
end
6763

6864
## transformation of latent variable ψ to constrained variable u
@@ -148,8 +144,7 @@ function main(;
148144
@info "dist = $dist, niterations = $(niterations - 1)"
149145
if dist < tol
150146
converged = true
151-
else
152-
# increase proximal parameter
147+
else ## increase proximal parameter
153148
α = min(max(r^(q^k) - α), 10^3)
154149
end
155150
end

0 commit comments

Comments
 (0)