Anisotropic Goal-Oriented Mesh Adaptation in Firedrake · Anisotropic Goal-Oriented Mesh Adaptation...

23
Anisotropic Goal-Oriented Mesh Adaptation in Firedrake Anisotropic Goal-Oriented Mesh Adaptation in Firedrake Joe Wallwork 1 Nicolas Barral 2 David Ham 1 Matthew Piggott 1 1 Imperial College London, UK 2 University of Bordeaux, France Firedrake ’19, Durham 1 / 20

Transcript of Anisotropic Goal-Oriented Mesh Adaptation in Firedrake · Anisotropic Goal-Oriented Mesh Adaptation...

Page 1: Anisotropic Goal-Oriented Mesh Adaptation in Firedrake · Anisotropic Goal-Oriented Mesh Adaptation in Firedrake Model Validation Test Case Point Discharge with Di usion: Convergence

Anisotropic Goal-Oriented Mesh Adaptation in Firedrake

Anisotropic Goal-Oriented Mesh Adaptation inFiredrake

Joe Wallwork1 Nicolas Barral2 David Ham1

Matthew Piggott1

1Imperial College London, UK2University of Bordeaux, France

Firedrake ’19, Durham

1 / 20

Page 2: Anisotropic Goal-Oriented Mesh Adaptation in Firedrake · Anisotropic Goal-Oriented Mesh Adaptation in Firedrake Model Validation Test Case Point Discharge with Di usion: Convergence

Anisotropic Goal-Oriented Mesh Adaptation in Firedrake

Mesh Adaptation

Riemannian Metric Field

Metric-Based Mesh Adaptation.

Riemannian metric fields M = M(x)x∈Ω are SPD ∀x ∈ Rn.∴ Orthogonal eigendecomposition M(x) = VΛV T .

Steiner ellipses [Barral, 2015] Resulting mesh [Barral, 2015]

(1,0)

(0,1)M

12

M−12

(λ1, 0)(0, λ2)

E2 = (R2, I2) (R2,M)

node insertion

edgeswap

node deletion

node movement

Rokos and Gorman [2013] 2 / 20

Page 3: Anisotropic Goal-Oriented Mesh Adaptation in Firedrake · Anisotropic Goal-Oriented Mesh Adaptation in Firedrake Model Validation Test Case Point Discharge with Di usion: Convergence

Anisotropic Goal-Oriented Mesh Adaptation in Firedrake

Mesh Adaptation

Hessian-Based Adaptation

The Hessian.

Consider interpolating u ≈ Ihu ∈ P1.

It is shown in [Frey and Alauzet, 2005] that

‖u − Πhu‖L∞(K) ≤ γmaxx∈K

maxe∈∂K

eT |H(x)|e

where γ > 0 is a constant related to the spatial dimension.

A metric tensor M = M(x)x∈Ω may be defined as

M(x) =γ

ε|H(x)|,

where ε > 0 is the tolerated error level.

3 / 20

Page 4: Anisotropic Goal-Oriented Mesh Adaptation in Firedrake · Anisotropic Goal-Oriented Mesh Adaptation in Firedrake Model Validation Test Case Point Discharge with Di usion: Convergence

Anisotropic Goal-Oriented Mesh Adaptation in Firedrake

Model Validation

Test Case

Point Discharge with Diffusion

Analytical solution.

Finite element forward solution.

(Presented on a 1,024,000 element uniform mesh.)

Test case taken fromTELEMAC-2D Valida-tion Document 7.0[Riadh et al., 2014].

u · ∇φ−∇ · (ν∇φ) = f

νn · ∇φ|walls = 0φ|inflow = 0

f = δ(x − 2, y − 5)

4 / 20

Page 5: Anisotropic Goal-Oriented Mesh Adaptation in Firedrake · Anisotropic Goal-Oriented Mesh Adaptation in Firedrake Model Validation Test Case Point Discharge with Di usion: Convergence

Anisotropic Goal-Oriented Mesh Adaptation in Firedrake

Model Validation

Test Case

Point Discharge with Diffusion: Adjoint Problem

Adjoint solution for J1.

Adjoint solution for J2.

(Presented on a 1,024,000 element uniform mesh.)

Ji (φ) =

∫Ri

φ dx

R1 = B 12((20, 5))

R2 = B 12((20, 7.5))

5 / 20

Page 6: Anisotropic Goal-Oriented Mesh Adaptation in Firedrake · Anisotropic Goal-Oriented Mesh Adaptation in Firedrake Model Validation Test Case Point Discharge with Di usion: Convergence

Anisotropic Goal-Oriented Mesh Adaptation in Firedrake

Model Validation

