Você está na página 1de 88

Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

LibMesh Experience and Usage

John W. Peterson
peterson@cfdlab.ae.utexas.edu

Univ. of Texas at Austin

January 12, 2007


Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

1 Introduction

2 Weighted Residuals

3 Poisson Equation

4 Other Examples

5 Essential BCs

6 Some Extensions
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

1 Introduction

2 Weighted Residuals

3 Poisson Equation

4 Other Examples

5 Essential BCs

6 Some Extensions
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Library Description

Tumor
Angiogenesis
Compressible
RBM NS Library Structure
Basic libraries
DD are LibMesh’s
“roots”
LibMesh Application
“branches” built
Petsc off the library
Metis
Laspack “trunk”
STL

Mpich
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

A Generic BVP

We assume there is a ∂ΩD


Boundary Value
Problem of the form
∂u
M = F(u) ∈Ω
∂t Ω
G(u) = 0 ∈Ω
u = uD ∈ ∂ΩD
N(u) = 0 ∈ ∂ΩN ∂ΩN
u(x, 0) = u0 (x)
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

A Generic BVP

Associated to the

h
problem domain Ω is a
LibMesh data structure
called a Mesh
A Mesh is essentially a
collection of finite
elements
[
Ωh := Ωe
e
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

A Generic BVP

Associated to the

h
problem domain Ω is a
LibMesh data structure
called a Mesh
A Mesh is essentially a
collection of finite
elements
[
Ωh := Ωe
e

LibMesh provides some simple structured mesh


generation routines as well as an interface to
Triangle.
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

1 Introduction

2 Weighted Residuals

3 Poisson Equation

4 Other Examples

5 Essential BCs

6 Some Extensions
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

The point of departure in any FE analysis which uses


LibMesh is the weighted residual statement

(F(u), v) = 0 ∀v ∈ V

Or, more precisely, the weighted residual statement


associated with the finite-dimensional space V h ⊂ V

(F(uh ), vh ) = 0 ∀vh ∈ V h
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

The point of departure in any FE analysis which uses


LibMesh is the weighted residual statement

(F(u), v) = 0 ∀v ∈ V

Or, more precisely, the weighted residual statement


associated with the finite-dimensional space V h ⊂ V

(F(uh ), vh ) = 0 ∀vh ∈ V h
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Some Examples

Poisson Equation
−∆u = f ∈ Ω
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Some Examples

Poisson Equation
−∆u = f ∈ Ω

Weighted Residual Statement


Z
(F(u), v) := [∇u · ∇v − fv] dx
ΩZ

+ (∇u · n) v ds
∂ΩN
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Some Examples

Linear Convection-Diffusion
−k∆u + b · ∇u = f ∈ Ω
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Some Examples

Linear Convection-Diffusion
−k∆u + b · ∇u = f ∈ Ω

Weighted Residual Statement


Z
(F(u), v) := [k∇u · ∇v + (b · ∇u)v − fv] dx
Ω Z
+ k (∇u · n) v ds
∂ΩN
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Some Examples

Stokes Flow
∇p − ν∆u = f
∈ Ω
∇·u = 0
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Some Examples

Stokes Flow
∇p − ν∆u = f
∈ Ω
∇·u = 0

Weighted Residual Statement


u := [u, p] , v := [v, q]
Z
(F(u), v) := [−p (∇ · v) + ν∇u :∇v − f · v
ZΩ

+ (∇ · u) q] dx + n · (ν∇u − pI) · v ds
∂ΩN
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Some Examples

To obtain the approximate problem, we simply


replace u ← uh , v ← vh , and Ω ← Ωh in the weighted
residual statement.
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

1 Introduction

2 Weighted Residuals

3 Poisson Equation

4 Other Examples

5 Essential BCs

6 Some Extensions
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Weighted Residual Statement

For simplicity we will focus on the weighted residual


statement arising from the Poisson equation, with
∂ΩN = ∅,

(F(uh ), vh ) :=
Z
 h
∇u · ∇vh − fvh dx = 0 ∀vh ∈ V h

Ωh
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Element Integrals

The integral over Ωh . . .

Z
 h
∇u · ∇vh − fvh dx ∀vh ∈ V h

0 =
Ωh
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Element Integrals

The integral over Ωh . . . is written as a sum of


integrals over the Ne finite elements:

Z
 h
∇u · ∇vh − fvh dx ∀vh ∈ V h

0 =
Ωh
Ne Z
X  h
∇u · ∇vh − fvh dx ∀vh ∈ V h

=
e=1 Ωe
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Finite Element Basis Functions

An element integral will


have contributions only
from the global basis
functions corresponding
to its nodes. Ωe
We call these local basis
functions φi , 0 ≤ i ≤ Ns .
00000
11111
11111
00000
00000
11111
00000
11111
00000
11111
00000
11111

Ns
X
h

v Ωe
= ci φi
i=1
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Finite Element Basis Functions

An element integral will


have contributions only
from the global basis
functions corresponding
to its nodes. Ωe
We call these local basis
functions φi , 0 ≤ i ≤ Ns .
00000
11111
11111
00000
00000
11111
00000
11111
00000
11111
00000
11111

Ns
X
h

v Ωe
= ci φi
i=1
Z Ns
X Z
h
v dx = ci φi dx
Ωe i=1 Ωe
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Element Matrix and Load Vector

The element integrals . . .


Z
 h
∇u · ∇vh − fvh dx

Ωe
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Element Matrix and Load Vector

The element integrals . . .


Z
 h
∇u · ∇vh − fvh dx

Ωe

are written in terms of the local “φi ” basis functions


Ns
X Z Z
uj ∇φj · ∇φi dx − f φi dx , i = 1, . . . , Ns
j=1 Ωe Ωe
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Element Matrix and Load Vector

The element integrals . . .


Z
 h
∇u · ∇vh − fvh dx

Ωe

are written in terms of the local “φi ” basis functions


Ns
X Z Z
uj ∇φj · ∇φi dx − f φi dx , i = 1, . . . , Ns
j=1 Ωe Ωe

This can be expressed naturally in matrix notation as

K e Ue − Fe
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Global Linear System

The entries of the element stiffness matrix are the


integrals Z
K eij := ∇φj · ∇φi dx
Ωe
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Global Linear System

The entries of the element stiffness matrix are the


integrals Z
K eij := ∇φj · ∇φi dx
Ωe

While for the element right-hand side we have


Z
e
Fi := f φi dx
Ωe
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Global Linear System

The entries of the element stiffness matrix are the


integrals Z
K eij := ∇φj · ∇φi dx
Ωe

While for the element right-hand side we have


Z
e
Fi := f φi dx
Ωe

The element stiffness matrices and right-hand sides


can be “assembled” to obtain the global system of
equations
KU = F
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Reference Element Map

The integrals are performed on a “reference” element


Ω̂e

x
Ωe
x (ξ ) ξ

Ωe
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Reference Element Map

The integrals are performed on a “reference” element


Ω̂e

x
Ωe
x (ξ ) ξ

Ωe
The Jacobian of the map x(ξ) is J.

Z Z
Fei = f φi dx = f (x(ξ))φi |J|dξ
Ωe Ω̂e
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Reference Element Map

The integrals are performed on a “reference” element


Ω̂e

x
Ωe
x (ξ ) ξ

Ωe
ˆξ
Chain rule: ∇ = J −1 ∇ξ := ∇

Z Z
K eij = ∇φj · ∇φi dx = ˆ ξ φj · ∇
∇ ˆ ξ φi |J|dξ
Ωe Ω̂e
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Element Quadrature

The integrals on the “reference” element are


approximated via numerical quadrature.
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Element Quadrature

The integrals on the “reference” element are


approximated via numerical quadrature.
The quadrature rule has Nq points “ξq ” and weights
“wq ”.
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Element Quadrature

The integrals on the “reference” element are


approximated via numerical quadrature.
The quadrature rule has Nq points “ξq ” and weights
“wq ”.

Z
Fei = f φi |J|dξ
Ω̂e
Nq
X
≈ f (x(ξq ))φi (ξq )|J(ξq )|wq
q=1
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Element Quadrature

The integrals on the “reference” element are


approximated via numerical quadrature.
The quadrature rule has Nq points “ξq ” and weights
“wq ”.

Z
K eij = ˆ ξ φj · ∇
∇ ˆ ξ φi |J|dξ
Ω̂e
Nq
X
≈ ˆ ξ φj (ξq ) · ∇
∇ ˆ ξ φi (ξq )|J(ξq )|wq
q=1
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

LibMesh Quadrature Point Data

LibMesh provides the following variables at each


quadrature point q

Code Math Description


JxW[q] |J(ξq )|wq Jacobian times weight
phi[i][q] φi (ξq ) value of ith shape fn.
ˆ ξ φi (ξq )
dphi[i][q] ∇ value of ith shape fn. gradient
xyz[q] x(ξq ) location of ξq in physical space
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Matrix Assembly Loops

The LibMesh representation of the matrix and rhs


assembly is similar to the mathematical statements.

for (q=0; q<Nq; ++q)


for (i=0; i<Ns; ++i) {
Fe(i) += JxW[q]*f(xyz[q])*phi[i][q];

for (j=0; j<Ns; ++j)


Ke(i,j) += JxW[q]*(dphi[j][q]*dphi[i][q]);
}
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Matrix Assembly Loops

The LibMesh representation of the matrix and rhs


assembly is similar to the mathematical statements.

for (q=0; q<Nq; ++q)


for (i=0; i<Ns; ++i) {
Fe(i) += JxW[q]*f(xyz[q])*phi[i][q];

for (j=0; j<Ns; ++j)


Ke(i,j) += JxW[q]*(dphi[j][q]*dphi[i][q]);
}
Nq
X
Fei = f (x(ξq ))φi (ξq )|J(ξq )|wq
q=1
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Matrix Assembly Loops

The LibMesh representation of the matrix and rhs


assembly is similar to the mathematical statements.

for (q=0; q<Nq; ++q)


for (i=0; i<Ns; ++i) {
Fe(i) += JxW[q]*f(xyz[q])*phi[i][q];

for (j=0; j<Ns; ++j)


Ke(i,j) += JxW[q]*(dphi[j][q]*dphi[i][q]);
}
Nq
X
Fei = f (x(ξq ))φi (ξq )|J(ξq )|wq
q=1
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Matrix Assembly Loops

The LibMesh representation of the matrix and rhs


assembly is similar to the mathematical statements.

for (q=0; q<Nq; ++q)


for (i=0; i<Ns; ++i) {
Fe(i) += JxW[q]*f(xyz[q])*phi[i][q];

for (j=0; j<Ns; ++j)


Ke(i,j) += JxW[q]*(dphi[j][q]*dphi[i][q]);
}
Nq
X
Fei = f (x(ξq ))φi (ξq )|J(ξq )|wq
q=1
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Matrix Assembly Loops

The LibMesh representation of the matrix and rhs


assembly is similar to the mathematical statements.

for (q=0; q<Nq; ++q)


for (i=0; i<Ns; ++i) {
Fe(i) += JxW[q]*f(xyz[q])*phi[i][q];

for (j=0; j<Ns; ++j)


Ke(i,j) += JxW[q]*(dphi[j][q]*dphi[i][q]);
}
Nq
X
Fei = f (x(ξq ))φi (ξq )|J(ξq )|wq
q=1
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Matrix Assembly Loops

The LibMesh representation of the matrix and rhs


assembly is similar to the mathematical statements.

for (q=0; q<Nq; ++q)


for (i=0; i<Ns; ++i) {
Fe(i) += JxW[q]*f(xyz[q])*phi[i][q];

for (j=0; j<Ns; ++j)


Ke(i,j) += JxW[q]*(dphi[j][q]*dphi[i][q]);
}
Nq
X
K eij = ˆ ξ φj (ξq ) · ∇
∇ ˆ ξ φi (ξq )|J(ξq )|wq
q=1
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Matrix Assembly Loops

The LibMesh representation of the matrix and rhs


assembly is similar to the mathematical statements.

for (q=0; q<Nq; ++q)


for (i=0; i<Ns; ++i) {
Fe(i) += JxW[q]*f(xyz[q])*phi[i][q];

for (j=0; j<Ns; ++j)


Ke(i,j) += JxW[q]*(dphi[j][q]*dphi[i][q]);
}
Nq
X
K eij = ˆ ξ φj (ξq ) · ∇
∇ ˆ ξ φi (ξq )|J(ξq )|wq
q=1
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Matrix Assembly Loops

The LibMesh representation of the matrix and rhs


assembly is similar to the mathematical statements.

for (q=0; q<Nq; ++q)


for (i=0; i<Ns; ++i) {
Fe(i) += JxW[q]*f(xyz[q])*phi[i][q];

for (j=0; j<Ns; ++j)


Ke(i,j) += JxW[q]*(dphi[j][q]*dphi[i][q]);
}
Nq
X
K eij = ˆ ξ φj (ξq ) · ∇
∇ ˆ ξ φi (ξq )|J(ξq )|wq
q=1
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

1 Introduction

2 Weighted Residuals

3 Poisson Equation

4 Other Examples

5 Essential BCs

6 Some Extensions
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Convection-Diffusion Equation

The matrix assembly routine for the linear


convection-diffusion equation,

−k∆u + b · ∇u = f

for (q=0; q<Nq; ++q)


for (i=0; i<Ns; ++i) {
Fe(i) += JxW[q]*f(xyz[q])*phi[i][q];

for (j=0; j<Ns; ++j)


Ke(i,j) += JxW[q]*(k*(dphi[j][q]*dphi[i][q])
+(b*dphi[j][q])*phi[i][q]);
}
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Convection-Diffusion Equation

The matrix assembly routine for the linear


convection-diffusion equation,

−k∆u + b · ∇u = f

for (q=0; q<Nq; ++q)


for (i=0; i<Ns; ++i) {
Fe(i) += JxW[q]*f(xyz[q])*phi[i][q];

for (j=0; j<Ns; ++j)


Ke(i,j) += JxW[q]*(k*(dphi[j][q]*dphi[i][q])
+(b*dphi[j][q])*phi[i][q]);
}
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Convection-Diffusion Equation

The matrix assembly routine for the linear


convection-diffusion equation,

−k∆u + b · ∇u = f

for (q=0; q<Nq; ++q)


for (i=0; i<Ns; ++i) {
Fe(i) += JxW[q]*f(xyz[q])*phi[i][q];

for (j=0; j<Ns; ++j)


Ke(i,j) += JxW[q]*(k*(dphi[j][q]*dphi[i][q])
+(b*dphi[j][q])*phi[i][q]);
}
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Stokes Flow

For multi-variable systems like Stokes flow,

∇p − ν∆u = f
∈ Ω ⊂ R2
∇·u = 0
The element stiffness matrix concept can extended to
include sub-matrices
 e
Ku1 u1 Kue1 u2 Kue1 p
 e   e 
Uu1 Fu1
 Kue u Kue u Kue p   Uue  −  Fue 
2 1 2 2 2 2 2
e
Kpu 1
Kpue
2
Kppe
Upe Fpe

We have an array of submatrices: Ke[ ][ ]


Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Stokes Flow

For multi-variable systems like Stokes flow,

∇p − ν∆u = f
∈ Ω ⊂ R2
∇·u = 0
The element stiffness matrix concept can extended to
include sub-matrices
 e
Ku1 u1 Kue1 u2 Kue1 p
 e   e 
Uu1 Fu1
 Kue u Kue u Kue p   Uue  −  Fue 
2 1 2 2 2 2 2
e
Kpu 1
Kpue
2
Kppe
Upe Fpe

We have an array of submatrices: Ke[0][0]


Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Stokes Flow

For multi-variable systems like Stokes flow,

∇p − ν∆u = f
∈ Ω ⊂ R2
∇·u = 0
The element stiffness matrix concept can extended to
include sub-matrices
 e
Ku1 u1 Kue1 u2 Kue1 p
 e   e 
Uu1 Fu1
 Kue u Kue u Kue p   Uue  −  Fue 
2 1 2 2 2 2 2
e
Kpu 1
Kpue
2
Kppe
Upe Fpe

We have an array of submatrices: Ke[1][1]


Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Stokes Flow

For multi-variable systems like Stokes flow,

∇p − ν∆u = f
∈ Ω ⊂ R2
∇·u = 0
The element stiffness matrix concept can extended to
include sub-matrices
 e
Ku1 u1 Kue1 u2 Kue1 p
 e   e 
Uu1 Fu1
 Kue u Kue u Kue p   Uue  −  Fue 
2 1 2 2 2 2 2
e
Kpu 1
Kpue
2
Kppe
Upe Fpe

We have an array of submatrices: Ke[2][1]


Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Stokes Flow

For multi-variable systems like Stokes flow,

∇p − ν∆u = f
∈ Ω ⊂ R2
∇·u = 0
The element stiffness matrix concept can extended to
include sub-matrices
 e
Ku1 u1 Kue1 u2 Kue1 p
 e   e 
Uu1 Fu1
 Kue u Kue u Kue p   Uue  −  Fue 
2 1 2 2 2 2 2
e
Kpu 1
Kpue
2
Kppe
Upe Fpe

And an array of right-hand sides: Fe[].


Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Stokes Flow

For multi-variable systems like Stokes flow,

∇p − ν∆u = f
∈ Ω ⊂ R2
∇·u = 0
The element stiffness matrix concept can extended to
include sub-matrices
 e
Ku1 u1 Kue1 u2 Kue1 p
 e   e 
Uu1 Fu1
 Kue u Kue u Kue p   Uue  −  Fue 
2 1 2 2 2 2 2
e
Kpu 1
Kpue
2
Kppe
Upe Fpe

And an array of right-hand sides: Fe[0].


Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Stokes Flow

For multi-variable systems like Stokes flow,

∇p − ν∆u = f
∈ Ω ⊂ R2
∇·u = 0
The element stiffness matrix concept can extended to
include sub-matrices
 e
Ku1 u1 Kue1 u2 Kue1 p
 e   e 
Uu1 Fu1
 Kue u Kue u Kue p   Uue  −  Fue 
2 1 2 2 2 2 2
e
Kpu 1
Kpue
2
Kppe
Upe Fpe

And an array of right-hand sides: Fe[1].


Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Stokes Flow

The matrix assembly can proceed in essentially the


same way.
For the momentum equations:

for (q=0; q<Nq; ++q)


for (d=0; d<2; ++d)
for (i=0; i<Ns; ++i) {
Fe[d](i) += JxW[q]*f(xyz[q],d)*phi[i][q];

for (j=0; j<Ns; ++j)


Ke[d][d](i,j) +=
JxW[q]*nu*(dphi[j][q]*dphi[i][q]);
}
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

1 Introduction

2 Weighted Residuals

3 Poisson Equation

4 Other Examples

5 Essential BCs

6 Some Extensions
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Essential Boundary Data

Dirichlet boundary conditions can be enforced after


the global stiffness matrix K has been assembled
This usually involves
1 placing a “1” on the main diagonal of the global
stiffness matrix
2 zeroing out the row entries
3 placing the Dirichlet value in the rhs vector
4 subtracting off the column entries from the rhs
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Essential Boundary Data

Dirichlet boundary conditions can be enforced after


the global stiffness matrix K has been assembled
This usually involves
1 placing a “1” on the main diagonal of the global
stiffness matrix
2 zeroing out the row entries
3 placing the Dirichlet value in the rhs vector
4 subtracting off the column entries from the rhs
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Essential Boundary Data

Dirichlet boundary conditions can be enforced after


the global stiffness matrix K has been assembled
This usually involves
1 placing a “1” on the main diagonal of the global
stiffness matrix
2 zeroing out the row entries
3 placing the Dirichlet value in the rhs vector
4 subtracting off the column entries from the rhs
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Essential Boundary Data

Dirichlet boundary conditions can be enforced after


the global stiffness matrix K has been assembled
This usually involves
1 placing a “1” on the main diagonal of the global
stiffness matrix
2 zeroing out the row entries
3 placing the Dirichlet value in the rhs vector
4 subtracting off the column entries from the rhs
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Essential Boundary Data

Dirichlet boundary conditions can be enforced after


the global stiffness matrix K has been assembled
This usually involves
1 placing a “1” on the main diagonal of the global
stiffness matrix
2 zeroing out the row entries
3 placing the Dirichlet value in the rhs vector
4 subtracting off the column entries from the rhs

       
k11 k12 k13 . f1 1 0 0 0 g1
k21 k22 k23 . f2 
   0 k22 k23 . , f2 − k21 g1 
 
 , →
k31 k32 k33 . f3  0 k32 k33 .  f3 − k31 g1 
. . . . . 0 . . . .
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Essential Boundary Data

Cons of this approach :


Works for an interpolary finite element basis but not in
general.
May be inefficient to change individual entries once
the global matrix is assembled.
Need to enforce boundary conditions for a generic
finite element basis at the element stiffness matrix
level.
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Essential Boundary Data

Cons of this approach :


Works for an interpolary finite element basis but not in
general.
May be inefficient to change individual entries once
the global matrix is assembled.
Need to enforce boundary conditions for a generic
finite element basis at the element stiffness matrix
level.
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Essential Boundary Data

Cons of this approach :


Works for an interpolary finite element basis but not in
general.
May be inefficient to change individual entries once
the global matrix is assembled.
Need to enforce boundary conditions for a generic
finite element basis at the element stiffness matrix
level.
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Essential Boundary Data

Cons of this approach :


Works for an interpolary finite element basis but not in
general.
May be inefficient to change individual entries once
the global matrix is assembled.
Need to enforce boundary conditions for a generic
finite element basis at the element stiffness matrix
level.
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Penalty Formulation

One solution is the “penalty” boundary formulation


A term is added to the standard weighted residual
statement
Z
1
(F(u), v) + (u − uD )v dx = 0 ∀v ∈ V
 ∂ΩD
| {z }
penalty term

Here   1 is chosen so that, in floating point


arithmetic, 1 + 1 = 1 .
This weakly enforces u = uD on the Dirichlet
boundary, and works for general finite element bases.
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Penalty Formulation

One solution is the “penalty” boundary formulation


A term is added to the standard weighted residual
statement
Z
1
(F(u), v) + (u − uD )v dx = 0 ∀v ∈ V
 ∂ΩD
| {z }
penalty term

Here   1 is chosen so that, in floating point


arithmetic, 1 + 1 = 1 .
This weakly enforces u = uD on the Dirichlet
boundary, and works for general finite element bases.
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Penalty Formulation

One solution is the “penalty” boundary formulation


A term is added to the standard weighted residual
statement
Z
1
(F(u), v) + (u − uD )v dx = 0 ∀v ∈ V
 ∂ΩD
| {z }
penalty term

Here   1 is chosen so that, in floating point


arithmetic, 1 + 1 = 1 .
This weakly enforces u = uD on the Dirichlet
boundary, and works for general finite element bases.
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Penalty Formulation

One solution is the “penalty” boundary formulation


A term is added to the standard weighted residual
statement
Z
1
(F(u), v) + (u − uD )v dx = 0 ∀v ∈ V
 ∂ΩD
| {z }
penalty term

Here   1 is chosen so that, in floating point


arithmetic, 1 + 1 = 1 .
This weakly enforces u = uD on the Dirichlet
boundary, and works for general finite element bases.
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Penalty Formulation

LibMesh provides:
A quadrature rule with Nqf points and JxW f[]
A finite element coincident with the boundary face
that has shape function values phi f[][]

for (qf=0; qf<Nqf; ++qf) {


for (i=0; i<Nf; ++i) {
Fe(i) += JxW_f[qf]*
penalty*uD(xyz[q])*phi_f[i][qf];

for (j=0; j<Nf; ++j)


Ke(i,j) += JxW_f[qf]*
penalty*phi_f[j][qf]*phi_f[i][qf];
}
}
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Penalty Formulation

LibMesh provides:
A quadrature rule with Nqf points and JxW f[]
A finite element coincident with the boundary face
that has shape function values phi f[][]

for (qf=0; qf<Nqf; ++qf) {


for (i=0; i<Nf; ++i) {
Fe(i) += JxW_f[qf]*
penalty*uD(xyz[q])*phi_f[i][qf];

for (j=0; j<Nf; ++j)


Ke(i,j) += JxW_f[qf]*
penalty*phi_f[j][qf]*phi_f[i][qf];
}
}
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Penalty Formulation

LibMesh provides:
A quadrature rule with Nqf points and JxW f[]
A finite element coincident with the boundary face
that has shape function values phi f[][]

for (qf=0; qf<Nqf; ++qf) {


for (i=0; i<Nf; ++i) {
Fe(i) += JxW_f[qf]*
penalty*uD(xyz[q])*phi_f[i][qf];

for (j=0; j<Nf; ++j)


Ke(i,j) += JxW_f[qf]*
penalty*phi_f[j][qf]*phi_f[i][qf];
}
}
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

1 Introduction

2 Weighted Residuals

3 Poisson Equation

4 Other Examples

5 Essential BCs

6 Some Extensions
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Time-Dependent Problems

For linear problems, we have already seen how the


weighted residual statement leads directly to a
sparse linear system of equations

KU = F
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Time-Dependent Problems

For time-dependent problems,


∂u
= F(u)
∂t
we also need a way to advance the solution in time,
e.g. a θ-method
 n+1
u − un h

= F(uθ ), vh ∀vh ∈ V h

,v
∆t
uθ := θun+1 + (1 − θ)un

Leads to KU = F at each timestep.


Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Nonlinear Problems

For nonlinear problems, typically a sequence of linear


problems must be solved, e.g. for Newton’s method

(F 0 (uk )δuk+1 , v) = −(F(uk ), v)

where F 0 (uk ) is the linearized (Jacobian) operator


associated with the PDE.
Must solve KU = F (Inexact Newton method) at each
iteration step.
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Non-Trivial Applications

Common to each is the need to solve a linear system


(or systems) of equations KU = F.
LibMesh provides several of the tools necessary to
construct these systems, but it is not specifically
written to solve any one problem.
We now briefly show a few of the non-trivial
applications which have been built on top of the
library.
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Natural Convection

Tetrahedral mesh of “pipe” geometry. Stream ribbons


colored by temperature.
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Surface-Tension-Driven Flow

Adaptive grid solution shown with temperature


contours and velocity vectors.
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Double-Diffusive Convection

Solute contours: a plume of warm, low-salinity fluid is


convected upward through a porous medium.
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Tumor Angiogenesis

The tumor secretes a chemical which stimulates


blood vessel formation.
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Natural Convection

Tetrahedral mesh of “pipe” geometry. Stream ribbons


colored by temperature.
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Surface-Tension-Driven Flow

Adaptive grid solution shown with temperature


contours and velocity vectors.
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Double-Diffusive Convection

Solute contours: a plume of warm, low-salinity fluid is


convected upward through a porous medium.
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

Tumor Angiogenesis

The tumor secretes a chemical which stimulates


blood vessel formation.
Outline Introduction Weighted Residuals Poisson Equation Other Examples Essential BCs Some Extensions Reference

B. Kirk, J. Peterson, R. Stogner and G. Carey,


“libMesh: a C++ library for parallel adaptive mesh
refinement/coarsening simulations”, Engineering with
Computers, vol. 22, no. 3–4, p. 237–254, 2006.

Você também pode gostar