# Hw2A.pdf

by user

on
Category: Documents
1

views

Report

#### Transcript

Hw2A.pdf
```Homework 2 Answers
1
Consider the following boundary value problem, encountered in the analysis of radial stresses
σ inside rapidly rotating disks: Determine the function σ(r) for r ∈ [0.1, 0.5] such that
r2
d2 σ
dσ
+ 3r
+ 1010 r2 = 0
2
dr
dr
subject to the conditions
σ(a) = 0
σ(b) = 0
a) Obtain the exact solution and compute and plot the resulting function σ(r).
b) Obtain an approximate solution by solving the problem numerically using the finite
difference method. Determine the accuracy of the approximation as a function of the step
size ∆r by comparing the approximation with the exact solution.
c) Obtain an approximate solution by solving the problem numerically using the Galerkin
finite element method with the simplest basis functions. Determine the accuracy of the
approximation as a function of the step size ∆r (or the number of degrees of freedom in the
model) by comparing the approximation with the exact solution.
d) Obtain an approximate solution by solving the problem numerically using the shooting
method. Determine the accuracy of the results as a function of the step size ∆r by comparing
the approximation with the exact solution.
e) Obtain an approximate solution using the COMSOL system.
1
a.- The exact solution is (see Maple file Hw2-P1a)
3.125 × 106
+ 3.25 × 108
r2
σ = −1.25 × 109 r2 −
b.- Using central differences on an uniform mesh ri , i = 1, 2, ...N with spacing ∆r, the
following FD analogue is obtained
ri2
σi−1 − 2σi + σi+1
σi+1 − σi−1 10 2
+ 3ri
10 ri = 0
2
∆r
2∆r
where σi ≈ σ(ri ). Rearrangement yields
−σi−1(1 − 3
∆r
∆r
) + 2σi − σi+1 (1 + 3 ) = 1010 ∆r2
ri
ri
This is a tridiagonal system which can be readily solved using the TDMA algorithm (see
Fortran program Hw2-P1b). The accuracy of the approximation can be assessed by comparing the difference between the value of the computed approximation and the exact solution.
A mesh with 21 nodes produced results within 1% of the exact solution (check!).
c.- The Galerkin finite element method requires first expression of the problem in variational formulation, i.e.
Z
0.5
−σ ′′v(r)dr −
0.1
0.5
Z
0.1
3 ′
σ v(r)dr =
r
Z
0.5
1010 v(r)dr
0.1
where v(r) is any suitably chosen function which satisfies the same boundary conditions as σ.
Integrating the first term by parts and taking into account the boundary conditions, yields
Z
0.5
0.1
σ ′ v ′dr −
Z
0.5
0.1
3 ′
σ vdr =
r
Z
0.5
1010 vdr
0.1
The Galerkin FEM proceeds by introducing first the (global) finite element basis functions
for all nodal locations i, φi as simple polynomials with compact support (hat functions) and
then approximates σ ≈ σh as
σh =
N
X
σ i φi
1
where σi are the (unknown) approximate values of σ at the nodal locations (i.e. σi ≈ σ(ri ))
and N is the total number of nodes. Moreover, the test function v is taken as
v=
N
X
1
2
φi
Specifically, for a two-element model, ∆r = (0.5 − 0.1)/2 = 0.2. In this case, only the
value of σ at the midpoint (node 2) is unknown. The basis function there is
φ2 =
(
(r − 0.1)/0.2 for r ∈ [0.1, 0.3]
(0.5 − r)/0.2 for x ∈ [0.3, 0.5]
With this, the variational formulation becomes
Z
0.5
0.1
σ2 φ′2 φ′2dr −
Z
0.5
0.1
3
σ2φ′2 φ2 dr =
r
Z
0.5
1010 φ2 dr
0.1
where
φ′2
=
(
1/0.2 = 5
for r ∈ [0.1, 0.3]
−1/0.2 = −5 for x ∈ [0.3, 0.5]
Therefore
σ2 =
R 0.5
10
0.1 10 φ2 dr
R 0.5 ′ ′
R 0.5 3 ′
0.1 φ2 φ2 dr − 0.1 r φ2 φ2 dr
which allows direct computation of σ2 by performing the indicated integrations which are
straightforward (check!). As shown in Maple code Hw2-P3, 11 elements yield results within
1% of the exact values.
d.- The shooting method expresses the desired approximation as
σ(r) = s1(r) −
s1(0.5)
s2 (r)
s2(0.5)
where s1, s2 are the solutions of the following two IVPs
3
s′′1 = − s′1 − 1010
r
subject to
s1 (0.1) = 0
s′1 (0.5) = 0
and
3
s′′2 = − s′1
r
subject to
s2 (0.1) = 0
s′2 (0.5) = 1
3
A mesh with 11 nodes produce the desired accuracy (check!). See Maple and Fortran files
Hw2-P1d.
e.- See file Hw2-P1e for the COMSOL model. Use of default meshing (15 nodes) produces
the desired accuracy (check!).
2
Consider the following boundary value problem, encountered in the analysis of steady-state
temperature u(x), due to conduction of heat through the thickness of a slab inside which
energy is generated at a constant rate: Determine the function u(x) for x ∈ [0, 1] such that
−
d2 u
= 1000
dx2
subject to the conditions
du
=0
dx
at x = 0, and
u(b) = 0
at x = 1.
a) Obtain the exact solution and compute and plot the resulting function u(x).
b) Obtain an approximate solution by solving the problem numerically using the finite
difference method. Determine the accuracy of the approximation as a function of the step
size ∆x by comparing the approximation with the exact solution.
c) Obtain an approximate solution by solving the problem numerically using the Galerkin
finite element method with the simplest basis functions. Determine the accuracy of the
approximation as a function of the step size ∆x (or the number of degrees of freedom in the
model) by comparing the approximation with the exact solution.
d) Obtain an approximate solution by solving the problem numerically using the shooting
method. Determine the accuracy of the results as a function of the step size ∆x by comparing
the approximation with the exact solution.
e) Obtain an approximate solution using the COMSOL system.
4
a.- The exact solution is (see Maple file Hw2-P2a)
u = 500(1 − x2)
b.- Using central differences on an uniform mesh xi , i = 1, 2, ...N with spacing ∆x, the
following FD analogue is obtained
−ui−1 + 2ui − ui+1 = 103 ∆x2
where ui ≈ u(xi ).
Regarding the boundary condition at x = 0, one introduces a ”ghost” node labeled x−2
at x = −∆x and applies central differences to approximate the boundary condition as
u2 − u−2
2∆x
i.e. u−2 = u2 . This is then substituted into the FD formula applied at node 1, i.e.
−u−2 + 2u1 − u2 = u1 = u2 + 500∆x2
which provides an equation for the unknown (approximate) value of u at x = 0
The resulting system of algebraic equations is tridiagonal and can be readily solved using
the TDMA algorithm (see Fortran program Hw2-P2b). The accuracy of the approximation
can be assessed by comparing the difference between the value of the computed approximation and the exact solution. A mesh with 21 nodes produced results within 1% of the exact
solution (check!).
c.- The Galerkin finite element method requires first expression of the problem in variational formulation, i.e.
Z
1
Z
′′
−u v(x)dx =
0
1
103 v(x)dx
0
where v(x) is a suitably chosen function which satisfies the same boundary conditions as σ.
Integrating the first term by parts and taking into account the boundary conditions, yields
[u
′
v]10
+
Z
1
′ ′
u v dx =
0
Z
1
′ ′
u v dx =
0
Z
1
103 vdx
0
The Galerkin FEM proceeds by introducing first the (global) finite element basis functions
for all nodal locations i, φi as simple polynomials with compact support (hat functions) and
then approximates u ≈ uh as
uh =
N
X
u i φi
1
5
where ui are the (unknown) approximate values of u at the nodal locations (i.e. ui ≈ u(xi ))
and N is the total number of nodes. Moreover, the test function v is taken as
v=
N
X
φi
1
Specifically, for a two-element model, ∆x = 0.5. In this case, there are two unknowns,
the values of u at x = 0 and x = 0.5. The corresponding basis functions are
(
φ1 =
(0.5 − x)/0.5 for x ∈ [0, 0.5]
0
for x ∈ [0.5, 1]
and
φ2 =
(
x/0.5
for x ∈ [0, 0.5]
(1 − x)/0.5 for x ∈ [0.5, 1]
With this, the variational formulation results in the system of two equations
Z
0
1/2
(u1 φ′1 + u2 φ′2)phi′1 dx =
Z
0.5
103 φ1 dx
0
and
Z
1
1/2
(u2 φ′2)φ′2 dx
=
Z
1
103 φ2dx
0.5
from whence the values of u1 and u2 can be determined (see Maple file Hw2-P2c).
d.- The shooting method expresses the desired approximation as
u(x) = u1 (x) −
u1 (1)
u2 (x)
u2 (1)
where u1, u2 are the solutions of the following two IVPs
u′′1 = −103
subject to
u1 (0) = 0
u′1 (1) = 0
and
u′′2 = 0
6
subject to
u2 (0) = 0
u′2 (1) = 1
A mesh with 11 nodes produce the desired accuracy (check!). See Maple and Fortran files
Hw2-P2d.
e.- See file Hw2-P2e for the COMSOL model. Use of default meshing (15 nodes) produces
the desired accuracy (check!).
3
Consider the following boundary value problem, encountered in the analysis of the deflections, y(x) of taut, elastic strings subject to transverse loading: Determine the function y(x)
for x ∈ [0, 1] such that
−
d2 y
= 10(1 − 10(x − 0.5)2 ) exp[−5(x − 0.5)2 ]
dx2
subject to the conditions
y(0) = 0
y(1) = 0
a) Obtain the exact solution and compute and plot the resulting function y(x).
b) Obtain an approximate solution by solving the problem numerically using the finite
difference method. Determine the accuracy of the approximation as a function of the step
size ∆x by comparing the approximation with the exact solution.
c) Obtain an approximate solution by solving the problem numerically using the Galerkin
finite element method with the simplest basis functions. Determine the accuracy of the
approximation as a function of the step size ∆x (or the number of degrees of freedom in the
model) by comparing the approximation with the exact solution.
d) Obtain an approximate solution by solving the problem numerically using the shooting
method. Determine the accuracy of the results as a function of the step size ∆x by comparing
the approximation with the exact solution.
7
e) Obtain an approximate solution using the COMSOL system.
a.- The exact solution is (see Maple file Hw2-P3a)
5
5
y = exp(− (2x − 1)2 ) − exp(− )
4
4
b.- Using central differences on an uniform mesh xi , i = 1, 2, ...N with spacing ∆x, the
following FD analogue is obtained
−yi−1 + 2yi − yi+1 = 10(1 − 10(x − 0.5)2 ) exp[−5(x − 0.5)2 ]∆x2
where yi ≈ y(xi).
The resulting system of algebraic equations is tridiagonal and can be readily solved using
the TDMA algorithm (see Fortran program Hw2-P2b). The accuracy of the approximation
can be assessed by comparing the difference between the value of the computed approximation and the exact solution. A mesh with 21 nodes produced results within 1% of the exact
solution (check!).
c.- The Galerkin finite element method requires first expression of the problem in variational formulation, i.e.
Z
1
−y ′′v(x)dx =
0
Z
1
10(1 − 10(x − 0.5)2 ) exp[−5(x − 0.5)2 ]v(x)dx
0
where v(x) is a suitably chosen function which satisfies the same boundary conditions as y.
Integrating the first term by parts and taking into account the boundary conditions, yields
Z
0
1
′ ′
y v dx =
Z
1
10(1 − 10(x − 0.5)2 ) exp[−5(x − 0.5)2 ]vdx
0
The Galerkin FEM proceeds by introducing first the (global) finite element basis functions
for all nodal locations i, φi as simple polynomials with compact support (hat functions) and
then approximates y ≈ yh as
yh =
N
X
y i φi
1
where yi are the (unknown) approximate values of u at the nodal locations (i.e. yi ≈ y(xi))
and N is the total number of nodes. Moreover, the test function v is taken as
v=
N
X
1
8
φi
Specifically, for a two-element model, ∆x = 0.5. There is only one unknown, y2. The
corresponding basis function is
φ2 =
(
x/0.5
for x ∈ [0, 0.5]
(1 − x)/0.5 for x ∈ [0.5, 1]
With this, the variational formulation yields
Z
0
1
(y2 φ′2 )φ′2dx
=
Z
1
10(1 − 10(x − 0.5)2 ) exp[−5(x − 0.5)2 ]φ2dr
0
from whence the value of y2 can be determined by performing the integrals (see Maple file
Hw2-P3c for a 3-element representation).
d.- The shooting method expresses the desired approximation as
y(x) = y1 (x) −
y1 (1)
y2 (x)
y2 (1)
where y1, y2 are the solutions of the following two IVPs
y1′′ = −10(1 − 10(x − 0.5)2 ) exp[−5(x − 0.5)2 ]
subject to
y1 (0) = 0
y1′ (1) = 0
and
y2′′ = 0
subject to
y2 (0) = 0
y2′ (1) = 1
A mesh with 21 nodes produce the desired accuracy (check!). See Maple and Fortran files
Hw2-P3d.
e.- See file Hw2-P3e for the COMSOL model. Use of default meshing (15 nodes) produces
the desired accuracy (check!).
9
```
Fly UP