Test Case

Point Discharge with Diffusion: Convergence

Elements J1(φ) J1(φh) J2(φ) J2(φh)

4,000 0.20757 0.20547 0.08882 0.0890116,000 0.16904 0.16873 0.07206 0.0720564,000 0.16263 0.62590 0.06924 0.06922

256,000 0.16344 0.16343 0.06959 0.069581,024,000 0.16344 0.16345 0.06959 0.06958

Ji (φ) : analytical solutionsJi (φh) : P1 finite element solutions

6 / 20

Page 7: Anisotropic Goal-Oriented Mesh Adaptation in Firedrake · Anisotropic Goal-Oriented Mesh Adaptation in Firedrake Model Validation Test Case Point Discharge with Di usion: Convergence

Anisotropic Goal-Oriented Mesh Adaptation in Firedrake

Goal-Oriented Adaptation

Theory

Dual Weighted Residual (DWR).

Given a PDE Ψ(u) = 0 and its adjoint written in Galerkin forms

ρ(uh, v) :=L(v)− a(uh, v) = 0, ∀v ∈ Vh

ρ∗(u∗h, v) :=J(v)− a(v , u∗h) = 0, ∀v ∈ Vh

=⇒ a posteriori error results [Becker and Rannacher, 2001]

J(u)− J(uh) = ρ(uh, u∗ − u∗h) + R(2)

J(u)− J(uh) =1

2ρ(uh, u

∗ − u∗h) +1

2ρ∗(u∗h, u − uh) + R(3)

[Remainders R(2) and R(3) depend on errors u − uh and u∗ − u∗h.]

7 / 20

Page 8: Anisotropic Goal-Oriented Mesh Adaptation in Firedrake · Anisotropic Goal-Oriented Mesh Adaptation in Firedrake Model Validation Test Case Point Discharge with Di usion: Convergence

Anisotropic Goal-Oriented Mesh Adaptation in Firedrake

Goal-Oriented Adaptation

Theory

DWR Integration by Parts

J(u)− J(uh) = ρ(uh, u∗ − u∗h) + R(2)

Applying integration by parts (again) elementwise:

|J(u)− J(uh)|∣∣∣K≈ |〈Ψ(uh), u∗ − u∗h〉K + 〈ψ(uh), u∗ − u∗h〉∂K |.

Ψ(uh) is the strong residual on K ;

ψ(uh) embodies flux terms over elemental boundaries.

8 / 20

Page 9: Anisotropic Goal-Oriented Mesh Adaptation in Firedrake · Anisotropic Goal-Oriented Mesh Adaptation in Firedrake Model Validation Test Case Point Discharge with Di usion: Convergence

Anisotropic Goal-Oriented Mesh Adaptation in Firedrake

Goal-Oriented Adaptation

Isotropic Goal-Oriented Mesh Adaptation

Isotropic Metric

|J(u)− J(uh)|∣∣∣K≈ η := |〈Ψ(uh), u∗ − u∗h〉K + 〈ψ(uh), u∗ − u∗h〉∂K |.

Isotropic case:

M =

[ΠP1η 0

0 ΠP1η

].

9 / 20

Page 10: Anisotropic Goal-Oriented Mesh Adaptation in Firedrake · Anisotropic Goal-Oriented Mesh Adaptation in Firedrake Model Validation Test Case Point Discharge with Di usion: Convergence

Anisotropic Goal-Oriented Mesh Adaptation in Firedrake

Goal-Oriented Adaptation

Isotropic Goal-Oriented Mesh Adaptation

Isotropic Meshes

Centred receiver (12,246 elements).

Offset receiver (19,399 elements).

10 / 20

Page 11: Anisotropic Goal-Oriented Mesh Adaptation in Firedrake · Anisotropic Goal-Oriented Mesh Adaptation in Firedrake Model Validation Test Case Point Discharge with Di usion: Convergence

Anisotropic Goal-Oriented Mesh Adaptation in Firedrake

Goal-Oriented Adaptation

Anisotropic Goal-Oriented Mesh Adaptation

A posteriori Approach

Motivated by the approach of [Power et al., 2006], consider theinterpolation error:

|J(u)− J(uh)| ≈ |〈Ψ(uh), u∗ − u∗h︸ ︷︷ ︸u∗−Πhu∗

〉K + 〈ψ(uh), u∗ − u∗h︸ ︷︷ ︸u∗−Πhu∗

〉∂K |

This suggests the node-wise metric,

M = |Ψ(uh)||H(u∗)|,

and correspondingly for the adjoint,

M = |Ψ∗(u∗h)||H(u)|.

11 / 20

