Lakner 2008

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Computers and Chemical Engineering 32 (2008) 2891–2896

Contents lists available at ScienceDirect

Computers and Chemical Engineering


journal homepage: www.elsevier.com/locate/compchemeng

The finite differences method for solving systems on irregular shapes


Mitja Lakner a , Igor Plazl b,∗
a
Civil and Geodetic Faculty, University of Ljubljana, Jamova 2, SI-1000 Ljubljana, Slovenia
b
Department of Chemical Engineering, Faculty of Chemistry and Chemical Technology, University of Ljubljana, Askerceva 5, SI-1000 Ljubljana, Slovenia

a r t i c l e i n f o a b s t r a c t

Article history: A relatively simple and efficient symbolic-numerical procedure based on the finite differences method
Received 8 August 2007 for solving partial differential equations on systems of irregular shapes is presented. The new concept is
Received in revised form 1 February 2008 based on the spline parameterization of the irregular domain. The curvilinear domain of the real system
Accepted 17 February 2008
is transformed to the rectangular domain by spline functions where the finite differences method is used
Available online 23 February 2008
to solve the transformed system of depended variables. The numerical results are then transported back
to the original irregular shape of the system. In order to present the symbolic-numerical technique effec-
Keywords:
tively, the Laplace’s equation of heat transfer with the Dirichlet and the Neumann boundary conditions
Finite differences
Irregular shapes
in different 2D curvilinear domains is considered. The proposed technique is applied for the non-steady-
state heat transfer by conduction as well. Numerical experiments were performed to justify the proposed
method.
© 2008 Elsevier Ltd. All rights reserved.

1. Introduction one of the primary numerical approaches. Thompson, Warsi, and


Mastin (1982), Thompson, Warsi, and Mastin (1995) and Knupp and
An important element of the numerical solution of partial dif- Steinberg (1993) gave a comprehensive review of numerical grid
ferential equations by the finite-difference method (FDM) or the generation methods. Recently, the overall approach to the numer-
finite-element method (FEM) on general regions is a grid which ical solution of a physical problem in boundary-fitted curvilinear
represents the physical domain in a discrete form (Lisejkin, 1999). coordinates is more or less a well-established procedure (Beji &
The FEM is generally considered more suitable for the treatment Nadaoka, 2004). It appears from the literature that conformal map-
of irregular boundaries due to its flexibility in dividing the prob- ping and the solution of elliptic partial differential equations are
lem domain into elements of various sizes and shapes. While the the most widely used principles for the generation of a curvilin-
FEM can be applied to uniform and non-uniform meshes, the FDM ear body-fitted coordinate system (He, Fan, & Cen, 2000; Jie, Jie,
requires a rectangular grid, which is impossible in the physical Mao, & Li, 2004; Koo & Leap, 1998; Lee & Leap, 1994; Tsay & Hsu,
plane of practically all real-life problems. Therefore, it is neces- 1997). The inherent smoothness and boundary slope discontinu-
sary to use a coordinate transformation and map the irregular ities which do not propagate into the field are the advantages of the
region into a regular one in the computational plane (Cebeci, system of elliptic partial deferential equations as a means of coordi-
Shao, Kafyeke, & Laurendeau, 2005). According to the literature, nate system generation (Tsay & Hsu, 1997). Ramanathan and Kumar
three major classes of techniques corresponding to algebraic meth- (1988) compared the BFC method with FEM for solving transient
ods, differential equation methods, also called the body-fitted (or heat conduction problems in complex geometries. They showed
boundary-fitted) coordinate (BFC) methods, and conformal map- that the BFC method is more accurate and economical in terms of
ping methods have mainly been used so far to overcome these both computational time and storage requirement than the FEM.
difficulties. Although algebraic methods have a major advantage However, the generation of the grid by solving three-dimensional
of rapid computation, they are generally less preferred to partial systems of partial differential equations in domains with complex
differential equation (PDE) methods due to the lack of grid smooth- geometry may be the most time-consuming part of the calcula-
ness (Koo & Leap, 1998). PDE methods are based on solving a tions (Lisejkin, 1999). According to the same author, the meshes
system of PDEs, the most widely used of which are elliptic equa- still limit the efficiency of the numerical methods for the solution of
tions. Since the early 1980s the use of BFC in the numerical solution partial differential equations. Recently, the numerical instability in
of physical problems involving arbitrary geometries has become finite-difference approximations of partial differential equations on
a skewed mesh, and its effect on the solution quality was presented
by You, Rajat, Wang, and Moin (2006). The authors performed
∗ Corresponding author. Tel.: +386 1 2419 512; fax: +386 1 2419 530. the truncation error and modified the wave number analysis to
E-mail address: igor.plazl@fkkt.uni-lj-si (I. Plazl). reveal various effects of mesh skewness and non-uniformity. A

