MAE 263 - HOMEWORK No 1/SOLUTION

advertisement
2
1.5
1
y
0.5
0
−0.5
−1
−1.5
−2
−2
−1
−1.5
0
−0.5
0.5
1
2
1.5
x
Figure 1: Arbitrary quadrilateral with centroid at the origin
MAE 263 - HOMEWORK No 1/SOLUTION - 1/11/10
Using the divergence theorem for an arbitrary
∫ 2-D domain Ω
∫ with smooth boundary ∂Ω yields
−
→
div V dxdy =
Ω
− −
→
V .→
n dl
∂Ω
dl is the length of the vector (dx, dy) and the exterior normal vector of the same length has components (dy, −dx).
The divergence operator is
∂b
−
→ ∂a
div V =
+
∂x ∂y
−
→
where V = (a, b).
→
−
Choosing V = (u, 0) yields the following
result ∫
∫
Ω
∂u
dxdy =
∂x
∫
(u, 0).(dy, −dx) =
∂Ω
udy
∂Ω
Now, Ω is an arbitrary quadrangle. u(x, y) is not know inside Ω but u is assumed to vary linearily along the edges
of the quadrangle. The contour integral in the right-hand side can be computed exactly using the trapezoidal rule.
The left-hand side is replaced by the denition of the average of the partial derivative on the quadrangle:
∂u
( )Ω
∂x
∫
dxdy =
Ω
4
∑
un + un+1
(yn+1 − yn )
2
n=1
where n = 5 corresponds to n = 1.
Finally, the area is obtained by replacing u by x in the above formula.
Result after some simplications:
(
Similarily:
(
∂u
(u4 − u2 )(y3 − y1 ) − (u3 − u1 )(y4 − y2 )
)Ω =
∂x
(x4 − x2 )(y3 − y1 ) − (x3 − x1 )(y4 − y2 )
∂u
(u3 − u1 )(x4 − x2 ) − (u4 − u2 )(x3 − x1 )
)Ω =
∂y
(x4 − x2 )(y3 − y1 ) − (x3 − x1 )(y4 − y2 )
Checking the result with the following test functions:
i) u(x, y) = x
ii) u(x, y) = y
iii) u(x, y) = x2
iv) u(x, y) = y 2
v) u(x, y) = xy ,
yields an exact answer in case i) and ii). But in the other cases, it is not possible to nd a relationship between
the result and a remakable point in the quadrangle, such as the center of gravity or the intersection of the medians
or the diagonals. The scheme is expected to be rst-order accurate in space.
1
A more elaborate study can be carried out in two ways, analytically using Taylor expansions or using mesh renement
on the computer.
The rst approach is to choose a point (x, y) inside the quadrangle, for example the center of gravity, and expand
the exact solution u(x, y) formally about it, say:
u1 = u + (x1 − x)
∂u (x1 − x)2 ∂ 2 u
∂2u
(y1 − y)2 ∂ 2 u
∂u
+ (y1 − y)
+
+
(x
−
x)(y
−
y)
+
+ O(∆3 )
1
1
∂x
∂y
2!
∂x2
∂x∂y
2!
∂y 2
where all the partial derivatives are evaluated at the center of gravity and ∆ = O(|x1 − x| + |y1 − y|) is related to
the size of the quadrangle. Substituting these Taylor expansions into the nite-volume formula yields, after some
manipulations
(
∂u
(x4 − x2 )(y3 − y1 ) − (x3 − x1 )(y4 − y2 ) ∂u
(y4 − y2 )(y3 − y1 ) − (y3 − y1 )(y4 − y2 ) ∂u
)Ω =
+
∂x
(x4 − x2 )(y3 − y1 ) − (x3 − x1 )(y4 − y2 ) ∂x (x4 − x2 )(y3 − y1 ) − (x3 − x1 )(y4 − y2 ) ∂y
+
+
x2 +x4 −2x
(x4
2
− x2 )(y3 − y1 ) − x1 +x23 −2x (x3 − x1 )(y4 − y2 ) ∂ 2 u
(x4 − x2 )(y3 − y1 ) − (x3 − x1 )(y4 − y2 )
∂x2
[(x4 − x)(y4 − y) − (x2 − x)(y2 − y)] (y3 − y1 ) − [(x3 − x)(y3 − y) − (x1 − x)(y1 − y)] (y4 − y2 ) ∂ 2 u
(x4 − x2 )(y3 − y1 ) − (x3 − x1 )(y4 − y2 )
∂x∂y
+
y2 +y4 −2y
(y4
2
− y2 )(y3 − y1 ) − y1 +y23 −2y (y3 − y1 )(y4 − y2 ) ∂ 2 u
+ O(∆2 )
(x4 − x2 )(y3 − y1 ) − (x3 − x1 )(y4 − y2 )
∂y 2
The coecients of the rst derivatives simplify in all cases but, in general, the coecients of the second derivatives
do not cancel out, indicating that the scheme is rst order accurate, i.e.
(
∂u
∂u
)Ω =
+ O(∆)
∂x
∂x
However, if the quadrilateral is a parallelogram, then
three terms are zero, i.e.
(
x2 +x4
2
=
x1 +x3
2
= x and
y2 +y4
2
=
y1 +y3
2
= y , and the last
∂u
∂u
)Ω =
+ O(∆2 )
∂x
∂x
Indeed, after some manipulation, the cross-derivative term can also be written as
[ x2 +x4 −2x
2
(y4 − y2 ) +
]
[
− x2 ) (y3 − y1 ) − x1 +x23 −2x (y3 − y1 ) +
(x4 − x2 )(y3 − y1 ) − (x3 − x1 )(y4 − y2 )
y2 +y4 −2y
(x4
2
y1 +y3 −2y
(x3
2
]
− x1 ) (y4 − y2 ) ∂ 2 u
∂x∂y
The numerical study of the truncation error can be carried out numerically. An arbitrary quadrilateral is shown
in Fig.1. A translation has been performed so that the centroid is at the origin. Running the scheme with a
quadrilateral that is shrunk by a factor two at each step, preserving the shape and angles, allows to study the
formal accuracy of the scheme (Ref. A Test of Formal Accuracy of Numerical Schemes on Unstructured Meshes,
J.J. Chattot, Computational Fluid Dynamics Journal, Special Number 2001, pp 237-241). The results of the study
∂u
1
are shown in Fig.2, where log |( ∂u
∂x )Ω − ∂x | is plotted vs. log 2p = log O(∆), where p is the order of the renement.
Similar results, by symmetry, are found for the y -derivative, therefore there is no need to carry the analysis.
2
0
slope of 2
u(x,y)=x or y
u(x,y)=x^2
u(x,y)=y^2
u(x,y)=xy
−5
log|du/dx−(du/dx)|
−10
−15
−20
−25
−30
−40
−30
−20
−10
0
log(1/2^p)
∂u
∂u
∂u
1
Figure 2: log| ∂u
∂x − ( ∂x )Ω | and log| ∂y − ( ∂y )Ω | vs. Log( 2p )
3
Download