Page 12: Anisotropic Goal-Oriented Mesh Adaptation in Firedrake · Anisotropic Goal-Oriented Mesh Adaptation in Firedrake Model Validation Test Case Point Discharge with Di usion: Convergence

Anisotropic Goal-Oriented Mesh Adaptation in Firedrake

Goal-Oriented Adaptation

Anisotropic Goal-Oriented Mesh Adaptation

A posteriori Anisotropic Meshes

Centred receiver (16,407 elements).

Offset receiver (9,868 elements).

12 / 20

Page 13: Anisotropic Goal-Oriented Mesh Adaptation in Firedrake · Anisotropic Goal-Oriented Mesh Adaptation in Firedrake Model Validation Test Case Point Discharge with Di usion: Convergence

Anisotropic Goal-Oriented Mesh Adaptation in Firedrake

Goal-Oriented Adaptation

Anisotropic Goal-Oriented Mesh Adaptation

A priori Approach

Alternative a priori error estimate [Loseille et al., 2010]:

J(u)− J(uh) = 〈(Ψh −Ψ)(u), u∗〉+ R.

Assume we have the conservative form Ψ(u) = ∇ · F(u), so

J(u)− J(uh) ≈ 〈(F − Fh)(u),∇u∗〉Ω − 〈n · (F − Fh(u), u∗)〉∂Ω.

This gives Riemannian metric fields

Mvolume =n∑

i=1

|H(Fi (u))|∣∣∣∣∂u∗∂xi

∣∣∣∣ ,Msurface =|u∗|

∣∣∣∣∣H(

n∑i=1

F i (u) · ni

)∣∣∣∣∣13 / 20

Page 14: Anisotropic Goal-Oriented Mesh Adaptation in Firedrake · Anisotropic Goal-Oriented Mesh Adaptation in Firedrake Model Validation Test Case Point Discharge with Di usion: Convergence

Anisotropic Goal-Oriented Mesh Adaptation in Firedrake

Goal-Oriented Adaptation

Anisotropic Goal-Oriented Mesh Adaptation

A priori Anisotropic Meshes

Centred receiver (44,894 elements).

Offset receiver (29,143 elements).

14 / 20

Page 15: Anisotropic Goal-Oriented Mesh Adaptation in Firedrake · Anisotropic Goal-Oriented Mesh Adaptation in Firedrake Model Validation Test Case Point Discharge with Di usion: Convergence

Anisotropic Goal-Oriented Mesh Adaptation in Firedrake

Goal-Oriented Adaptation

Anisotropic Goal-Oriented Mesh Adaptation

Meshes from Combined Metrics (Offset Receiver)

Averaged isotropic (13,980 elements). Superposed isotropic (19,588 elements).

Averaged a posteriori (9,289 elements). Superposed a posteriori (14,470 elems).

Averaged a priori (25,204 elements). Superposed a priori (49,793 elements).

15 / 20

Page 16: Anisotropic Goal-Oriented Mesh Adaptation in Firedrake · Anisotropic Goal-Oriented Mesh Adaptation in Firedrake Model Validation Test Case Point Discharge with Di usion: Convergence

Anisotropic Goal-Oriented Mesh Adaptation in Firedrake

Goal-Oriented Adaptation

Results

Convergence Analysis: Centred Receiver.

16 / 20

Page 17: Anisotropic Goal-Oriented Mesh Adaptation in Firedrake · Anisotropic Goal-Oriented Mesh Adaptation in Firedrake Model Validation Test Case Point Discharge with Di usion: Convergence

Anisotropic Goal-Oriented Mesh Adaptation in Firedrake

Goal-Oriented Adaptation

Results

Convergence Analysis: Offset Receiver.

17 / 20

Page 18: Anisotropic Goal-Oriented Mesh Adaptation in Firedrake · Anisotropic Goal-Oriented Mesh Adaptation in Firedrake Model Validation Test Case Point Discharge with Di usion: Convergence

Anisotropic Goal-Oriented Mesh Adaptation in Firedrake

Goal-Oriented Adaptation

Results

Three Dimensions.

Anisotropic mesh resulting fromaveraging a posteriori metrics.

Uniform mesh (1,920,000 elements).

Adapted mesh (1,766,396 elements).

18 / 20

Page 19: Anisotropic Goal-Oriented Mesh Adaptation in Firedrake · Anisotropic Goal-Oriented Mesh Adaptation in Firedrake Model Validation Test Case Point Discharge with Di usion: Convergence

Anisotropic Goal-Oriented Mesh Adaptation in Firedrake

Goal-Oriented Adaptation

Results

Outlook.