0098-1354/$ – see front matter © 2008 Elsevier Ltd. All rights reserved.
doi:10.1016/j.compchemeng.2008.02.005
2892 M. Lakner, I. Plazl / Computers and Chemical Engineering 32 (2008) 2891–2896

comparison of the spine and the elliptic mesh generation methods


in case of dynamics of sessile droplet evaporation was presented
by Widjaja et al. (2007).
The present paper explains the methodology and the symbolic-
numerical solution procedure based on the finite differences
method for solving partial differential equations on systems of
irregular shapes. The new concept is based on the parameteriza-
tion of the curvilinear region of the physical domain by inherent
smooth splines. The mapping of the rectangular domain to the
irregular domain is used to build the corresponding PDE. The pro-
cedure is automated by the developed mathematical code based on
the repeated chain rule. The classical finite differences method was
then applied to solve the system on the rectangular domain. The
transport of numerical results back to the original irregular shape
of the system is automated as well by the developed mathemati-
cal code written in the Mathematica computational tool (Wolfram,
2006). In the present work Laplace’s equation with prescribed and
mixed boundary conditions on different 2D curvilinear domains is
considered and the solutions were numerically verified. The pro-
posed technique is demonstrated for time dependent problems as
well and it can be applied to the higher dimensions settings of the
second-order PDE with appropriate boundary conditions.

2. Theoretical background

2.1. Splines

Let us consider a series of points T1 , T2 , . . ., Tn . Let M is equal


(Bartels, Beatty, & Barsky, 1987):
⎡ ⎤
−1 3 −3 1 Fig. 2. Smooth continuation (order C2 ) of two spline patches.
1⎢ 3 −6 3 0 ⎥
M= ⎣
3 0⎦
(1)
6 −3 0
1 4 1 0 smoothly (Fig. 1). In this manner all but the first and the last control
points in the plane can be approximated by the C2 continuous spline
and curve. The procedure works for vertices of a polygonal line placed
Bt (T1 , T2 , T3 , T4 ) = [t 3 , t 2 , t, 1] · M · T (2) in any Euclidean space Rk .
The two-dimensional cubic spline patch is defined by sixteen
where M is the B-spline basis matrix, T is the B-spline geometry points Ti,j , i, j = 1, 2, 3, 4 in the following way:
vector for the curve segment defined by four successive points, and
[t3 , t2 , t, 1] is defined as the row vector (Foley et al., 1996). B(s, t) = Bs (Bt (v1 ), Bt (v2 ), Bt (v3 ), Bt (v4 )) ∈ R2 (3)
Now we take the first four points T1 , T2 , T3 , T4 of an polygonal
line and assign them cubic polynomial mapping Bt (T1 , T2 , T3 , T4 ), where
so that the T in the upper formula (Eq. (2)) is substituted with the
matrix composed of coordinates points T1 , T2 , T3 , T4 as rows. When vi = (Ti1 , Ti2 , Ti3 , Ti4 ) (4)
parameter t runs from 0 to 1, point Bt (T1 , T2 , T3 , T4 ) circumscribes
When parameters (s, t) run over the unit square, point B(s, t) circum-
a curve which begins near point T2 and ends near point T3 (the red
scribes a curvilinear quadrilateral with vertices near four central
cubic spline curve in Fig. 1). By repeating the procedure on control
points T22 , T32 , T33 , and T23 (a red spline patch in Fig. 2). By exclu-
points T2 , T3 , T4 , and T5 we get two spline curves which join C2
sion of the first four points (T11 , T21 , T31 , and T41 ) and by adding
the new four points at the end (T15 , T25 , T35 , and T45 ), we get in
the described manner the new spline patch (a blue spline patch in
Fig. 2), which is joined with the old one smoothly by order C2 .

