<<

Weak form of Boundary Value Problems

Simulation Methods in Acoustics Note on finite dimensional description of functions

I Approximation:

N X f (x) ≈ fˆ(x) = qj φj (x) j=1

I Residual : r(x) = f (x) − fˆ(x)

I Collocation and Galerkin with test functions ψi (x)

hψi , ri = 0 for all i = 1, 2 ... N

I Collocation: ψi (x) = δ(xi ) I Galerkin: ψi (x) = φi (x)

I Other ψ – φ choices are possible, but not used often in practice The boundary value problem

I Given a BVP (PDE + BCs) A{u(x)} = f (x) x ∈ Ω (1) [ Bi {u(x)} =g ¯i (x) x ∈ Γi Γi = Γ (2) i

I A and Bi are differential operators I Example (Poisson equation) ∂2u(x) − = 1 x ∈ Ω = [0, 1] (3) ∂x2 u(x) = 0 x = 0 (Dirichlet) (4) ∂u(x) = −1 x = 1 (Neumann) (5) ∂x

I In our example: 2 2 I A = −∂ /∂x , f (x) ≡ 1 I B1 = 1,g ¯1(x) ≡ 0 I B2 = ∂/∂x,g ¯2 ≡ −1 Weak form construction I Construction steps: 1. Multiply PDE by a “sufficiently well behaved”1 function ψ(x) 2. Integrate over the whole domain Ω 3. Integration by parts as much as possible (shift derivatives) 4. Apply BC 1. Multiply the PDE by the test function ψ(x) ψ(x)A{u(x)} = ψ(x)f (x) ∀x ∈ Ω 2. If the equality holds, the integrals must be also equal Z Z ψ(x)A{u(x)} dx = ψ(x)f (x) dx ∀ψ(x) Ω Ω

I Statement: The solution of the weak form must also be the solution of the strong (original) form of the PDE I Proof: The weak form must hold for all ψ(x). We can choose test functions that are nonzero only in Bδ(x0) for any x0 ∈ Ω. Thus, the original equation must hold for all x0 ∈ Ω. I Then, why it is a weak form? 1The definition well behaved depends on the type of PDE and BC Weak form example I.

I Look at the Poisson equation example: ∂2u(x) − = f (x) x ∈ Ω = [0, 1] , f (x) ≡ 1 ∂x2

1. Multiply by the test function ψ(x) ∂2u(x) −ψ(x) = ψ(x)f (x) ∂x2 2. The weak form is written as Z ∂2u(x) Z −ψ(x) 2 dx = ψ(x)f (x) dx Ω ∂x Ω 3. Apply integration by parts on the l.h.s. R x2 0 x2 R x2 0 I Recall that f g dx = [fg] − fg dx x1 x1 x1 I With f = ∂u/∂x and g = ψ(x)  ∂u(x)1 Z 1 ∂ψ(x) ∂u(x) Z 1 − ψ(x) + dx = ψ(x)f (x) dx ∂x 0 0 ∂x ∂x 0 Weak form example II.

4. Apply boundary conditions

I u(0) = 0

∂u(x) I ∂x = −1 x=1   Z 1 Z 1 ∂u ∂ψ ∂u ψ|x=1 + ψ + dx = ψ(x)1 dx ∂x x=0 0 ∂x ∂x 0

I Let’s compare the strong and weak forms

I Strong: 2nd derivative of u, Weak: 1st I Strong: f continuous on Ω, Weak: integrable (f ψ integrable)

I The weak form imposes less strict criteria on u and f ! But it requires some conditions for ψ(x). I We can express these criteria using function space definitions: 2 0 I Strong: u ∈ C (Ω), f ∈ C (Ω) 1 −1 2 I Weak: u ∈ C (Ω), f ∈ C (Ω), u, ∂u/∂x ∈ L (Ω) definition

I Square-integrable functions (in Lebesgue sense)  Z  2 2 2 L (Ω) = f :Ω → R kf k = f dx < ∞ Ω

p I Sobolev space ∼ the function and its derivatives are in L

 ∂f  H1(Ω) = f ∈ L2(Ω), ∈ L2(Ω) ∂x

I Note: derivatives are meant in a weak sense

I g(x) is the of u, i.e. g = ∂u/∂x if and only if Z Z ∂ψ(x) ∞ ψ(x)g(x) dx = − u(x) dx ∀ψ(x) ∈ C0 (Ω) Ω Ω ∂x

I The weak derivative is unique ∞ I Note: C0 (Ω) means infinite times differentiable functions having a compact on Ω Example: solve the weak form

I Let’s search the solution in the form: 2 I u(x) = Ax + Bx 2 I ψ(x) = Axˆ + Bxˆ I Find A, B such that the weak form is satisfied for all Aˆ, Bˆ I Substitute: ((( 2  2  ((  Axˆ + Bxˆ + Axˆ + (Bxˆ ((A(+ 2Bx + x=1 ((( x=0 Z 1     Z 1   Aˆ + 2Bxˆ A + 2Bx dx = Axˆ + Bxˆ 2 dx 0 0

I Rearrange (A and B on l.h.s.) Z 1     Z 1       1   A   x 1 Aˆ Bˆ 1 2x dx = Aˆ Bˆ 2 dx − 0 2x B 0 x 1

I Evaluating the integrals 1 1  A −1/2 AˆBˆ = AˆBˆ ∀ Aˆ Bˆ  1 4/3 B  −2/3

I We obtain the solution: A = 0, B = −1/2, thus u(x) = −x2/2 How did we solve?

2 I By choosing the trial functions (u(x) = Ax + Bx ) the trial function space was discretized (x and x2 are its two elements). Thus, we arrived at a finite dimensional problem (number of dimensions is d = 2 in this example) 2 I By letting ψ(x) = Axˆ + Bxˆ we used the Galerkin method.

I Note that we cannot apply the collocation method 2 (ψi = δ(xi )) as ∂ψ/∂x must be in L I By means of the discretization the BVP was reduced to an algebraic set of linear equations! Thus, in the end a system of linear equations was solved.

I In this case, we “luckily” got the analytical solution, however, in general we only get an approximate solution Another solution

I Let’s solve with a different right hand side:

∂2u(x) 1 − = − u(0) = 0, u0(1) = 0 ∂x2 1 + x2

I All the same until we get

    Z 1 " −x #   1 1 A   1+x2   Aˆ Bˆ = Aˆ Bˆ 2 dx ∀ Aˆ Bˆ 1 4/3 B −x 0 1+x2   I By “dropping” Aˆ Bˆ

1 1  A − log(2)/2 A −0.7425 = → = 1 4/3 B π/4 − 1 B 0.3959

I The discretized weak form gives an approximate solution Visualization of the example

I The approximation gets better if we increase the dimensionality of our function space, e.g. by adding higher order polynomials Order = 2 Order = 5 0 0 Weak solution u(x) -d2u(x)/dx2 -0.2 -0.2 f = -1/(x2 + 1) -0.4 -0.4 -0.6 u(x) u(x) -0.6 -0.8 Weak solution u(x) -0.8 -1 -d2u(x)/dx2 f = -1/(x2 + 1) -1 -1.2 0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1 x x Beam example I.

I Solve the following BVP (static deflection of a clamped–free Euler–Bernoulli beam) EIu0000(x) = f (x) u(0) = 0 u0(0) = 0 (Dirichlet) u00(L) = 0 u000(L) = 0 (Neumann)

I Construct the weak form Z L Z L EI ψ(x)u0000(x) dx = ψ(x)f (x) dx 0 0

I Integration by parts once . . . Z L ! Z L 000 L 0 000 EI [ψu ]0 − ψ u dx = f ψ dx 0 0

I . . . and twice Z L ! Z L 000 L 0 00 L 00 00 EI [ψu ]0 − [ψ u ]0 + ψ u dx = f ψ dx 0 0 Beam example II.

I Choose the test and trial function spaces as

 iπ  φ = ψ = sin i = 1 ... n i i 2L (i − n)π  φ = ψ = cos i = n + 1 ... 2n = N i i 2L

I Note: by letting ψi = φi we use the Galerkin method I The approximations using the above spaces reads as

N X u(x) ≈ uˆ(x) = qj φj (x) = φ(x)q j=1 N X T T ψ(x) ≈ ψˆ(x) = wj φj (x) = w φ (x) j=1

I Note: φ is a row vector, q and w are column vectors Beam example III.

I Notice that the expressions Z L  000L  0 00L 00 00 ψu 0 ψ u 0 ψ u dx 0 I Can all be written in a similar form  (α) (β) (α) (β)   φ φ ··· φ φ q1 1 1 1 N   T  . .. .  . w  . . .  . (α) (β) (α) (β)   qN  φN φ1 ··· φN φN R L (α) (β) I Integration 0 dx or evaluation of φi φj (product of shape functions and their derivatives) at a fixed point is needed. Each term gives an N × N matrix in the square brackets. I On the r.h.s. we have a column vector in the brackets φ (x)f (x) Z L 1 T . T w  .  dx = w b 0   φN (x)f (x) Beam example IV.

I Write the system in matrix notation:

 T  T EI w (A1 + A2 + A3) q = w b

Note that this is a scalar equation T I This must hold for all vectors w , which is only possible if

EI Aq = b

I Thus, we arrive at a system of linear algebraic equations Beam example V.

I Satisfying the BCs

I Contrary to the previous example, our trial (shape) functions 0 do not satisfy the Dirichlet BCs. (φi (0) 6= 0, φi (0) 6= 0) I Constraints must be imposed:   q1   φ (0) φ (0) ··· φ (0) q2  0 1 2 N = 0 0 0 . φ1(0) φ2(0) ··· φN (0)  .  0   qN 

I The same in matrix form:

Acq = 0

I We already know some methods for constraints . . . I . . . let’s use the Lagrange method EI AAT q b c = Ac 0 λ 0

I This can finally be solved to get q and λ Beam – Solution

I The weak solution with n = 5 (N = 10) and two discrete loads as shown by the arrows in the figure 0.04 Weak solution Forces 0.02

0 u(x) -0.02

-0.04

-0.06 0 0.2 0.4 0.6 0.8 1 1.2 x I Just to remember: the weak solution is a function

 πx   3πx   5πx  uˆ (x) =0.6926 sin + 0.1739 sin (πx) − 0.7489 sin + 0.3287 sin (2πx) − 0.0217 sin 2 2 2  πx   3πx   5πx  −0.8171 cos + 1.388 cos (πx) − 0.5373 cos − 0.0839 cos (2πx) + 0.0503 cos 2 2 2