To appear in proceedings of the 28th International MeshingRoundtable:JW, N Barral, D Ham, M Piggott, “AnisotropicGoal-Oriented Mesh Adaptation in Firedrake” (2019).

Future work:

Time dependent (tidal) problems.

Other finite element spaces, e.g. DG.

Boundary and flux terms for anisotropic methods.

Realistic desalination application.

19 / 20

Page 20: Anisotropic Goal-Oriented Mesh Adaptation in Firedrake · Anisotropic Goal-Oriented Mesh Adaptation in Firedrake Model Validation Test Case Point Discharge with Di usion: Convergence

Anisotropic Goal-Oriented Mesh Adaptation in Firedrake

Goal-Oriented Adaptation

Results

References

Nicolas Barral. Time-accurate anisotropic mesh adaptation for three-dimensional moving mesh problems. PhDthesis, Universite Pierre et Marie Curie, 2015.

Roland Becker and Rolf Rannacher. An optimal control approach to a posteriori error estimation in finiteelement methods. Acta Numerica 2001, 10:1–102, May 2001. ISSN 0962-4929.

Pascal-Jean Frey and Frederic Alauzet. Anisotropic mesh adaptation for cfd computations. Computer methodsin applied mechanics and engineering, 194(48-49):5068–5082, 2005.

Adrien Loseille, Alain Dervieux, and Frederic Alauzet. Fully anisotropic goal-oriented mesh adaptation for 3dsteady euler equations. Journal of computational physics, 229(8):2866–2897, 2010.

PW Power, Christopher C Pain, MD Piggott, Fangxin Fang, Gerard J Gorman, AP Umpleby, Anthony JHGoddard, and IM Navon. Adjoint a posteriori error measures for anisotropic mesh optimisation. Computers &Mathematics with Applications, 52(8):1213–1242, 2006.

A Riadh, G Cedric, and MH Jean. TELEMAC modeling system: 2D hydrodynamics TELEMAC-2D softwarerelease 7.0 user manual. Paris: R&D, Electricite de France, page 134, 2014.

Georgios Rokos and Gerard Gorman. Pragmatic–parallel anisotropic adaptive mesh toolkit. In Facing theMulticore-Challenge III, pages 143–144. Springer, 2013.

20 / 20

Page 21: Anisotropic Goal-Oriented Mesh Adaptation in Firedrake · Anisotropic Goal-Oriented Mesh Adaptation in Firedrake Model Validation Test Case Point Discharge with Di usion: Convergence

Anisotropic Goal-Oriented Mesh Adaptation in Firedrake

Appendix

Combining Metrics

Metric Combination.

Consider metrics M1 and M2. How to combine these in ameaningful way?

Metric average:M := 1

2 (M1 +M2).

Metric superposition:intersection of Steiner ellipses.

Metric superposition [Barral, 2015]

21 / 20

Page 22: Anisotropic Goal-Oriented Mesh Adaptation in Firedrake · Anisotropic Goal-Oriented Mesh Adaptation in Firedrake Model Validation Test Case Point Discharge with Di usion: Convergence

Anisotropic Goal-Oriented Mesh Adaptation in Firedrake

Appendix

Hessian recovery

Double L2 projection

We recover H = ∇T∇u by solving the auxiliary problemH = ∇Tgg = ∇u

as∫Ωτ : Hh dx +

∫Ωdiv(τ) : gh dx −

n∑i=1

n∑j=1

∫∂Ω

(gh)iτijnj ds = 0, ∀τ∫Ωψ · gh dx =

∫∂Ω

uhψ · n ds −∫

Ωdiv(ψ)uh dx , ∀ψ.

22 / 20

Page 23: Anisotropic Goal-Oriented Mesh Adaptation in Firedrake · Anisotropic Goal-Oriented Mesh Adaptation in Firedrake Model Validation Test Case Point Discharge with Di usion: Convergence

Anisotropic Goal-Oriented Mesh Adaptation in Firedrake

Appendix

A priori Metric

Accounting for Source Term

Forward equation:

∇ · F(φ) = f , F(φ) = uφ− ν∇φ.

M = |H(F1(φ))|∣∣∣∣∂φ∗∂x

∣∣∣∣+ |H(F2(φ))|∣∣∣∣∂φ∗∂y

∣∣∣∣+ |H(f )| |φ∗|.

Adjoint equation:

∇ · G(φ∗) = g , G(φ∗) = −uφ∗ − ν∇φ∗,

M = |H(G1(φ∗))|∣∣∣∣∂φ∂x

∣∣∣∣+ |H(G2(φ∗))|∣∣∣∣∂φ∂y

∣∣∣∣+ |H(g)| |φ|,

23 / 20