2.2. Mapping of the rectangle to the curvilinear shape

Finite difference formulas and finite difference solution schemes


are generally applicable only to rectangular Cartesian coordinates.
If grids are oriented in arbitrary directions of 2D or 3D geometries,
then it is necessary to transform the arbitrary physical domain into
the computational domain of a rectangular Cartesian system so that
finite difference equations can be applied. Such transformations are
possible as long as the entire grid system is structured (Cebeci et
al., 2005; Lisejkin, 1999).
Let us consider a two-plane region, the rectangular P in the (s, t)
Fig. 1. Smooth continuation (order C2 ) of two curve segments. plane, and the curvilinear shape D in the (x, y) plane, which is the
M. Lakner, I. Plazl / Computers and Chemical Engineering 32 (2008) 2891–2896 2893

Fig. 3. Mapping of the rectangular domain to the curvilinear 2D domain.

bijective picture of the rectangular P formed by the mapping: partial differential equation of the second-order (Eq. (6)) yields:

˚ : (s, t) → (u(s, t), v(s, t)) (5) vt3 (−uss gs + us gss ) + u3t (vss gs − vs gss ) − (u2s + vs2 )
(−utt vs + us vtt )gt + u2t (vt (−uss gs + us gss ) + uss vs gt
where the coordinative functions u(s, t) and v(s, t) are a two times + us (−2vst gs + 2vs gst − vss gt )) + vt2
continuously partial differentiable on P (Fig. 2). (vs (2ust gs + uss gt ) − us (2vs gst + vss gt ))
In order to simplify the introduction of the new procedure apply- (10)
+ ut ((u2s + vs2 )vtt gs + vt2 (vss gs − vs gss ) − 2vt
ing the numerical method of finite differences on irregular shapes, 2
(−us ust gs + us gst + vs (vst gs − vs gst )) − 2us ust vs gt
the well-known Laplace’s equation for steady-state heat transfer + 2u2s vst gt − u2s vs gtt − vs3 gtt ) + vt
with the prescribed boundary conditions on the 2D curvilinear (−utt (us 2 + vs 2 )gs − 2ust vs2 gt + u3s gtt + us vs (2vst gt + vs gtt ) = 0
domain is considered (Fig. 3). Accordingly, the partial differential
equation of the second order for all (x, y) ∈ D and boundary condi- The upper equation (Eq. (10)) represents the PDE of the unknown
tions on ∂D is given function g(s, t) on the rectangular P, where the finite differences
can now be applied. The brackets with the coordinates (s, t) were
∂2 f ∂2 f omitted again in the upper equation (Eq. (10)). The standard finite
(x, y) + 2 (x, y) = 0 (6)
∂x 2 ∂y differences technique was applied to find the numerical solution
of g(s, t) on P from the upper second-order PDE (Eq. (10)) with
where f represents the temperature as a dependent variable (unit
appropriate boundary conditions. The derivatives in differential
K), and x, y the independent variables on the domain (x, y) ∈ D (unit
equations are written in terms of discrete quantities of dependent
m), respectively.
and independent variables, resulting in simultaneous algebraic
In the first step we transmit the PDE from D (Eq. (6)) on the
equations with all unknowns prescribed at discrete mesh points
rectangular P for the unknown function g:
for the entire domain on P. When the unknown function g(s, t) on
g(s, t):=f (u(s, t), v(s, t)) (7) P is found, the function f(x, y) on the domain D is evaluated by
f (x, y) = g(˚−1 (x, y)) (11)
Now we have to express the partial derivatives of the function f(x,
y) by applying the repeated chain rule on g(s, t) (Eq. (7)). Admit- In other words, because of the bijective characteristic of ˚, the
tedly, it is rather tedious to try to find the correct expressions by solution of the equations system u(s, t) = x and v(s, t) = y gave us
hand. It is quite understandable that the finite volume methods or only one point (s, t) ∈ P for the given point (x, y) ∈ D and finally
the finite element methods were suggested instead to avoid this
cumbersome procedure (Chung, 2002). However, the remarkable f(x, y) = g(s, t).
progress of the symbolic computational tools has made it possible
2.3. Numerical experiments
to find solutions to many tedious mathematical calculating pro-
cedures with no mistakes and practically at once. The relatively In order to verify the stability and the accuracy of the proposed
simple mathematical code in the Mathematica computational tool finite differences numerical procedure for solving partial differen-
was developed by applying the repeated chain rule on g(s, t). The tial equations on systems of irregular shapes, the numerical results
partial derivatives of the function f(x, t) can now be expressed (Eqs. at different mesh densities of 2D domain were compared with
(8) and (9)): the analytical solution. As an example of 2D domain a horseshoe-
gs vt − gt vs shaped domain D is used as presented in Fig. 4. Let us consider the
fx (u(s, t), v(s, t)) = (8)
vt us − ut vs

u2s · (−gt vtt us + vt · (−gs utt + gtt us ) + gt utt vs ) + ut us · (gs vtt us − gtt us vs − 2gt vs ust + vt · (−2gst us + 2gs ust )
+ 2gt us vst ) + u3t · (−gss vs + gs vss ) + u2t · (gt vs uss + vt · (gss us − gs uss ) + us · (2gst vs − 2gs vst − gt vss ))
fyy (u(s, t), v(s, t)) = (9)
(vt us − ut vs )3

as examples for first derivative fx (u(s, t), v(s, t)) and second deriva-
tive fyy (u(s, t), v(s, t)), respectively. Note that the brackets with the harmonic function:
coordinates (s, t) of the functions g(s, t), v(s, t), and u(s, t) on the
y
T̃ (x, y) = 1 + 100 ex/5 cos (12)
right sides of the upper equations (Eqs. (8) and (9)) were omit- 5
ted for better clarity. Similar expressions were easily found for
which exactly solves Laplace’s equation:
fy (u(s, t), v(s, t)), fxx (u(s, t), v(s, t)) and fxy (u(s, t), v(s, t)).
Applying the expressions for second derivatives ∂2 T̃ ∂2 T̃
(x, y) + (x, y) = 0 (13)
fxx (u(s, t), v(s, t)) and fyy (u(s, t), v(s, t)) (Eq. (9)) to the original ∂x 2 ∂y2
2894 M. Lakner, I. Plazl / Computers and Chemical Engineering 32 (2008) 2891–2896

Table 1
Comparison between exact and numerical approximations of the temperature distribution on domain D at different sizes of linear systems (mesh densities) with the computer
calculations times (ordinary AMD 64 processor, 3500+)

Size of the linear system Calculation time (s) ımax ıave εmax (K) εave (K)

576 0.625 0.0353997 0.0146805 5.32374 1.5186


1216 1.016 0.0233751 0.00783406 3.4858 0.835014
5031 4.375 0.0125788 0.00394487 1.95255 0.421619
20461 17.5 0.00653486 0.00197974 1.05596 0.211915
82521 70.609 0.00333101 0.000991738 0.557049 0.106244

for all (x, y) ∈ R2 . According to the proposed numerical procedure The domain of a selected shape formed by spline patches is pre-
described in the Theoretical background, the 2D steady-state heat sented in Fig. 5.
transfer equation: As example, the numerical results of the steady-state heat
transfer by conduction for selected boundaries conditions on the
∂2 T ∂2 T domains of the irregular shapes are graphically presented in Fig. 6.
(x, y) + (x, y) = 0 (14)
∂x 2 ∂y2 The temperature profiles in the form of contours on the horseshoe-
was solved on domain D together with the boundary condition: shaped domain and on the corresponding rectangular domain are
presented in Fig. 6b and a, respectively, while the 3D graphical sim-
T (x, y) = T̃ (x, y) for (x, y) ∈ ∂D (15) ulation of the same temperature profile on the horseshoe-shaped
curvilinear domain is presented in Fig. 6c.
An exact solution T̃ (Eq. (12)), which represents the temperature The very good agreement is observed between the numeri-
distribution on domain D, is then compared with the numerical cal results of the proposed method, based on finite differences
approximations at given boundary condition (Eq. (15)) calculated (FDM), and FEM. The temperature profiles in the form of isotherms
at different mesh densities. The comparison results are presented for the same arbitrary irregular domain are graphically presented
in Table 1, where the relative deviation ı and the absolute error ε in Fig. 7. The system based on FDM was solved by Mathematica
between the exact and the numerical values are defined as follows: 6.0 with the computational time of few seconds for creating and


T̃ (x, y) − T (x, y)
0.12 s for solving the linear system of size 16,756 (Fig. 7a and b).
ı:=

, ε:=|T̃ (x, y) − T (x, y)|; (x, y) ∈ D (16)

T̃ (x, y)
The computational time for solving the same problem with FEM
(COMSOL 3.3) was 1.16 s (the size of the linear system was 16,815)
Note that that the parameters in harmonic function T̃ (Eq. (12)) (Fig. 7c).
were selected in order to assure significant variations (approxi- The proposed technique works with the Dirichlet and Neumann
mately between 40 and 200 K) of the simulated exact temperature boundary conditions. As example, the graphical presentation of
profile on the chosen domain D. the steady-state heat transfer by conduction for mixed boundary
conditions for an arbitrary irregular domain is presented in Fig. 8.
The Neumann type of the boundary condition at the lower side of
3. Results and discussion
curvilinear domain was used in the form:
Besides the horseshoe-shaped 2D domain (Fig. 4), an arbitrary
∂T h
geometrical shape is chosen to graphically demonstrate the appli- = − (T − T∞ ) (17)

∂n 
cation of the finite differences method for solving systems on
irregular shapes by the proposed symbolic-numerical procedure.

Fig. 4. Horseshoe-shaped domain D formed by spline patches (2 × 13) defined by Fig. 5. Arbitrary geometrical domain D formed by spline patches (1 × 6) defined by
dots. dots.
M. Lakner, I. Plazl / Computers and Chemical Engineering 32 (2008) 2891–2896 2895

Fig. 6. Graphical presentation of the steady-state heat transfer by conduction for selected boundaries conditions: (a) temperature profiles in the form of contours on the
rectangular domain P, (b) temperature profiles in the form of contours on the horseshoe-shaped curvilinear domain D and (c) 3D graphical simulation of the temperature
profile on the horseshoe-shaped curvilinear domain D.

Fig. 7. Graphical presentation of the steady-state heat transfer by conduction for selected boundaries conditions: (a) temperature profiles in the form of contours on the
rectangular domain P, (b) temperature profiles in the form of contours on the arbitrary curvilinear domain D (FDM) and (c) temperature profiles in the form of contours on
the same arbitrary curvilinear domain (FEM).

Fig. 8. Graphical presentation of the steady-state heat transfer by conduction for mixed boundary conditions (hair = 10 W/(m2 K); porcelain = 1.5 W/(m K); T∞ = 10 ◦ C): (a)
temperature profiles in the form of contours on the rectangular domain P, (b) temperature profiles in the form of contours on the arbitrary curvilinear domain D and (c) 3D
graphical simulation of the temperature profile on the curvilinear domain D.
2896 M. Lakner, I. Plazl / Computers and Chemical Engineering 32 (2008) 2891–2896

by inherent smooth splines, mapping of the rectangular domain to


the irregular domain, and transportation of the numerical results
back to the original irregular shape. The described symbolic-
numerical procedures, which were automated by the developed
mathematical code, demonstrated efficient and accurate results at
very short computational times. The new concept, based on the
finite differences method for solving partial differential equations
on systems of irregular shapes, can be easily applied to the 3D
settings of second-order PDE.

Acknowledgments

This work was supported by Grant P2-0191 Chemical Engineer-


ing, provided by the Ministry of Education, Science and Sport of the
Republic of Slovenia.

References

Bartels, R., Beatty, J., & Barsky, B. (1987). An introduction to splines for use in computer
graphics and geometric modeling. Los Altos: Morhan Kaufman.
Beji, S., & Nadaoka, K. (2004). Fully dispersive nonlinear water wave model in curvi-
linear coordinates. Journal of Computational Physics, 198, 645.
Cebeci, T., Shao, J. P., Kafyeke, F., & Laurendeau, E. (2005). Computational fluid dynam-
Fig. 9. Graphical presentation of the time dependent heat transfer by conduction for ics for engineers. New York: Springer.
Chung, T. J. (2002). Computational fluid dynamics. Cambridge University Press.
selected boundaries conditions (˛porcelain = 5.83 × 10−7 ; initial temperature T = 0 ◦ C):
Foley, J. D., van Dam, A., Feinere, S. K., & Hughes, J. F. (1996). Computer graphics:
(a) temperature profiles on the curvilinear domain in the form of contours after
Principles and practice, second edition in C. Addison-Wesley.
0.33 min, (b) 0.83 min, (c) 16.67 min and (d) 33.33 min. He, H., Fan, J., & Cen, K. (2000). A numerical method for orthogonal grid generation
by Laplace system. Journal of Zhejiang University Science, 1, 125.
Jie, Y., Jie, G., Mao, Z., & Li, G. (2004). Seepage analysis based on boundary-fitted
where h and  are the heat transfer coefficient (W/(m2 K)) and the
coordinate transformation method. Computers and Geotechnics, 31, 279.
thermal conductivity (W/(m K)), respectively, and T∞ is the sur- Koo, M. H., & Leap, D. I. (1998). Modeling three-dimensional groundwater flows
rounding temperature. by the body-fitted coordinate (BFC) method: I stationary boundary problems.
Transport in Porous Media, 30, 217.
The application of the proposed method for the non-steady-
Knupp, P., & Steinberg, S. (1993). Fundamentals of grid generation. Boca Raton: CRC
state heat transfer by conduction: Press.
Lee, K. K., & Leap, D. I. (1994). Application of boundary-fitted coordinate transfor-
∂T ∂2 T ∂2 T mations to groundwater flow modeling. Transport in Porous Media, 17, 145.
=˛ + (18)
∂t ∂x 2 ∂y2 Lisejkin, V. D. (1999). Grid generation methods. New York: Springer.
Ramanathan, S., & Kumar, R. (1988). Comparison of boundary-fitted coordinates with
where ˛ denotes the thermal diffusivity (˛ = /cp ), is graphically finite element approach for solution of conduction problems. Numerical Heat
Transfer, 14, 187.
presented in Fig. 9. Thompson, J. F., Warsi, Z. U. A., & Mastin, C. W. (1982). Boundary-fitted coordinate sys-
tems for numerical solution of partial differential equations—A review. Journal
4. Conclusions of Computer Physics, 47, 1.
Thompson, J. F., Warsi, Z. U. A., & Mastin, C. W. (1995). Numerical grid generation:
Foundations and applications. New York: Elsevier.
The numerical solutions based on finite differences method of Tsay, T. K., & Hsu, F. S. (1997). Numerical grid generation of an irregular region.
Laplace’s equation and time dependent problem of heat transfer by International Journal for Numerical Methods in Engineering, 40, 343.
You, D., Rajat, M., Wang, M., & Moin, P. (2006). Analysis of stability and accuracy of
conduction on different 2D curvilinear domains were performed finite-difference schemes on a skewed mesh. Journal of Computational Physics,
and theoretically described. The methodology of the proposed 213, 184.
symbolic-numerical solution procedure for solving the partial dif- Widjaja, E., Liu, N.-C., Li, M., Collins, R. T., Basaran, O. A., & Harris, M. T. (2007).
Dynamics of sessile droplet evaporation: A comparison of the spine and the
ferential equations on the systems of irregular shapes is based on elliptic mesh generation methods. Computers & Chemical Engineering, 31, 219.
the parameterization of the curvilinear region of physical domain Wolfram Research. (2006). Mathematica, version 6.0. Champaign.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy