MATH 676 – Finite element methods in scientific computing Wolfgang Bangerth, Texas A&M University http://www.dealii.org/ Wolfgang Bangerth Lecture 21.5: Boundary conditions Part 1: Theory http://www.dealii.org/ Wolfgang Bangerth General considerations There are many kinds of boundary conditions: ● Dirichlet conditions ● Neumann conditions ● Robin conditions ● ● Strong conditions Natural conditions Force conditions ● Tractions conditions ● … Question: What do they all mean, where do they enter the picture, and how do we deal with them? ● http://www.dealii.org/ Wolfgang Bangerth General considerations There are many kinds of boundary conditions: ● u=g on ∂ Ω Dirichlet conditions ● Neumann conditions a ∂ u /∂ n=g on ∂ Ω ● Robin conditions bu±a ∂ u/∂ n=g on ∂ Ω ● ● Strong conditions Natural conditions Force conditions ● Tractions conditions ● … Question: What do they all mean, where do they enter the picture, and how do we deal with them? ● http://www.dealii.org/ Wolfgang Bangerth Laplace equation Laplace equation with zero boundary values: ● Strong form: −Δ u=f u=0 ● Weak form: find u∊V0=H10 so that (∇ v , ∇ u)=(v , f ) ● in Ω on ∂ Ω ∀ v ∈V 0 This is equivalent to finding the minimizer of 1 2 minu∈V J (u)= ∥∇ u∥ −(f ,u) 2 0 http://www.dealii.org/ Wolfgang Bangerth Laplace equation Laplace equation with non-zero boundary values: ● Strong form: −Δ u=f u=g ● in Ω on ∂ Ω Weak form: find u∊Vg={v∊H1: v=g on the boundary} (∇ v , ∇ u)=(v , f ) ∀ v∈? ? Question: What is the appropriate test space here? http://www.dealii.org/ Wolfgang Bangerth Laplace equation Laplace equation with non-zero boundary values: ● Strong form: −Δ u=f u=g ● Equivalent to finding the minimizer of minu∈V ● g 1 2 J (u)= ∥∇ u∥ −(f ,u) 2 The minimizer needs to satisfy the optimality condition: J (u)≤J (u+ε v) ● in Ω on ∂ Ω ∀ u+ε v ∈V g Since u=g on ∂ Ω we need v=0 on ∂ Ω so that u+ε v∈V g http://www.dealii.org/ Wolfgang Bangerth Laplace equation Laplace equation with non-zero boundary values: ● Strong form: −Δ u=f u=g ● Equivalent to finding the minimizer of minu∈V ● g 1 2 J (u)= ∥∇ u∥ −(f ,u) 2 For differentiable J the optimality condition is: J ' (u)(v)=lim ε→0 ● in Ω on ∂ Ω J (u+ε v)−J (u) =(∇ v , ∇ u)−(v , f )=0 ε ∀v The appropriate test space is then the tangent space, v ∈V 0 ={φ∈H 1 : φ∣∂Ω =0} http://www.dealii.org/ Wolfgang Bangerth Laplace equation Laplace equation with non-zero boundary values on parts of the boundary: ● Strong form: −Δ u=f u=g ∂ u/ ∂ n=0 ● in Ω on Γ1⊂∂ Ω on Γ2 =∂ Ω \ Γ1 The corresponding weak form is then J ' (u)(v)=( ∇ v , ∇ u)−(v , f )=0 ● ∀v The appropriate test space is again the tangent space, v∈V 0 ={φ∈H 1 : φ∣∂ Γ =0} 1 http://www.dealii.org/ Wolfgang Bangerth Laplace equation From strong to weak form: ● Strong form: −Δ u=f u=g ∂ u/∂ n=h ● in Ω on Γ1⊂∂ Ω on Γ2 =∂ Ω \ Γ1 Take equation and multiply by test function: (v ,−Δ u)Ω =(v , f )Ω ● ∀v Integrate by parts, get boundary terms: (∇ v , ∇ u)Ω−(v ,n⋅∇ u)∂ Ω=(v , f )Ω ● ∀ v∈V 0 Split boundary term: (∇ v , ∇ u)Ω−(v ,n⋅∇ u)Γ −( v , n⋅∇ u)Γ =(v , f )Ω 1 http://www.dealii.org/ 2 ∀ v ∈V 0 Wolfgang Bangerth Laplace equation From strong to weak form: ● Strong form: −Δ u=f u=g ∂ u/∂ n=h ● in Ω on Γ1⊂∂ Ω on Γ2 =∂ Ω \ Γ1 Consider the boundary terms separately: (∇ v , ∇ u)Ω− v⏟ , n⋅∇ u − v , n⋅∇ ⏟u =(v , f )Ω ( ● =0 ) ( Γ1 =h ) ∀ v∈V 0 Γ2 This leads to the final form: (∇ v , ∇ u)Ω=(v , f )Ω + ( v , h ) Γ 2 http://www.dealii.org/ ∀ v∈V 0 Wolfgang Bangerth Laplace equation From strong to weak form: ● Strong form: −Δ u=f u=g ∂ u/∂ n=h ● in Ω on Γ1⊂∂ Ω on Γ2 =∂ Ω \ Γ1 Consider the boundary terms separately: (∇ v , ∇ u)Ω − v⏟ ,n⋅∇ u − v , n⋅∇ ⏟u =(v , f )Ω ( ● ● =0 ) ( Γ1 =h ) ∀ v ∈V 0 Γ2 We call boundary conditions – strong, if a term disappears because of the test space – natural, if a term gets replaced and goes to the r.h.s. For Laplace: Dirichlet=strong, Neumann=natural http://www.dealii.org/ Wolfgang Bangerth Laplace equation What about Robin conditions: ● Strong form: −Δ u=f u=g b u+∂ u/∂ n=h ● in Ω on Γ1 ⊂∂Ω on Γ2=∂ Ω \ Γ1 This yields: (∇ v , ∇ u)Ω − v⏟ , n⋅∇ u − v , n⋅∇ ⏟u =(v , f )Ω ) ∀ v ∈V 0 (∇ v , ∇ u)Ω + ( v ,b u )Γ =(v , f )Ω +(v , h)Γ ∀ v ∈V 0 ( ● ) ( =0 Γ1 =h−bu Γ 2 And in final form: 2 http://www.dealii.org/ 2 Wolfgang Bangerth Laplace equation What about equations with coefficients: ● Strong form: −∇⋅A ∇ u=f u=g ? ?=h ● in Ω on Γ1 ⊂∂Ω on Γ2 =∂ Ω \ Γ1 This yields after integration by parts: (∇ v , ∇ u)Ω− v⏟ , n⋅A ∇ u − v , n⋅A ∇ u =(v , f )Ω ⏟ ( ● =0 ) ( ) Γ2 To replace the third term, we need that the natural (Neumann) boundary condition reads n⋅A ∇ u=h ● ?? Γ1 ∀ v ∈V 0 on Γ2 This corresponds with the physical definition of flux. http://www.dealii.org/ Wolfgang Bangerth More general equations Question: Is it generally true that ● Dirichlet = strong boundary condition ● Neumann = natural boundary condition or does this only apply to the Laplace equation? Answer: No! It all depends on the spaces and bilinear forms. http://www.dealii.org/ Wolfgang Bangerth Example: Mixed Laplace Consider the mixed Laplace equation: A −1 u+ ∇ p=0 ∇⋅u=f p=g n⋅u=0 in Ω in Ω on Γ1⊂∂ Ω on Γ2 =∂ Ω \ Γ1 Multiplying by test functions, integrating by parts yields −1 (v , A u)Ω−( ∇⋅v , p )Ω + ( v , n p ) ∂Ω− ( q , ∇⋅u )Ω=−(q , f )Ω ∀ v∈U , q ∈P with spaces (“sort of”) U ={v∈H (div ): n⋅v∣Γ =0} P=L2 2 http://www.dealii.org/ Wolfgang Bangerth Example: Mixed Laplace Consider the mixed Laplace equation: A −1 u+ ∇ p=0 ∇⋅u=f p=g n⋅u=0 in Ω in Ω on Γ1⊂∂ Ω on Γ2 =∂ Ω \ Γ1 Considering boundary terms separately: −1 (v , A u)Ω− ( ∇⋅v , p ) Ω+ v , n ⏟p ( + n⋅v ⏟ , p − ( q , ∇⋅u )Ω=−(q , f )Ω ) ( =g Γ 1 =0 ) Γ2 ∀ v ∈U , q∈P This yields: −1 (v , A u)Ω− ( ∇⋅v , p ) Ω−( q , ∇⋅u )Ω=−(q , f )Ω−( v , n g ) Γ 1 Here: p=g n.u=0 ∀ v ∈U , q∈ P → Dirichlet → natural boundary condition → Dirichlet → strong boundary condition http://www.dealii.org/ Wolfgang Bangerth Example: Mixed Laplace What happens with conflicting boundary conditions: A −1 u+ ∇ p=0 ∇⋅u=f p=g n⋅u=0 in Ω in Ω on ∂Ω on ∂ Ω After integration by parts we then have −1 (v , A u)Ω− ( ∇⋅v , p ) Ω+ n⋅v ⏟ , ⏟p ( =0 ) −( q , ∇⋅u ) Ω=−(q , f )Ω ∀ v ∈U , q∈P = g ∂Ω This yields: −1 (v , A u)Ω− ( ∇⋅v , p ) Ω−( q , ∇⋅u )Ω=−(q , f )Ω ∀ v∈U , q∈P Here: p=g does not appear at all. It will be ignored. http://www.dealii.org/ Wolfgang Bangerth Example: Stokes Consider the Stokes equations: −ηΔ u+ ∇ p=f ∇⋅u=0 in Ω in Ω Question: What boundary conditions can we pose? Answer: Form the bilinear form: (η ∇ v , ∇ u)Ω−( v ,n⋅η ∇ u ) ∂Ω−( ∇⋅v , p )Ω +( n⋅v , p )∂Ω−( q , ∇⋅u )Ω=(v , f )Ω ∀v ,q Combine boundary terms: (η ∇ v , ∇ u)Ω−( ∇⋅v , p )Ω−( v ,n⋅[η ∇ u− p I ] )∂ Ω−( q , ∇⋅u )Ω=(v , f )Ω http://www.dealii.org/ ∀ v ,q Wolfgang Bangerth Example: Stokes Consider the Stokes equations: −ηΔ u+ ∇ p=f ∇⋅u=0 in Ω in Ω Question: What boundary conditions can we pose? Answer: Consider the boundary term: ( v ,n⋅[η ∇ u− p I ]) ∂Ω We can then consider the following boundary conditions: ● Prescribed velocity: ● Prescribed traction force: n⋅[η ∇ u− p I ]∣∂Ω =h u∣∂Ω =g → v∣∂Ω =0 Here: Dirichlet=strong, Neumann=natural http://www.dealii.org/ Wolfgang Bangerth Example: Stokes Stokes equations with Dirichlet conditions: −ηΔ u+∇ p=f ∇⋅u=0 u=g in Ω in Ω on ∂ Ω The complete formulation is then: Find u∈U g ={v ∈ H 1 (Ω)d : v∣∂Ω =g}, p∈ L2 (Ω) so that (η ∇ v , ∇ u)Ω−( ∇⋅v , p )Ω−( q , ∇⋅u )Ω=(v , f )Ω http://www.dealii.org/ ∀ v ∈U 0, q∈ P Wolfgang Bangerth Example: Stokes Stokes equations with Neumann conditions: −η Δ u+∇ p=f ∇⋅u=0 n⋅[η ∇ u− pI ]=h in Ω in Ω on ∂Ω The complete formulation is then: Find u∈U =H 1 (Ω)d , p∈ L2 (Ω) so that (η ∇ v , ∇ u)Ω −( ∇⋅v , p ) Ω−( q , ∇⋅u )Ω=(v , f )Ω +( v , h)∂Ω http://www.dealii.org/ ∀ v ∈U , q∈P Wolfgang Bangerth Example: Stokes Question: What if we prescribe u.n=g? Answer: Then v.n=0. Consider again the boundary term: ( v , n⋅[ η ∇ u− p I ] )∂Ω = (n⊗n) ⏟v +( I −n⊗n) v , n⋅[η ∇ u− p I ] ( =( n⋅v )n=0 ) ∂Ω =( v ,( I −n⊗n) ( n⋅[η ∇ u− p I ] ) )∂Ω Consequence: If we prescribe only the normal component of the velocity, we also need to prescribe the tangential component of the traction: u⋅n∣∂Ω =g ( I −n⊗n) ( n⋅[η∇ u− pI ]) =h http://www.dealii.org/ Wolfgang Bangerth Example: Stokes Question: What if we prescribe the physical traction force: n⋅[2 ηε(u)− p I ]∣∂Ω =h 1 T where ε(u)= ( ∇ u+∇ u ) 2 Answer: Consider again the boundary term: ( v , n⋅[η∇ u− p I ]) ∂Ω Consequence: You can't do this. http://www.dealii.org/ Wolfgang Bangerth Example: Stokes Question: What if we prescribe the physical traction force: n⋅[2 ηε(u)− p I ]∣∂Ω =h 1 T where ε(u)= ( ∇ u+∇ u ) 2 Answer: You can't do this. However, if we formulate the Stokes equations as −2 η ∇⋅ε(u)+ ∇ p=f ∇⋅u=0 in Ω in Ω then the weak form is (2 ηε(v ),ε(u))Ω −( ∇⋅v , p )Ω −( v ,n⋅[2 ηε(u)− p I ] )∂ Ω −( q , ∇⋅u )Ω=(v , f )Ω ∀ v ,q and we can impose this boundary condition. http://www.dealii.org/ Wolfgang Bangerth Example: Stokes Note: The two formulations of the Stokes equations, −ηΔ u+ ∇ p=f ∇⋅u=0 and −2 η ∇⋅ε(u)+ ∇ p=f ∇⋅u=0 in Ω in Ω in Ω in Ω are equivalent because 2 η ∇⋅ε(u)=η∇⋅( ∇ u)+η ∇⋅( ∇ uT )=ηΔ u+ η ∇ ( ∇⋅u ⏟ )=η Δ u =0 They only differ in whether we can impose: ● The unphysical traction n⋅[η ∇ u− p I ]∣∂Ω =h ● The physical traction n⋅[2 ηε(u)− p I ]∣∂Ω =h http://www.dealii.org/ Wolfgang Bangerth Summary ● ● ● ● Boundary conditions are complicated They can be resolved by looking at the boundary terms after integrating by parts You can impose strong conditions: – relating to the test function in these terms – appear as part of the function space for the solution – are zero in the function space for the test function You can impose natural conditions: – relating to the solution in these terms – are replaced by their boundary value – are brought to the right hand side of the weak form http://www.dealii.org/ Wolfgang Bangerth MATH 676 – Finite element methods in scientific computing Wolfgang Bangerth, Texas A&M University http://www.dealii.org/ Wolfgang Bangerth