dune-dpg: A Library for Discontinous Petrov Galerkin Using Optimal Test Spaces Felix Gruber and Angela Klewinghaus joint work with Olga Mula IGPM, RWTH Aachen Dune User Meeting 2015 in Heidelberg 1 of 15 dune-dpg | F. Gruber, A. Klewinghaus | September 2015 Motivation: Variational formulation: Find u ∈ U such that b (u , v ) = `(v ) for all v ∈ V for Hilbert spaces U , V , continuous bilinear form b : U × V → R and ` ∈ V 0 . Goal: Stability 2 of 15 dune-dpg | F. Gruber, A. Klewinghaus | September 2015 Motivation: Variational formulation: Find u h ∈ U h such that b (u h , v h ) = `(v h ) for all v h ∈ V h for Hilbert spaces U , V , continuous bilinear form b : U × V → R and ` ∈ V 0 . Goal: Stability • Discrete approximation yields a best approximation (up to a constant) ku − uh kU . inf ku − wh kU . wh ∈Uh 2 of 15 dune-dpg | F. Gruber, A. Klewinghaus | September 2015 Motivation: Variational formulation: Find u h ∈ U h such that b (u h , v h ) = `(v h ) for all v h ∈ V h for Hilbert spaces U , V , continuous bilinear form b : U × V → R and ` ∈ V 0 . Goal: Stability • Discrete approximation yields a best approximation (up to a constant) ku − uh kU . inf ku − wh kU . wh ∈Uh • Residual-based error bound ku − uh kU ' kb (uh , ·) − `kV 0 . 2 of 15 dune-dpg | F. Gruber, A. Klewinghaus | September 2015 Ultimate Goal: Input bilinear form b (·, ·) Output dune-dpg righthand side `(·) ??? 3 of 15 dune-dpg | F. Gruber, A. Klewinghaus | September 2015 near best approximation uh rigorous error bound Choose Uh to Ensure Good Approximation Properties, Choose Vh to Ensure Stability How to choose Vh for given Uh ? Literature: Barret/Morton, Demkowicz/Gopalakrishnan, Dahmen/Cohen/Welper, Dahmen/Huang/Schwab/Welper, Broersen/Stevenson, Broersen/Dahmen/Stevenson 4 of 15 dune-dpg | F. Gruber, A. Klewinghaus | September 2015 Choose Uh to Ensure Good Approximation Properties, Choose Vh to Ensure Stability How to choose Vh for given Uh ? • Optimal test norm k · kV ,opt := sup u ∈U b (u , v ) ku k U – yields residual based error bound kuh − u kU = ||b (uh , ·) − `||V 0 ,opt Literature: Barret/Morton, Demkowicz/Gopalakrishnan, Dahmen/Cohen/Welper, Dahmen/Huang/Schwab/Welper, Broersen/Stevenson, Broersen/Dahmen/Stevenson 4 of 15 dune-dpg | F. Gruber, A. Klewinghaus | September 2015 Choose Uh to Ensure Good Approximation Properties, Choose Vh to Ensure Stability How to choose Vh for given Uh ? • Optimal test norm k · kV ,opt := sup u ∈U b (u , v ) ku k U – yields residual based error bound kuh − u kU = ||b (uh , ·) − `||V 0 ,opt • Optimal test space Vh = B −∗ RU Uh , where RU : U → U 0 is the Rieszisomorphism, that is Vh := T (Uh ) where hT (uh ), v iV ,opt = b (uh , v ) , ∀v ∈V – yields best approximation property ku − uh kU = inf ku − wh kU wh ∈Uh Literature: Barret/Morton, Demkowicz/Gopalakrishnan, Dahmen/Cohen/Welper, Dahmen/Huang/Schwab/Welper, Broersen/Stevenson, Broersen/Dahmen/Stevenson 4 of 15 dune-dpg | F. Gruber, A. Klewinghaus | September 2015 Computation of the Optimal Test Space We have to compute Vh by solving hT (uh ), v iV ,opt = b (uh , v ) , Literature: ∀v ∈V Barret/Morton, Demkowicz/Gopalakrishnan, Dahmen/Cohen/Welper, Dahmen/Huang/Schwab/Welper, Broersen/Stevenson, Broersen/Dahmen/Stevenson 5 of 15 dune-dpg | F. Gruber, A. Klewinghaus | September 2015 Computation of the Optimal Test Space We have to compute Vh by solving hT (uh ), v iV ,opt = b (uh , v ) , ∀v ∈V • This is infinite dimensional Literature: Barret/Morton, Demkowicz/Gopalakrishnan, Dahmen/Cohen/Welper, Dahmen/Huang/Schwab/Welper, Broersen/Stevenson, Broersen/Dahmen/Stevenson 5 of 15 dune-dpg | F. Gruber, A. Klewinghaus | September 2015 Computation of the Optimal Test Space We have to compute Vh by solving hT (uh ), v iV ,opt = b (uh , v ) , ∀v ∈V • This is infinite dimensional – Projection approach: Replace V by some good enough finite dimensional test search space V̂ ⊂ V Literature: Barret/Morton, Demkowicz/Gopalakrishnan, Dahmen/Cohen/Welper, Dahmen/Huang/Schwab/Welper, Broersen/Stevenson, Broersen/Dahmen/Stevenson 5 of 15 dune-dpg | F. Gruber, A. Klewinghaus | September 2015 Computation of the Optimal Test Space We have to compute Vh by solving hT (uh ), v iV ,opt = b (uh , v ) , ∀v ∈V • This is infinite dimensional – Projection approach: Replace V by some good enough finite dimensional test search space V̂ ⊂ V • We cannot (afford to) compute the optimal test norm and solve global problems Literature: Barret/Morton, Demkowicz/Gopalakrishnan, Dahmen/Cohen/Welper, Dahmen/Huang/Schwab/Welper, Broersen/Stevenson, Broersen/Dahmen/Stevenson 5 of 15 dune-dpg | F. Gruber, A. Klewinghaus | September 2015 Computation of the Optimal Test Space We have to compute Vh by solving hT (uh ), v iV ,opt = b (uh , v ) , ∀v ∈V • This is infinite dimensional – Projection approach: Replace V by some good enough finite dimensional test search space V̂ ⊂ V • We cannot (afford to) compute the optimal test norm and solve global problems – replace the optimal test norm by an equivalent but localizable and computable norm – use an ultraweak variational formulation – (alternatively: use a saddlepoint formulation) Literature: Barret/Morton, Demkowicz/Gopalakrishnan, Dahmen/Cohen/Welper, Dahmen/Huang/Schwab/Welper, Broersen/Stevenson, Broersen/Dahmen/Stevenson 5 of 15 dune-dpg | F. Gruber, A. Klewinghaus | September 2015 Computation of the Optimal Test Space We have to compute Vh by solving hT (uh ), v iV ,opt = b (uh , v ) , ∀v ∈V • This is infinite dimensional – Projection approach: Replace V by some good enough finite dimensional test search space V̂ ⊂ V • We cannot (afford to) compute the optimal test norm and solve global problems – replace the optimal test norm by an equivalent but localizable and computable norm – use an ultraweak variational formulation – (alternatively: use a saddlepoint formulation) We can compute an approximation for Vh by solving hT̂ (uh ), v iV ,K = bK (uh , v ) , ∀ v ∈ V̂ K , where K is a single cell and h·, ·iV ,K and bK (·, ·) denote restrictions to K . Literature: Barret/Morton, Demkowicz/Gopalakrishnan, Dahmen/Cohen/Welper, Dahmen/Huang/Schwab/Welper, Broersen/Stevenson, Broersen/Dahmen/Stevenson 5 of 15 dune-dpg | F. Gruber, A. Klewinghaus | September 2015 dune-dpg: Input dune-dpg ultraweak bilinear form b (·, ·) compute Vh righthand side `(·) trial space Uh solve b (uh , vh ) = `(vh ) test search space V̂ for all vh ∈ Vh localizable inner product h·, ·iV 6 of 15 dune-dpg | F. Gruber, A. Klewinghaus | September 2015 Output near best approximation uh rigorous error bound Implementation: Layout of dune-dpg rough overview of a DPG solver: define grid define trial space Uh and test search space V̂ define bilinear form and inner product assemble system matrix and rhs vector interpolate boundary values solve system compute a posteriori error estimates [ refine adaptively ] 7 of 15 dune-dpg | F. Gruber, A. Klewinghaus | September 2015 Implementation: BilinearForm / InnerProduct • In our case, a bilinear form can be seen as a sum of integral terms, e. g. bK ((u , q ), v ) := 8 of 15 Z cvu − K dune-dpg | F. Gruber, A. Klewinghaus | September 2015 Z K β · ∇vu + Z uqβ · n. ∂K Implementation: BilinearForm / InnerProduct • In our case, a bilinear form can be seen as a sum of integral terms, e. g. bK ((u , q ), v ) := Z cvu − K Z K β · ∇vu + Z • The bilinear form is used to create a local system matrix MijK := bK ((uj , qj ), vi ) which is a sum of matrices given by the integrals above. 8 of 15 dune-dpg | F. Gruber, A. Klewinghaus | September 2015 uqβ · n. ∂K Implementation: BilinearForm / InnerProduct • In our case, a bilinear form can be seen as a sum of integral terms, e. g. bK ((u , q ), v ) := Z cvu − K Z K β · ∇vu + Z uqβ · n. ∂K • The bilinear form is used to create a local system matrix MijK := bK ((uj , qj ), vi ) which is a sum of matrices given by the integrals above. • Thus we introduce an IntegralTerm class to generate the local matrix for a single integral. The BilinearForm is then parametrized over several IntegralTerms and sums up their local matrices. 8 of 15 dune-dpg | F. Gruber, A. Klewinghaus | September 2015 Implementation: BilinearForm / InnerProduct • In our case, a bilinear form can be seen as a sum of integral terms, e. g. bK ((u , q ), v ) := Z cvu − K Z K β · ∇vu + Z uqβ · n. ∂K • The bilinear form is used to create a local system matrix MijK := bK ((uj , qj ), vi ) which is a sum of matrices given by the integrals above. • Thus we introduce an IntegralTerm class to generate the local matrix for a single integral. The BilinearForm is then parametrized over several IntegralTerms and sums up their local matrices. • Abstractly, an inner product is simply a symmetric bilinear form over a single space. Thus, we can reuse the “sum over IntegralTerms” logic to define an InnerProduct class. 8 of 15 dune-dpg | F. Gruber, A. Klewinghaus | September 2015 Implementation: Optimal Testspace • Localfunctions: Linear combinations of localfunctions of the test search space – Parameter: Localfunctions Test Search Space, Coefficient Matrix • Functions: – Parameter: Trial Spaces, Test Search Spaces, Bilinear Form, Inner Product – uses IndexSet of Trial Spaces – in LocalView.bind(): Uses Trial Spaces, Test Search Spaces, Bilinear Form, Inner Product to set up and solve hT̂ (uh ), v iV ,K = bK (uh , v ) , ∀ v ∈ V̂ K , for every (local) solution basis function uh on the current (physical) cell. → yields coefficient matrix for Localfunctions 9 of 15 dune-dpg | F. Gruber, A. Klewinghaus | September 2015 Implementation: SystemAssembler • Building a global system matrix and right hand side for our method is handled by the SystemAssembler class. • The SystemAssembler loops over all cells and uses the BilinearForm and OptimalTestBasis to build local matrices. • The local matrices built by the BilinearForm are then copied into a global system matrix. (Thanks to dune-functions we have a mapping between local and global indices.) • Similarily the right hand side of the system is assembled cell by cell. • SystemAssembler also later applies the boundary values to the system. 10 of 15 dune-dpg | F. Gruber, A. Klewinghaus | September 2015 Implementation: Overview of dune-dpg SystemAssembler assembleSystem() BilinearForm getLocalMatrix() OptimalTestBasis IntegralTerm getLocalMatrix() 11 of 15 dune-dpg | F. Gruber, A. Klewinghaus | September 2015 InnerProduct getLocalMatrix() Example: Transport Transport equation: β · ∇u + cu = f u=g on Ω, on Γ− . Challenge: • not "second order elliptic" but hyperbolic Theoreticel foundations: • D. Broersen, W. Dahmen, R. Stevenson Applications: • discrete ordinates discretization of Boltzman equation (F. Gruber, joint work with W. Dahmen, O. Mula) • limit case of the convection-diffusion equation (A. Klewinghaus, joint work with W. Dahmen) • porous media (W. Dahmen, V. König, S. Müller) We’d like to thank Oliver Sander for his introduction into dune(-functions). 12 of 15 dune-dpg | F. Gruber, A. Klewinghaus | September 2015 Results Transport Figure: β = (1, 1), c = 1, f = 1 13 of 15 dune-dpg | F. Gruber, A. Klewinghaus | September 2015 Results Transport Figure: β = (1, 1), c = 1, f = 1, if x1 < x2 , or f = 0 else 14 of 15 dune-dpg | F. Gruber, A. Klewinghaus | September 2015 Results Convection Diffusion u u 1.000e+00 1.000e+00 0.75 0.75 0.5 0.5 0.25 0.25 0 0 -2.031e-01 -2.031e-01 (a) e = 0.02 (b) e = 0.01 u (c) e = 0.002 u 1.000e+00 1.000e+00 0.75 0.75 0.5 0.5 0.25 0.25 0 0 -2.031e-01 -2.031e-01 (d) e = 0.00001 Figure: Ω = (0, 1)2 , regular square grid with 50 × 50 elements (h = 0.02) 15 of 15 dune-dpg | F. Gruber, A. Klewinghaus | September 2015
© Copyright 2026 Paperzz