Professional Documents
Culture Documents
MFC 2022 Exercises Block 3 v1
MFC 2022 Exercises Block 3 v1
Exercises - Block 3
by
José C. F. Pereira / José M. Chaves Pereira / Duarte M. S. Albuquerque
Mech. Eng. Dept. / LASEF / Pav. Mecânica I
jcfpereira@tecnico.ulisboa.pt / jose.chaves@tecnico.ulisboa.pt / duartealbuquerque@tecnico.ulisboa.pt
a)
Starting from a grid point distribution at the boundary of the problem domain new grid cells are
systematically created successively, until finally the full problem domain is covered with a mesh.
Let us assume first that also the distribution of the interior grid points already is prescribed. In this
case the advancing front methods for generating triangular grids is as follows:
(ii) For the last edge in the vector k all grid points are searched which are located on or within the
advancing front. From these (admissible) grid points one is selected according to certain criterion,
e.g., the one for which the sum of the distances to the two grid points or the last edge is smallest.
With the selected point and the two points from the last front edge a new triangle is formed.
(iii) The edges of the new triangle, which are contained in k, are deleted and the numbering of the
remaining edges in k is adjusted (compression). The edges of the new triangle, which are not
contained in k, are added at the end of k.
(iv) Steps (ii) and (iii) are repeated until all edges in k are deleted.
14 2
11
15 1
This will be our 12
front edge 4
1 2
1 2 … 11 12
15 4
Vertices
4 1 15 or Points
14 2
11
15 1
13 Define number’s order
12
4 14
1 15
1 2
1 2 … 11 13 14
4 1
A different criteria
could be followed
Leading to two
distinct results
V-E+F=1
15-30+16=1 OK!!!
a)
This example is covered with details in the recommend book at pages 207 to 215.
The circumcenter of
Voronoi Diagram
a triangle can be
can be used to
computed by
compute the
parametrizing the
centers of the
bisector (PM) of the
circumcircles of
12 edge and check
each triangle.
when 𝑃2 = 𝑃3
When inserting a new point, all triangles whose circumcircles contain the new point are deleted.
Which means that their common edges will disappear. A new triangulation is generated by
connecting the new point with the corner points of the polygon which results from the deletion of
the triangles. The methodology is illustrated in the figure below:
erased edges
a) Describe generically the Delaunay triangulation and particularly the Bowyer-Watson algorithm.
c) Add a new point to the final grid and explore what could happen.
a)
The Bowyer-Watson algorithm is based on the property that the circle through the three corner
points (circumcircle) of an arbitrary triangle contains no other points (the circumference of a
triangle is uniquely determined and its midpoint is located at the intersection point of the
perpendicular bisectors of the triangle sides). The corresponding grid generation algorithm starts
from a (generally very coarse) initial triangulation of the problem domain. By adding at each time
one new point successively further grids are created, where the corresponding strategy is based
on the above mentioned circumcircle property.
The triangulation procedure can be started from a coarse approach by defining a ‘supertriangle’ fully
containing the problem domain. The nodes of the supertriangle are temporarily added to the list of
nodes and the point insertion procedure is carried out as described above. Finally, after having
inserted all points, all triangles which contain one or more vertices of the supertriangle are removed.
Defining a ‘supertriangle’ one can produce a Delaunay triangulation using, e.g., Mathematica or
Matlab:
FINAL GRID
1 2
14 5 6
1 2 1 2
14 5 6 14 5 6
1 2 1 2
1 2 1 2
1414 6 14 6
55 6 14 55 6
1 2 1 2
1 2 1 2
14 6 14 6
14 55 6 14 55 6
Comparing with a
Delaunay triangulation
one can conclude the
mesh obtained is
Delaunay
What’s this?
In terms of cell faces, one have to generate lines perpendicular to the faces that pass through their
centers. These lines end when an intersection is found, this is the Voronoi diagram approach.
In terms of cell centers, this is done by connecting the centers of the cells around each vertex.
Voronoi diagram
from slide 15
Examples from
previous Thesis
supervised by the
Professor - DMSA
In three dimensions, it is
difficult to obtain planar
faces, after applying the
dual grid process to a
tetraedral grid
Formiga
(FORced Mesh Improvement and
Generation Algorithm) by
Manuel Dias da Costa
https://popersson.github.io
/distmesh/
𝟐 𝟕
𝟏𝟐 𝟗
𝟏𝟏
𝟖 𝟏𝟎
𝟏
The first triangle has more quality than the
rectangular option. The third triangle has
𝟏𝟐 𝟗
𝟏𝟏 an higher height than the alternative one
𝟏𝟎 with the boundary edge 2.
𝟓 𝟓
𝟒 𝟒
𝟔 𝟑 𝟔
𝟑
𝟒
𝟐 𝟐 𝟕
𝟕 𝟑
𝟖 𝟖
𝟏 𝟏
𝟏
𝟗 𝟏𝟐 𝟗
𝟏𝟐 𝟏𝟏
𝟏𝟏
𝟏𝟎 𝟗𝟎% 𝟏𝟎
IST, MFC, 2022 Exercises 50
𝟓
𝟒
The fifth triangle is better than 𝟑 𝟖 𝟔
the obtuse-angled alternative.
𝟕
𝟐 𝟕
𝟓
𝟒
𝟑 𝟔 𝟖
𝟏
𝟐 𝟓 𝟕
𝟏𝟐 𝟗
𝟏𝟏
𝟖 𝟏𝟎
𝟏
The seventh triangle is best option between
frame 2 and 3. The front goes to the top
𝟏𝟐 𝟗 edge of seventh triangle creating the eight
𝟏𝟏
𝟏𝟎 one at the top corner.
𝟓 𝟓
𝟒 𝟒
𝟔 𝟑 𝟔
𝟑
𝟐 𝟐 𝟕
𝟕
𝟖 𝟖
𝟏 𝟏
𝟗 𝟏𝟐 𝟗
𝟏𝟐 𝟏𝟏
𝟏𝟏
𝟏𝟎 𝟏𝟎
IST, MFC, 2022 Exercises 51
𝟓
After building the 10th triangle, the front goes 𝟒
to the new edge at the right, counter clockwise. 𝟑 𝟔
The algorithm will create two bad triangles 11 and 12.
This a limitation from the Advancing Front Method. 𝟐 𝟕
𝟓
𝟒
𝟑 𝟔 𝟖
𝟏 𝟏𝟎
𝟏𝟏
𝟐 𝟕
𝟏𝟐 𝟏𝟐 𝟗
𝟏𝟏
𝟖 𝟗𝟎% 𝟏𝟎
𝟏 𝟏𝟎
After the 12th triangle the front must go to the
last available edge from the stack. The final
𝟏𝟐 𝟗 grid configuration is driven from the selected
𝟏𝟏
algorithm and considered criteria.
𝟏𝟎
𝟓 𝟓
𝟒 𝟒
𝟔 𝟑 𝟔
𝟑
𝟐 𝟐 𝟕
𝟕
𝟖 𝟖
𝟏 𝟏𝟎 𝟏
𝟏𝟏
𝟗 𝟏𝟐 𝟗
𝟏𝟐 𝟏𝟏
𝟏𝟏
𝟏𝟎 𝟏𝟎
IST, MFC, 2022 Exercises 52
Finite Volume Discretization
in Unstructured Grids – Part I
𝜕𝜑 𝜕𝜑
+ 𝛻 ∙ 𝑢𝜑 = 𝛻 ∙ 𝜗𝛻𝜑 𝑑𝑉 + 𝛻 ∙ 𝑢𝜑 𝑑𝑉 = 𝛻 ∙ 𝜗𝛻𝜑 𝑑𝑉
𝜕𝑡 𝜕𝑡
𝑉 𝑉 𝑉
integrating
𝜕𝜑
𝑑𝑉 + 𝑢𝜑 ∙ 𝑛𝑑𝑆 = 𝜗𝛻𝜑 ∙ 𝑛𝑑𝑆
𝑉 𝜕𝑡 𝑆 𝑆
Gauss theorem
𝜕𝜑
𝑉+ 𝑢𝑖 𝜑𝑖 ∙ 𝑛𝑖 𝐴𝑖 = 𝜗𝛻𝜑𝑖 ∙ 𝑛𝑖 𝐴𝑖
𝜕𝑡
fluxes 𝑖∈𝑓𝑎𝑐𝑒𝑠 𝑖∈𝑓𝑎𝑐𝑒𝑠
up to second order
𝜕𝜑
𝑉+ 𝜑𝑖 𝑢𝑖 ∙ 𝑛𝑖 𝐴𝑖 = 𝜗 𝛻𝜑𝑖 ∙ 𝑛𝑖 𝐴𝑖
𝜕𝑡
𝑖∈𝑓𝑎𝑐𝑒𝑠 𝑖∈𝑓𝑎𝑐𝑒𝑠
𝜕𝜑
𝑉+ 𝜑𝑖 𝑢𝑖 ∙ 𝑛𝑖 𝐴𝑖 = 𝜗 𝛻𝜑𝑖 ∙ 𝑛𝑖 𝐴𝑖
𝜕𝑡
𝑖∈𝑓𝑎𝑐𝑒𝑠 𝑖∈𝑓𝑎𝑐𝑒𝑠
𝜑𝑃𝑛+1 − 𝜑𝑃𝑛 𝑑 1 6 3 3 3
𝑉 𝑣𝑜𝑙 = 𝑉 = 6 × 𝑙 × × = × 0.5 × =
∆𝑡 2 2 4 2 8
Each polyhedral
Has 6 triangles
𝜕𝜑
𝑉+ 𝜑𝑖 𝑢𝑖 ∙ 𝑛𝑖 𝐴𝑖 = 𝜗 𝛻𝜑𝑖 ∙ 𝑛𝑖 𝐴𝑖
𝜕𝑡
𝑖∈𝑓𝑎𝑐𝑒𝑠 𝑖∈𝑓𝑎𝑐𝑒𝑠
1 3
time level=n+1 -> Implicit Euler 𝑣=( , )
2 2
𝜑𝑃 𝑣 ∙ 𝑛1 𝑙 + 𝜑𝑃 𝑣 ∙ 𝑛2 𝑙 + 0 + 𝜑𝑁4 𝑣 ∙ 𝑛4 𝑙 + 𝜑𝑁5 𝑣 ∙ 𝑛5 𝑙 + 0
𝜕𝜑
𝑉+ 𝜑𝑖 𝑢𝑖 ∙ 𝑛𝑖 𝐴𝑖 = 𝜗 𝛻𝜑𝑖 ∙ 𝑛𝑖 𝐴𝑖
𝜕𝑡
𝑖∈𝑓𝑎𝑐𝑒𝑠 𝑖∈𝑓𝑎𝑐𝑒𝑠
1 3
time level=n+1 -> Implicit Euler 𝑣=( , )
2 2
𝜑𝑃 𝑣 ∙ 𝑛1 𝑙 + 𝜑𝑃 𝑣 ∙ 𝑛2 𝑙 + 0 + 𝜑𝑁4 𝑣 ∙ 𝑛4 𝑙 + 𝜑𝑁5 𝑣 ∙ 𝑛5 𝑙 + 0
1 3 1 3 3 1 1 3
𝑙( × 0 × 𝜑𝑃 + × 1 × 𝜑𝑃 + × 𝜑𝑃 + × 𝜑𝑃 + × 0 × 𝜑4 + × −1 × 𝜑4 +
2 2 2 2 2 2 2 2
1 3 3 1 3 3
+ × (− )𝜑5 + × (− )𝜑5 ) = 0.5( 3𝜑𝑃 − 𝜑 − 𝜑 )
2 2 2 2 2 4 2 5
𝜑𝑃 𝑣 ∙ 𝑛1 𝑙 + 𝜑𝑃 𝑣 ∙ 𝑛2 𝑙 + 0 + 𝜑𝑁4 𝑣 ∙ 𝑛4 𝑙 + 𝜑𝑁5 𝑣 ∙ 𝑛5 𝑙 + 0
3 3 3 3 3 3
𝑙 × 𝜑𝑃 + × 𝜑𝑃 + − × 𝜑4 + + − × 𝜑5 = 0.5( 3𝜑𝑃 − 𝜑4 − 𝜑 )
2 2 2 2 2 2 5
𝜕𝜑
𝑉+ 𝜑𝑖 𝑢𝑖 ∙ 𝑛𝑖 𝐴𝑖 = 𝜗 𝛻𝜑𝑖 ∙ 𝑛𝑖 𝐴𝑖
𝜕𝑡
𝑖∈𝑓𝑎𝑐𝑒𝑠 𝑖∈𝑓𝑎𝑐𝑒𝑠
𝜕𝜑
𝜗 𝐴
𝜕𝑛 𝑖 𝑖
𝑖∈𝑓𝑎𝑐𝑒𝑠
𝜑𝑁1 − 𝜑𝑃 𝜑𝑁1 − 𝜑𝑃 3
𝜗𝑙 = 𝜗𝑙 𝑑=
Δ𝑛 𝑑
2
𝜕𝜑
𝑉+ 𝜑𝑖 𝑢𝑖 ∙ 𝑛𝑖 𝐴𝑖 = 𝜗 𝛻𝜑𝑖 ∙ 𝑛𝑖 𝐴𝑖
𝜕𝑡
𝑖∈𝑓𝑎𝑐𝑒𝑠 𝑖∈𝑓𝑎𝑐𝑒𝑠
𝜕𝜑
𝜗 𝐴
𝜕𝑛 𝑖 𝑖
𝑖∈𝑓𝑎𝑐𝑒𝑠
𝜑𝑁1 − 𝜑𝑃 𝜑𝑁1 − 𝜑𝑃 3
𝜗𝑙 = 𝜗𝑙 𝑑=
Δ𝑛 𝑑
2
𝜕𝜑 𝜗𝑙
𝜗 𝐴𝑖 = 𝜑𝑁1 − 𝜑𝑃 + (𝜑𝑁2 −𝜑𝑃 + (𝜑𝑁3 −𝜑𝑃 ) + (𝜑𝑁4 − 𝜑𝑃 )
𝜕𝑛 𝑖 𝑑
𝑖∈𝑓𝑎𝑐𝑒𝑠
1
+ 𝜑𝑁5 − 𝜑𝑃 + (𝜑𝑁6 −𝜑𝑃 )] = [−6𝜑𝑃 + 𝜑𝑁1 + 𝜑𝑁2 + 𝜑𝑁3 + 𝜑𝑁4 + 𝜑𝑁5 + 𝜑𝑁6 ]
100 3
time level=n+1
𝜑𝑃𝑛+1 − 𝜑𝑃𝑛 3 3 3
( ) + (2𝜑𝑃 − 𝜑𝑁4 − 𝜑𝑁5 )
∆𝑡 8 4
3
− −6𝜑𝑃 + 𝜑𝑁1 + 𝜑𝑁2 + 𝜑𝑁3 + 𝜑𝑁4 + 𝜑𝑁5 + 𝜑𝑁6 = 0
300
𝜑𝑃𝑛+1 − 𝜑𝑃𝑛 3
( ) + (2𝜑𝑃 −𝜑𝑁4 − 𝜑𝑁5 )
∆𝑡 2
1
− −6𝜑𝑃 + 𝜑𝑁1 + 𝜑𝑁2 + 𝜑𝑁3 + 𝜑𝑁4 + 𝜑𝑁5 + 𝜑𝑁6 = 0
75
1
𝛻𝜑𝑖 = 𝜑𝑖 𝑛𝑖 𝑙𝑖
𝐴𝑖
𝑖∈𝑓𝑎𝑐𝑒𝑠
3 1 3 1
𝑛2 = ( , ) 𝑛5 = (− ,− )
2 2 2 2
3 1 3 1
𝑛3 = ( , − ) 𝑛6 = (− , )
2 2 2 2
1 1 1 1 3 1 1 1 3 1
𝜑𝑃 + 𝜑𝑁1 0,1 + 𝜑𝑃 + 𝜑𝑁2 ( , ) + 𝜑𝑃 + 𝜑𝑁3 ( , − ) +
1 2 2 2 2 2 2 2 2 2 2
𝛻𝜑𝑃 =
𝑉
1 1 1 1 3 1 1 1 3 1
𝜑𝑃 + 𝜑𝑁4 0, −1 + 𝜑𝑃 + 𝜑𝑁5 (− , − ) + 𝜑𝑃 + 𝜑𝑁6 (− , )
2 2 2 2 2 2 2 2 2 2
3 1 3 1
𝑛2 = ( , ) 𝑛5 = (− ,− )
2 2 2 2
3 1 3 1
𝑛3 = ( ,− ) 𝑛6 = (− , )
2 2 2 2
𝜕𝜑 8 1 1 3 1 1 3 1 1 3 1 1 3
= 𝜑𝑃 + 𝜑𝑁2 + 𝜑𝑃 + 𝜑𝑁3 − 𝜑𝑃 + 𝜑𝑁5 − 𝜑𝑃 + 𝜑𝑁6
𝜕𝑥 3 3 2 2 2 2 2 2 2 2 2 2 2 2
𝜕𝜑 8 3 3 3 3
= 𝜑𝑃 + 𝜑𝑁2 + 𝜑𝑃 + 𝜑𝑁3 − 𝜑𝑃 + 𝜑𝑁5 − 𝜑𝑃 + 𝜑𝑁6
𝜕𝑥 3 3 8 8 8 8
3 3
yy: 𝑉=
8
𝜕𝜑 8 1 1 1 1 1 1
= 𝜑𝑃 + 𝜑𝑁1 + 𝜑𝑃 + 𝜑𝑁2 − 𝜑𝑃 + 𝜑𝑁3 − 𝜑𝑃 + 𝜑𝑁4 − 𝜑𝑃 + 𝜑𝑁5 + 𝜑𝑃 + 𝜑𝑁6
𝜕𝑦 3 3 4 8 8 4 8 8
- convective flux
- diffusive flux
- cell grad
- convective flux
- diffusive flux
- cell grad
𝜕𝜑 𝜕𝜑
+ 𝛻 ∙ 𝑢𝜑 = 𝛻 ∙ 𝜗𝛻𝜑 𝑑𝑉 + 𝛻 ∙ 𝑢𝜑 𝑑𝑉 = 𝛻 ∙ 𝜗𝛻𝜑 𝑑𝑉
𝜕𝑡 𝑉 𝜕𝑡 𝑉 𝑉
Integrating
𝜕𝜑
𝑑𝑉 + 𝑢𝜑 ∙ 𝑛𝑑𝑆 = 𝜗𝛻𝜑 ∙ 𝑛𝑑𝑆
𝜕𝑡
Gauss theorem 𝑉 𝑆 𝑆
Convective fluxes
𝜕𝜑
𝑉+ 𝑢𝑖 𝜑𝑖 ∙ 𝑛𝑖 𝐴𝑖 = 𝜗𝛻𝜑𝑖 ∙ 𝑛𝑖 𝐴𝑖
𝜕𝑡
using first order upwind 𝑖∈𝑓𝑎𝑐𝑒𝑠 𝑖∈𝑓𝑎𝑐𝑒𝑠
𝑁5 𝑁6 𝐿 𝐿 3 1+ 3
𝑑= + 𝐿 𝑠𝑖𝑛60 = + 𝐿 =𝐿
2 2 2 2
𝑁4 𝑃 𝑁1
𝑁3 𝑁2
𝐿
3
𝐿
𝑑 2
𝑃
𝑑𝑃𝑁1 and 𝑛𝑃𝑁1 are parallel vectors
𝑑𝑃𝑁1
∙ 𝑛𝑃𝑁1 = 1
𝑑𝑃𝑁1
𝑁5 𝑁6
1+ 3 𝑑𝑃𝑁1
𝑁4 𝑃 𝑁1 𝑑=𝐿 ∙ 𝑛𝑃𝑁1 = 1
2 𝑑𝑃𝑁1
𝑁3 𝑁2
𝜗𝐿
= 𝜑𝑁1 + 𝜑𝑁2 + 𝜑𝑁3 + 𝜑𝑁4 + 𝜑𝑁5 + 𝜑𝑁6 − 6𝜑𝑃
𝑑
2𝜗
= 𝜑𝑁1 + 𝜑𝑁2 + 𝜑𝑁3 + 𝜑𝑁4 + 𝜑𝑁5 + 𝜑𝑁6 − 6𝜑𝑃
1+ 3
1 𝐿 31 3𝐿2
𝛻𝜑𝑖 = 𝜑𝑖 𝑛𝑖 𝑙𝑖 𝑉𝑜𝑙 = 𝐿 =
𝑉𝑜𝑙 2 2 4
𝑓 𝑁1 𝑖∈𝑓𝑎𝑐𝑒𝑠
𝑃 3 1 3 1
𝑁3 𝑁2 𝑛1 = (0,1) 𝑛2 = ( ,− ) 𝑛3 = (− ,− )
2 2 2 2
3 1 1
𝑑𝑃𝑓 = 0, × 𝐿 𝑑𝑁1𝑓 = 0, − 𝐿
𝑑𝑃𝑁1 = 𝑑𝑃𝑓 + 𝑑𝑁1𝑓 2 3 2
1 𝐿 31 3𝐿2
𝛻𝜑𝑖 = 𝜑𝑖 𝑛𝑖 𝑙𝑖 𝑉𝑜𝑙 = 𝐿 =
𝑉𝑜𝑙 2 2 4
𝑓 𝑁1 𝑖∈𝑓𝑎𝑐𝑒𝑠
𝑃 3 1 3 1
𝑁3 𝑁2 𝑛1 = (0,1) 𝑛2 = ( ,− ) 𝑛3 = (− ,− )
2 2 2 2
3 1 1
𝑑𝑃𝑓 = 0, × 𝐿 𝑑𝑁1𝑓 = 0, − 𝐿
𝑑𝑃𝑁1 = 𝑑𝑃𝑓 + 𝑑𝑁1𝑓 2 3 2
1 3 1 1 3 1 1 3 1
1 𝜑𝑁1 + 𝜑𝑃 𝜑𝑁2 + 𝜑𝑃 3 1 𝜑𝑁3 + 𝜑𝑃 3 1
𝛻𝜑𝑖 = 3 2 2 0,1 𝐿 + 3 2 2 ,− 𝐿 + 3 2 2 − ,− 𝐿
𝑉𝑜𝑙 1 3 1 1 3 1 2 2 1 3 1 2 2
+ + +
3 2 2 3 2 2 3 2 2
8 1 3 1 1 3 1 3 1 1 3 1 3 1
𝛻𝜑𝑖 = 𝜑𝑁1 + 𝜑𝑃 0,1 + 𝜑𝑁2 + 𝜑𝑃 ( , − ) + 𝜑𝑁3 + 𝜑𝑃 (− ,− )
1+ 3 𝐿 3 2 2 3 2 2 2 2 3 2 2 2 2
𝜕𝜑 8 1 3 1 3 1 3 1 3
= × 𝜑𝑁2 + 𝜑𝑃 − × 𝜑𝑁3 + 𝜑𝑃
𝜕𝑥 𝑃 1+ 3 𝐿 3 2 2 2 3 2 2 2
𝜕𝜑 8 1 3 1 3 𝜕𝜑 2
= × 𝜑𝑁2 − × 𝜑𝑁3 = 𝜑𝑁2 − 𝜑𝑁3
𝜕𝑥 𝑃 1+ 3 𝐿 3 4 3 4 𝜕𝑥 1+ 3 𝐿
𝑃
𝜕𝜑 8 1 3 1 1 3 1 1 3 1
= × 𝜑𝑁1 + 𝜑𝑃 − × 𝜑𝑁2 + 𝜑𝑃 − × 𝜑𝑁3 + 𝜑𝑃
𝜕𝑦 𝑃 1+ 3 𝐿 3 2 2 3 4 4 3 4 4
𝜕𝜑 2 3 𝑁1
= 2𝜑𝑁1 − 𝜑𝑁2 − 𝜑𝑁3
𝜕𝑦 𝑃 3+3 3 𝐿
𝑃
𝑁3 𝑁2
𝑁1
We have the gradient at cell P and can only apply the Linear Upwind
scheme because the grid has zero warp angle and skewness vector. 𝑃
So other alternatives cannot apply the cell centered gradients. 𝑁3 𝑁2
𝑢𝑖 𝜑𝑖 ∙ 𝑛𝑖 𝐴𝑖 = 𝜑𝑖 𝑢𝑖 ∙ 𝑛𝑖 𝐴𝑖 = 𝝋𝑷 + 𝜵𝝋 𝑷 . 𝒅𝑷𝒇 𝑢, 0 ∙ 𝑛2 𝐿 =
𝜕𝜑 𝜕𝜑 3 1 𝐿 3 3 1
= 𝜑𝑃 + , . ,− 𝑢, 0 ∙ ,− 𝐿 =
𝜕𝑥 𝜕𝑦 2 2 2×3 2 2
𝜕𝜑 𝜕𝜑 3 1 𝐿 3 3 3 𝐿 𝜕𝜑 𝐿 3 𝜕𝜑
= 𝜑𝑃 + , . ,− 𝑢𝐿 = 𝑢𝐿(𝜑𝑃 + − )
𝜕𝑥 𝜕𝑦 2 2 2×3 2 2 4 𝜕𝑥 𝑃
12 𝜕𝑦 𝑃
𝑁1
3 𝐿 𝜕𝜑 𝐿 3 𝜕𝜑 𝑃
𝑢𝑖 𝜑𝑖 ∙ 𝑛𝑖 𝐴𝑖 = 𝜑𝑖 𝑢𝑖 ∙ 𝑛𝑖 𝐴𝑖 = 𝑢𝐿(𝜑𝑃 + − )
2 4 𝜕𝑥 𝑃
12 𝜕𝑦 𝑃 𝑁3 𝑁2
𝜕𝜑 2
= 𝜑𝑁2 − 𝜑𝑁3
𝜕𝑥 𝑃 1+ 3 𝐿
3 1 1
𝑢𝐿[𝜑𝑃 + 2𝜑𝑁2 − 2𝜑𝑁3 − 2𝜑𝑁1 − 𝜑𝑁2 − 𝜑𝑁3 ] =
2 1+ 3 6 1+ 3
3 1
𝑢𝐿[𝜑𝑃 + −2𝜑𝑁1 + 13𝜑𝑁2 − 11𝜑𝑁3 ]
2 6 1+ 3
2 – How to correct the gradient and convection scheme due to the effects of the
skewness or eccentricity (grid quality parameter).
3 – Ready to make all exercises related with this part of the course.
Decomposition of the Face Normal into two Contributions for the Diffusion Scheme:
𝚫 = 𝑬𝒇 𝐤 = 𝑻𝒇
𝑺𝒇 . 𝑺𝒇
𝑻𝒇 = 𝑬𝒇 − 𝑺𝒇 𝑬𝒇 = 𝒅
𝒅. 𝑺𝒇
𝜙𝐹 − 𝜙𝐶
𝛻𝜙 𝑓 . 𝐒𝐟 = 𝐸𝑓 + 𝛻𝜙 𝑓 . (𝐒𝐟 − 𝐄𝐟 )
𝑑𝐶𝐹
The Over-relaxed Correction is the most used due to its higher stability.
And the one we used in the course. This slide shows some variants of the same equations.
Decomposition of the Face Normal into two Contributions for the Diffusion Scheme:
𝚫 = 𝑬𝒇 𝐤 = 𝑻𝒇
𝑺𝒇 . 𝑺𝒇
𝑻𝒇 = 𝑬𝒇 − 𝑺𝒇 𝑬𝒇 = 𝒅
𝒅. 𝑺𝒇
𝜙𝐹 − 𝜙𝐶
𝛻𝜙 𝑓 . 𝐒𝐟 = 𝐸𝑓 + 𝛻𝜙 𝑓 . (𝐒𝐟 − 𝐄𝐟 )
𝑑𝐶𝐹
The Over-relaxed Correction is the most used due to its higher stability.
And the one we used in the course. This slide shows some variants of the same equations.
These corrections include the special case of the Linear Upwind Scheme.
𝝋𝒇 = 𝝋𝑷 + 𝜵𝝋 𝑷 . 𝒅𝑷𝒇
𝜑𝑖 𝑢𝑖 ∙ 𝑛𝑖 𝐴𝑖 = 𝜗 𝛻𝜑𝑖 ∙ 𝑛𝑖 𝐴𝑖
𝑖∈𝑓𝑎𝑐𝑒𝑠 𝑖∈𝑓𝑎𝑐𝑒𝑠
3 3 3
𝜑𝑃 − 𝜑𝑁4 − 𝜑𝑁5
2 4 4
𝑁8 = (0,0)
3
𝑃 = −0.5, +
4
3
𝑑𝑃𝑁8 = +0.5, −
4
𝑑/2 2
3 1 3 7
𝑑𝑃𝑁8 = 0.52 + = + =
4 4 16 16
3
𝑑/2 =
4
3 1
𝑛8 = ( ,− )
2 2
𝑙 = 0.5Δ = 0.5
𝜑𝑖 𝑢𝑖 ∙ 𝑛𝑖 𝐴𝑖 = 𝜗 𝛻𝜑𝑖 ∙ 𝑛𝑖 𝐴𝑖
𝑖∈𝑓𝑎𝑐𝑒𝑠 𝑖∈𝑓𝑎𝑐𝑒𝑠
𝜕𝜑
𝜗 𝐴
𝜕𝑛 𝑖 𝑖
𝑖∈𝑓𝑎𝑐𝑒𝑠
the same has before but with some changes 𝜑𝑁1 − 𝜑𝑃 𝜑𝑁1 − 𝜑𝑃
in the diffusive flux across face P-N8 𝜗𝑙 = 𝜗𝑙
Δ𝑛 𝑑
2
𝜑𝑁8 − 𝜑𝑃 𝑆𝑃𝑁8 𝑑𝑃𝑁8 𝑆𝑃𝑁8 𝑑𝑃𝑁8
𝜗 𝛻𝜑 8 . 𝑆8 = 𝜗 𝐸𝑁8 + 𝜗 𝛻𝜑 ∙ 𝑇𝑁8 𝐸𝑁8 = =
𝑑𝑃𝑁8 𝑑𝑃𝑁8 ∙ 𝑆𝑃𝑁8 𝑑𝑃𝑁8 ∙ 𝑛8
3 3 1 3 3 𝑆𝑃𝑁8 = 𝑙 = 0.5
𝑑𝑃𝑁8 ∙ 𝑛8 = +0.5, − ∙ ,− =
4 2 2 8
3
0.5 × 8 +0.5, − 4×3 1 21 7
𝐸𝑁8 = 4 = 2 3,−1 𝐸𝑁8 = + = =
3 3 9 3 81 9 81 27
𝜑𝑁8 − 𝜑𝑃 16
𝜗 𝛻𝜑 8 . 𝑆8 = 𝜗 𝐸𝑁8 + 𝜗 𝛻𝜑 ∙ 𝑇𝑁8 = 𝜗 𝜑𝑁8 − 𝜑𝑃 + 𝜗 𝛻𝜑 ∙ 𝑇𝑁8 =
𝑑𝑃𝑁8 27
4 3 𝜕𝜑 3 𝜕𝜑 1
𝜗 𝛻𝜑 8 . 𝑆8 = 𝜗 𝜑𝑁8 − 𝜑𝑃 +𝜗 × +𝜗 ×
9 𝜕𝑥 36 𝜕𝑦 12
𝜕𝜑 𝜕𝜑 𝜕𝜑
= 0.5 + 0.5 Average of the Cell Centered Gradients
𝜕𝑥 𝜕𝑥 𝑃
𝜕𝑥 𝑁8
𝜑𝑁8 − 𝜑𝑃 𝑑𝑃𝑁8
𝜗 ∙ 𝑆𝑃𝑁8 Example with Minimal Correction and 𝑇𝑁8 = 0
𝑑𝑃𝑁8 𝑑𝑃𝑁8
𝜑𝑁8 − 𝜑𝑃 𝜑𝑁8 − 𝜑𝑃 3 3 1
𝜗 𝑑𝑃𝑁8 ∙ 𝑆𝑃𝑁8 = 𝜗16 0.5, − ∙ ,− × 0.5
7 7 4 2 2
16
𝜑𝑁8 − 𝜑𝑃 3 3 3 3 𝜑𝑁8 − 𝜑𝑃 3 3
𝜗16 × 0.5 + = 𝜗8 × =𝜗 𝜑𝑁8 − 𝜑𝑃
7 4 8 8 7 7
𝜑𝑁8 − 𝜑𝑃 4 × 0.5 2 7
𝜗 0.5 = 𝜗 𝜑𝑁8 − 𝜑𝑃 = 𝜗 𝜑𝑁8 − 𝜑𝑃
7 7 7
16
𝑁𝐶 𝑁𝐹 𝑁𝐹
𝑁𝐶
𝑁𝐹
𝑁𝐶
𝑁𝐶 𝑁𝐹
𝑁𝐶 𝑁𝐶 𝑁𝐹 𝑁𝐹
𝛻𝜑 ∙ 𝑇 = ?
𝑡+∆𝑡
∆𝑉𝑃 𝑇𝑃𝑡+∆𝑡 − 𝑇𝑃𝑡 = 𝑘𝑓𝑡+∆𝑡 𝛻𝑇 𝑓
∙ 𝑛𝑓 ∆𝑡𝐴𝑓 + ∆𝑉𝑃 𝑆𝑃 𝑡+∆𝑡 ∆𝑡
𝑓∈𝑓𝑎𝑐𝑒𝑠 𝑃
Δ𝑡 𝑛+1
𝑇𝑃𝑛+1 = 𝑇𝑃𝑛 + 𝑘𝑓𝑛+1 𝛻𝑇 ∙ 𝑛𝑓 𝐴𝑓 + Δ𝑡𝑆𝑃𝑛+1
∆𝑉𝑃 𝑓
𝑓∈𝑓𝑎𝑐𝑒𝑠 𝑃
𝐿 × 𝐿𝑐𝑜𝑠 30° 𝐿2 3
𝑓1 𝑓2 ∆𝑉𝑃 = =
2 4
𝑓3
Δ𝑡 𝑇 𝑛+1 − 𝑇𝑃𝑛+1
𝑛+1 𝑁1
𝑇 𝑛+1 − 𝑇𝑃𝑛+1
𝑛+1 𝑁2
𝑇 𝑛+1 − 𝑇𝑃𝑛+1
𝑛+1 𝑁3
𝑇𝑃𝑛+1 = 𝑇𝑃𝑛 + 𝑘𝑓1 + 𝑘𝑓2 + 𝑘𝑓3 𝐿 + Δ𝑡𝑆𝑃𝑛+1
∆𝑉𝑃 𝑑𝑃𝑁 𝑑𝑃𝑁 𝑑𝑃𝑁
4Δ𝑡 𝑛+1 𝑛+1 𝑛+1 𝑛+1 𝑛+1 𝑛+1 𝑛+1 𝑛+1 𝑛+1
𝑇𝑃𝑛+1 = 𝑇𝑃𝑛 + 2
𝑘𝑓1 𝑇𝑁1 + 𝑘𝑓2 𝑇𝑁2 + 𝑘𝑓3 𝑇𝑁3 − 𝑘𝑓1 + 𝑘𝑓2 + 𝑘𝑓3 𝑇𝑃𝑛+1 + Δ𝑡𝛼𝑇𝑃𝑛+1
𝐿
2𝛽Δ𝑡 2 2 2 2 2 2 2 2 2 2
𝑇𝑃𝑛+1 = 𝑇𝑃𝑛 + ∗
𝑇𝑁1 + 𝑇𝑃∗ 𝑇𝑁1
𝑛+1 ∗
+ 𝑇𝑁2 + 𝑇𝑃∗ 𝑇𝑁2
𝑛+1 ∗
+ 𝑇𝑁3 + 𝑇𝑃∗ 𝑇𝑁3
𝑛+1 ∗
− 𝑇𝑁1 ∗
+ 𝑇𝑁2 ∗
+ 𝑇𝑁3 + 3𝑇𝑃∗ 𝑇𝑃𝑛+1 + Δ𝑡𝛼𝑇𝑃𝑛+1
𝐿2
Regarding the convection-diffusion equation, apply the finite volume method to obtain the
discrete equations for cell P in a 2D unstructured grid for a steady problem.
Use upwind for convective fluxes and centred differences for diffusive fluxes.
Consider generic Dirichlet boundary values, a convective velocity = (1,1) and 𝜗=1.
𝜕𝜑
+ 𝛻 ∙ 𝑢𝜑 = 𝛻 ∙ 𝜗𝛻𝜑 + 𝑓
𝜕𝑡
∆𝑥 = ∆𝑦 = 1
P
𝑢
𝜕𝜑 𝜕𝜑
+ 𝛻 ∙ 𝑢𝜑 = 𝛻 ∙ 𝜗𝛻𝜑 + 𝑓 𝑑𝑉 + 𝛻 ∙ 𝑢𝜑 𝑑𝑉 = 𝛻 ∙ 𝜗𝛻𝜑 𝑑𝑉 + 𝑓𝑑𝑉
𝜕𝑡 𝜕𝑡
𝑉 𝑉 𝑉 𝑉
Integrating
𝛻 ∙ 𝑢𝜑 𝑑𝑉 = 𝛻 ∙ 𝜗𝛻𝜑 𝑑𝑉 + 𝑓𝑑𝑉
Back to steady 𝑉 𝑉 𝑉
𝑢𝑖 𝜑𝑖 ∙ 𝑛𝑖 𝐴𝑖 = 𝜗𝛻𝜑𝑖 ∙ 𝑛𝑖 𝐴𝑖 + 𝑓𝑉
Fluxes 𝑖∈𝑓𝑎𝑐𝑒𝑠 𝑖∈𝑓𝑎𝑐𝑒𝑠
up to second order
𝑢
𝑢
𝜑𝑃 1 × 1 + 𝜑𝑗 0 × 2 + 𝜑𝑁3 −1 1 = 𝜑𝑃 − 𝜑𝑁3
Check sum - OK
no need to compute
𝑢
𝑢
Remarks:
• We assumed the 𝑢𝑖 values are available at face's centroid.
• If it is also cell centred values we need to interpolate with central differences if dealing
with incompressible (elliptic or parabolic) problems.
• However, in Navier-Stokes computations, it is very common to have these values already
stored at face's centres since some pressure correction methods (SIMPLE like methods
for pressure-velocity coupling) use and correct the velocities stored at faces.
1
𝑓𝑉=𝑓 = 0.5𝑓 This is second order accurate due to centroid definition.
2
The integral of any plane centred on cell is equal to cell's
volume (area) times the function's value at centroid
N2 N1
𝑑𝑃𝑁1
𝑛𝑃𝑁1
i
N3 𝑑𝑃𝑁3
P j
(non-orthogonal corrections) N4
N4
1 1 2 1
𝑓𝑐𝑖 − 𝑃 ∙ 𝑛𝑃𝑁1 ( , 1) − ( , ) ∙ (0,1) 6
𝜂𝑖𝑁1 = = 2 3 3 3
= =
𝑁1 − 𝑃 ∙ 𝑛𝑃𝑁1 1 3 1 2 5 15
( , ) − ( , ) ∙ (0,1)
2 2 3 3 6
6 9
𝜂𝑖𝑃 =1− = A coordinate system
15 15
centred on was used
N5 𝑛𝑃𝑁3 k 𝑑 𝑛𝑃𝑁4
𝑃𝑁4
N4
1 1 1 1 1 2 2 9 6
𝛻𝜑𝑃 = 𝜑𝑃 + 𝜑𝑁3 1 −1,0 + 𝜑𝑃 + 𝜑𝑁4 2 ,− + 𝜑𝑃 + 𝜑𝑁1 1 0,1
𝐴 2 2 2 2 2 2 15 15
1 1 1 1 1 9 6
𝛻𝜑𝑃 = − 𝜑𝑁3 + 𝜑𝑁4 𝑒𝑥 + − 𝜑𝑃 − 𝜑𝑁4 + 𝜑𝑃 + 𝜑 𝑒
𝐴 2 2 2 2 15 15 𝑁1 𝑦
simplifying:
N2 N1
𝑑𝑃𝑁1
1 1 1 1 1 6 𝑛𝑃𝑁1
𝛻𝜑𝑃 = − 𝜑𝑁3 + 𝜑𝑁4 𝑒𝑥 + − 𝜑𝑁4 + 𝜑𝑃 + 𝜑𝑁1 𝑒𝑦 i
𝐴 2 2 2 10 15
N3 𝑑𝑃𝑁3
P j
1 1 1 1 1 6 N5 𝑛𝑃𝑁3 k 𝑑
𝑃𝑁4
𝑛𝑃𝑁4
𝛻𝜑𝑃 = − 𝜑𝑁3 + 𝜑𝑁4 𝑒𝑥 + − 𝜑𝑁4 + 𝜑𝑃 + 𝜑𝑁1 𝑒𝑦
0.5 2 2 2 10 15
N4
1 12
𝛻𝜑𝑃 = −𝜑𝑁3 + 𝜑𝑁4 𝑒𝑥 + −𝜑𝑁4 + 𝜑𝑃 + 𝜑 𝑒
5 15 𝑁1 𝑦
N4
𝐴=1
1 1 9 6
𝛻𝜑𝑁1 = 𝜑𝑁1 + 𝜑𝑁2 1 −1,0 + 𝜑𝑃 + 𝜑𝑁1 1 0, −1 + 𝑓𝑁1𝑟 1 1,0 + 𝑓𝑁1𝑡 1 0,1
2 2 15 15
1 1 9 6
𝛻𝜑𝑁1 = − 𝜑𝑁1 − 𝜑𝑁2 + 𝑓𝑁1𝑟 𝑒𝑥 + − 𝜑𝑃 − 𝜑 + 𝑓𝑁1𝑡 𝑒𝑦
2 2 15 15 𝑁1
N5 𝑛𝑃𝑁3 k 𝑑 𝑛𝑃𝑁4
𝑃𝑁4
N4
1 1 1 9 6 1 1 2 2
𝛻𝜑𝑁3 = 𝜑𝑃 + 𝜑𝑁3 1 1,0 + 𝜑𝑁3 + 𝜑𝑁2 1 0,1 + 𝜑𝑁5 + 𝜑𝑁3 2 − ,−
𝐴 2 2 15 15 2 2 2 2
1 12
𝛻𝜑𝑁3 = 𝜑𝑃 − 𝜑𝑁5 𝑒𝑥 + 𝜑 + 𝜑 − 𝜑𝑁5 𝑒𝑦
5 𝑁3 15 𝑁2
N5 𝑛𝑃𝑁3 k 𝑑 𝑛𝑃𝑁4
𝑃𝑁4
N4
1 1 1 2 2
𝛻𝜑𝑁4 = 𝜑𝑃 + 𝜑𝑁4 2 − , + 𝑓𝑁4𝑟 1 1,0 + 𝑓𝑁4𝑏 1 0, −1
𝐴 2 2 2 2
Convective fluxes N2 N1
𝑑𝑃𝑁1
𝑛𝑃𝑁1
i
𝜑𝑖 𝑢𝑖 ∙ 𝑛𝑃𝑁1 𝑙𝑖 + 𝜑𝑗 𝑢𝑗 ∙ 𝑛𝑃𝑁4 𝑙𝑗 + 𝜑𝑘 𝑢𝑘 ∙ 𝑛𝑃𝑁3 𝑙𝑘
N3 𝑑𝑃𝑁3
P j
𝑛𝑃𝑁3 k 𝑑 𝑛𝑃𝑁4
using 'second order' upwind N5 𝑃𝑁4
N4
Convective fluxes N2 N1
𝑑𝑃𝑁1
𝑛𝑃𝑁1
i
𝜑𝑖 𝑢𝑖 ∙ 𝑛𝑃𝑁1 𝑙𝑖 + 𝜑𝑗 𝑢𝑗 ∙ 𝑛𝑃𝑁4 𝑙𝑗 + 𝜑𝑘 𝑢𝑘 ∙ 𝑛𝑃𝑁3 𝑙𝑘
N3 𝑑𝑃𝑁3
P j
𝑛𝑃𝑁3 k 𝑑 𝑛𝑃𝑁4
using 'second order' upwind N5 𝑃𝑁4
N4
1 1 1 1 12
𝜑𝑃 + − , ∙ −𝜑𝑁3 + 𝜑𝑁4 𝑒𝑥 + −𝜑𝑁4 + 𝜑𝑃 + 𝜑 𝑒 𝑢𝑖 ∙ 𝑛𝑃𝑁1 𝑙𝑖 + 𝝋𝒋 𝟎 𝒍𝒋
2 3 3 5 15 𝑁1 𝑦
1 1 1 1 12
+ 𝜑𝑁3 + ,− + ∙ 𝜑𝑃 − 𝜑𝑁5 𝑒𝑥 + 𝜑𝑁3 + 𝜑 − 𝜑𝑁5 𝑒𝑦 𝑢𝑘 ∙ 𝑛𝑃𝑁3 𝑙𝑘
3 2 3 5 15 𝑁2
1 1 2 1 4 2 2 1 2 1
𝜑𝑃 − 𝜑𝑁3 + 𝜑𝑁4 − 𝜑𝑁4 + 𝜑𝑃 + 𝜑𝑁1 − 𝜑𝑁3 + 𝜑𝑃 − 𝜑𝑁5 − 𝜑𝑁3 − 𝜑𝑁2 + 𝜑𝑁5
6 6 6 15 15 6 6 30 15 6
Convective fluxes N2 N1
𝑑𝑃𝑁1
𝑛𝑃𝑁1
i
N3 𝑑𝑃𝑁3
P j
N5 𝑛𝑃𝑁3 k 𝑑 𝑛𝑃𝑁4
𝑃𝑁4
N4
1 1 1
− ,
2 3 3
1 1 1
,− +
3 2 3
0,1 ∙ (0,1) 1 5 1
𝑆𝑛𝑓 ∙ 𝑆𝑛𝑓 ∆= ∙ , = ,1
∆ 𝑆𝑛𝑓 ∆= ∙𝑑 1 5 6 6 5
0,1 ∙ ( , )
𝑆𝑛𝑓 ∙ 𝑑 6 6
𝑑𝑃𝑁1 1 1
𝑡 = 0,1 − ,1 = − ,0
5 5
∆ is a scaling factor to
account for an integrated flux 26 26
value (multiplied by face length). ∆ = 𝑑𝑃𝑁1 =
𝑡 5 6
Diffusive fluxes N2 N1
𝑑𝑃𝑁1
𝑛𝑃𝑁1
i
Face to be corrected: i
N3 𝑑𝑃𝑁3
P j
N5 𝑛𝑃𝑁3 k 𝑑 𝑛𝑃𝑁4
𝜑𝑁1 − 𝜑𝑃 1 𝑃𝑁4
𝛻𝜑𝑓 ∙ 𝑆𝑓 = ∆ + 𝑡 𝛻𝜑𝑃 + 𝛻𝜑𝑁1
𝑑𝑃𝑁1 2 N4
𝜑𝑁1 − 𝜑𝑃 26 1 1 1 12 1 1 9 6
𝛻𝜑𝑓 = + − ,0 −𝜑𝑁3 + 𝜑𝑁4 𝑒𝑥 + −𝜑𝑁4 + 𝜑𝑃 + 𝜑𝑁1 𝑒𝑦 + − 𝜑𝑁1 − 𝜑𝑁2 + 𝑓𝑁1𝑟 𝑒𝑥 + − 𝜑𝑃 − 𝜑𝑁1 + 𝑓𝑁1𝑡 𝑒𝑦
26 5 5 2 5 15 2 2 15 15
6
6 1 1 1
𝛻𝜑𝑓 = 𝜑𝑁1 − 𝜑𝑃 − −𝜑𝑁3 + 𝜑𝑁4 − 𝜑𝑁1 − 𝜑𝑁2 + 𝑓𝑁1𝑟
5 10 2 2
6 5 1 1 1 1
𝛻𝜑𝑓 = − 𝜑𝑃 + 𝜑𝑁1 + 𝜑𝑁2 + 𝜑𝑁3 − 𝜑𝑁4 − 𝑓𝑁1𝑟
5 4 20 10 10 10
Diffusive fluxes N2 N1
𝑑𝑃𝑁1
𝑛𝑃𝑁1
i
Now we just need to replace the already computed N3 𝑑𝑃𝑁3
P j
diffusive flux at face i by the new flux (with gradient
𝑛𝑃𝑁3 k 𝑑 𝑛𝑃𝑁4
correction) N5 𝑃𝑁4
N4
6 5 1 1 1 1
𝛻𝜑𝑓 = − 𝜑𝑃 + 𝜑𝑁1 + 𝜑𝑁2 + 𝜑𝑁3 − 𝜑𝑁4 − 𝑓𝑁1𝑟
5 4 20 10 10 10
Diffusive fluxes
obtaining:
6 5 1 1 1 1 3 2 3
− 𝜑𝑃 + 𝜑𝑁1 + 𝜑𝑁2 + 𝜑𝑁3 − 𝜑𝑁4 − 𝑓𝑁1𝑟 + 𝜑𝑁4 − 𝜑𝑃 + 𝜑𝑁3 − 𝜑𝑃
5 4 20 10 10 10 2 2
27 + 15 2 5 1 16 15 2 − 1 1
− 𝜑𝑃 + 𝜑𝑁1 + 𝜑𝑁2 + 𝜑𝑁3 + 𝜑𝑁4 − 𝑓𝑁1𝑟
10 4 20 10 10 10
The corrections of the diffusive and convective schemes are assembled using the
deferred correction method.
The corrections in the case of the diffusive term are used to correct the warp angle
grid quality parameter.
The corrections in the case of the convective term are used to correct the skewness (or
eccentricity) grid quality parameter.