You are on page 1of 5

Materials Today: Proceedings 62 (2022) 2679–2683

Contents lists available at ScienceDirect

Materials Today: Proceedings


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

The finite volume method in the context of the finite element method
Cheng-Chieh Wu a,⇑, Daniel Völker b, Sven Weisbrich b, Frank Neitzel b
a
Bundesanstalt für Materialforschung und -prüfung (BAM), Unter den Eichen 87, 12205 Berlin, Germany
b
Technische Universität Berlin, Straße des 17. Juni 135, 10623 Berlin, Germany

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

Article history: The finite volume method (FVM), like the finite element method (FEM), is a numerical method for
Received 7 December 2021 determining an approximate solution for partial differential equations. The derivation of the two
Received in revised form 1 March 2022 methods is based on very different considerations, as they have historically evolved from two distinct
Accepted 25 May 2022
engineering disciplines, namely solid mechanics and fluid mechanics. This makes FVM difficult to learn
Available online 2 June 2022
for someone familiar with FEM. In this paper we want to show that a slight modification of the FEM
procedure leads to an alternative derivation of the FVM. Both numerical methods are starting from the
Keywords:
same strong formulation of the problem represented by differential equations, which are only satisfied
Finite Volume Method
Finite Element Method
by their exact solution. For an approximation of the exact solution, the strong formulation must be con-
Variational Calculation verted to a so-called weak form. From here on, the two numerical methods differ. By appropriate choice
Numerical Methods of the trial function and the test function, we can obtain different numerical methods for solving the weak
formulation of the problem. While typically in FEM the basis functions of the trial function and test func-
tion are identical, in FVM they are chosen differently. In this paper, we show which trial and test function
must be chosen to derive the FVM alternatively: The trial function of the FVM is a ‘‘shifted” trial function
of the FEM, where the nodal points are now located in the middle of an integration interval rather than at
the ends. Moreover, the basis functions of the test function are no longer the same as those of the trial
function as in the FEM, but are shown to be a constant equal to 1. This is demonstrated by the example
of a 1D POISSON equation.
Copyright Ó 2020 Elsevier Ltd. All rights reserved.
Selection and peer-review under responsibility of the scientific committee of the 37th Danubia Adria
Symposium on Advances in Experimental Mechanics.

1. Introduction wants to deal with FVM as well. The difficulty is that the derivation
to FVM in the relevant literature [3,7–11] is motivated differently
The best-known discretization methods for solving from FEM [2,12,13] due to its development from fluid mechanics.
engineering problems formulated as partial differential equa- Therefore, an engineer dealing with FVM for the first time has to
tions are finite difference method (FDM) [1], finite element invest a lot of time and effort to learn this method. In this study,
method (FEM) [2] and finite volume method (FVM) [3]. While we attempt to mitigate this high learning curve problem by using
the finite volume method is used in fluid mechanics, the finite a ‘‘modification” of the FEM procedure that converts the FEM into
element method is predominant in solid state mechanics. At FVM. We show here that the derivation of the FVM can be reduced
first glance, FVM and FEM are two highly specialized methods. merely to the selection of a particular trial and test function. At
Nevertheless, both methods can be used to solve problems in first, the differential equations are transformed into a weak formu-
solid mechanics as well as in fluid mechanics, since both are lation as it is common in FEM. By applying a particular trial func-
numerical methods for the approximate solution of partial dif- tion and test function we obtain the same system of linear
ferential equations. equations as when applying a ‘‘classical” FVM. These trial and test
Since experimental mechanics deals not only with solid state functions are distinct from the ones usually chosen in FEM. Thus,
physics but also with fluid mechanics problems, the challenge we can derive the FVM without having to deal with the reasoning
arises for an engineer who is only familiar with FEM and now from fluid mechanics. The explained procedure will be illustrated
on the example of the 1D POISSON equation. To justify this alterna-
⇑ Corresponding author. tive derivation of the FVM, the numerical results obtained by the
E-mail address: cheng-chieh.wu@mailbox.tu-berlin.de (C.-C. Wu). proposed derivation must exactly match those obtained with the

https://doi.org/10.1016/j.matpr.2022.05.460
2214-7853/Copyright Ó 2020 Elsevier Ltd. All rights reserved.
Selection and peer-review under responsibility of the scientific committee of the 37th Danubia Adria Symposium on Advances in Experimental Mechanics.
Cheng-Chieh Wu, D. Völker, S. Weisbrich et al. Materials Today: Proceedings 62 (2022) 2679–2683

conventional FVM. Exact match means that the results from this 5. Application of the theorem of GAUSS converts the first volume
derivation must also have the same approximation errors as from integral to the left of the equal sign in Eq. (6) into a surface inte-
the application of the ordinary FVM. In other words: The numerical gral Eq. (7).
results of both derivations must agree up to the last digit behind
the decimal point. 5. Trial function

2. Differential equation For the approximate solution, a trial function for U is used. From
Eq. (7) it is obvious that U must be at least once differentiable. The
The 1D POISSON equation is trial function is represented by the sum of a finite number of func-
2
tions Ui . Each function Ui approximates the value within a volume
d element i enclosed by the boundaries ni and niþ1 . For this example,
U¼L; ð1Þ
dx2 a first order LAGRANGE polynomial is used for the discrete functions
  Ui . Here, the interpolation is linear between the values ui and
where U ¼ UðxÞ is the function we are looking for and L ¼ LðxÞ is a
given function.
uiþ1 of two adjacent volumes i and i þ 1. Each value ui is located
at the center of each volume element. This center is determined by
niþ1  ni ni þ niþ1
3. Boundary conditions xi ¼ n i þ ¼ : ð9Þ
2 2
For the solution of a differential equation with second deriva- Thus, the interpolation in each volume is determined by three
tive, two boundary conditions must be defined. Fixed values at center values. The trial function is
the boundary are called Dirichlet boundary conditions, which are
X
N X
N
 U¼ Ui ¼ ðui1 X i þ ui Y i þ uiþ1 Z i Þ ; ð10Þ
UðxA Þ ¼ UA ð2Þ
i¼1 i¼1

and   


where X i ¼ X i ðxÞ, Y i ¼ Y i ðxÞ and Z i ¼ Z i ðxÞ are the basis functions.
UðxB Þ ¼ UB ð3Þ Specifically, they read as follows:
( h i
where xB > xA. xxi 2xni niþ1 n þn
xi1 xi
¼ ni1 niþ1
x 2 ni ; i 2 iþ1 ;
Xi ¼ ð11Þ
0 else ;
4. Weak formulation
8 h i
>
>
xxi1
¼ 2xni1 ni n þn
x 2 ni ; i 2 iþ1 ;
Analytical solutions to partial differential equations are gener- >
< xi xi1 n n
iþ1 i1
h i
ally difficult or impossible to find. Therefore, the original problem Yi ¼ x
iþ1
¼
x niþ1 þniþ2 2x n þn
x 2 i 2 iþ1 ; niþ1 ; ð12Þ
>
> xiþ1 xi niþ2 ni
is transformed into a weak formulation by introducing of the so- >
:
 0 else ;
called test function W ¼ WðxÞ, which allows to approximate the
solution. First, the entire derivation is set up as follows and then and
the individual calculation steps are described. The individual calcu- ( h i
xxi 2xni niþ1 ni þniþ1
lation steps are: xiþ1 xi
¼ niþ2 ni
x2 ; niþ1 ;
Zi ¼ 2
ð13Þ
Z 2 Z 0 else :
d U
Wdx ¼ LWdx ð4Þ
B dx2 B According to the weak formulation in Eq. (7), the first derivative
of the trial function is needed and reads as follows:
Z     Z
d dU dU dW N  
W  dx ¼ LWdx ð5Þ dU X N
dUi X dX dY dZ
B dx dx dx dx B ¼ ¼ ui1 i þ ui i þ uiþ1 i ð14Þ
dx dx dx dx dx
Z   Z Z i¼1 i¼1
d dU dU dW
W dx  dx ¼ LWdx ð6Þ with
B dx dx B dx dx B ( h i
n þn
Z Z Z dX i 2
ni1 niþ1
x 2 ni ; i 2 iþ1 ;
dU dU dW ¼ ð15Þ
Wnds  dx ¼ LWdx ð7Þ dx 0 else ;
@B dx B dx dx B
8 h i
The individual steps are commented as follows: > n þn
>
>
2
x 2 ni ; i 2 iþ1 ;
dY i < niþ1 ni1 h i
1. The Poisson equation in Eq. (1) is multiplied by the test function ¼  2 n þn
x 2 i 2 iþ1 ; niþ1 ; ð16Þ
dx >
> niþ2 ni
W and then integrated over the entire balance area B or area of >
:
interest. This yields Eq. (4). 0 else ;
2. Applying the product rule to ddxU W leads to the auxiliary and
equation. ( h i
ni þniþ1
dZ i 2
niþ2 ni
x2 ; niþ1 ;
  2
¼ 2
ð17Þ
d dU d U dU dW dx 0 else :
W ¼ 2 Wþ ð8Þ
dx dx dx dx dx

6. Test function

3. Substituting the above equation into Eq. (4), we get Eq. (5). The choice of the test function also determines the properties of
4. Separation of the summands leads to Eq. (6). a numerical method. Characteristic of the FVM is that the test func-
2680
Cheng-Chieh Wu, D. Völker, S. Weisbrich et al. Materials Today: Proceedings 62 (2022) 2679–2683

tion has a constant effect on each volume element. The test func- N Z 
X 
dX i dY i dZ i
tion is ui1 ui wi þ ui ui wi þ uiþ1 ui wi nds
i¼1 @B dx dx dx
X
N X
N N Z
X
W¼ Wj ¼ wj uj ; ð18Þ ¼ Lwi ui dx : ð27Þ
j¼1 j¼1 i¼1 B

where uj is the basis function The basis function of the test function ui takes the value 1 in Eq.
 (27) and this leads to
1 x 2 ½ni ; niþ1 ;
uj ¼ ð19Þ N Z  
0 else X niþ1
dX i dY i dZ i
ui1 wi þ ui wi þ uiþ1 wi nds
with wj as its coefficient. According to the weak formulation in i¼1 ni dx dx dx
Eq. (7), the first derivative of the test function is needed and reads N Z
X niþ1
¼ Lwi dx : ð28Þ
dW X N
dWj X N
duj i¼1 ni
¼ ¼ wj ð20Þ
dx j¼1
dx j¼1
dx The integral expression on the left side in Eq. (28) is evaluated
at the edges of the control volumes. In addition, the coefficient wi
with can be extracted from the parenthesis on the right side, since wi
duj is constant. This results in
¼0: ð21Þ !
dx X   
N
dX i  dY i  dZ i 
ui1  w þ ui w þ uiþ1  w
This results in
i¼1
dx x¼niþ1 i dx x¼niþ1 i dx x¼niþ1 i
dW
¼0: ð22Þ    !
dx X
N
dX i  dY i  dZ i 
 ui1  wi þ ui  wi þ uiþ1  wi
With this property of the test function, the second term in Eq. i¼1
dx x¼ni dx x¼ni dx x¼ni
(7) disappears.
XN Z niþ1
¼ Ldxwi : ð29Þ
i¼1 ni
7. Consolidation
Some terms in Eq. (29) are set to zero, since these trial functions
Since the specific expression of the trial function in Eq. (10) and in these terms are outside their definition range. This leads to
the test function in Eq. (18) are known, the two functions can now   !
X
N
dY i  dZ i 
be substituted into the weak formulation of the POISSON equation in 0 þ ui w þ uiþ1  w
Eq. (7). This results in a system of linear equations from which the i¼1
dx x¼niþ1 i dx x¼niþ1 i
unknown values ui can be determined if the boundary conditions
  !
X XN Z niþ1
are chosen appropriately. The complete consolidation is set up as N
dX i  dY i 
follows. The weak formulation of the POISSON equation is  ui1  wi þ u i  wi þ 0 ¼ Ldxwi : ð30Þ
dx x¼ni dx x¼ni ni
Z Z Z i¼1 i¼1
dU dU dW
Wnds  dx ¼ LWdx : ð23Þ Rearranging Eq. (30) with respect to wi yields
@B dx B dx dx B ! !
X    
N
dX i  dY i  dY i  dZ i 
Inserting the derivatives of trial function in Eq. (14) as well as ui1 w  u  w þ u w
the test function and its derivative in Eq. (18) and Eq. (22) into i¼1
dx x¼ni i i
dx x¼ni dx x¼niþ1 i iþ1
dx x¼niþ1 i
Eq. (23) results in N Z
X niþ1

Z N  X ¼ Ldxwi :
X dX i dY i dZ i N
  ni
ui1 þ ui þ uiþ1 wj uj nds  0 i¼1

@B i¼1 dx dx dx j¼1 ð31Þ


Z X
N
  By substituting the Eq. (31) with Eqs. (15) to (17), we obtain
¼ L wj uj dx : ð24Þ
B N 
X   
j¼1 2 2 2 2
ui1  ui  þ uiþ1 w
Expanding Eq. (24) leads to i¼1
niþ1  ni1 niþ1  ni1 niþ2  ni niþ2  ni i
N Z
Z N   X niþ1
X
N X dX dY dZ
ui1 i uj wj þ ui i uj wj þ uiþ1 i uj wj nds ¼ Ldxwi :
dx dx dx i¼1 ni
@B i¼1 j¼1
Z X ð32Þ
N
 
¼ Lwj uj dx : ð25Þ The Eq. (32) contains N þ 2 unknown coefficients ui . By equat-
B j¼1
ing coefficients with respect to wi , N equations are obtained. They
Exchanging the integrals and sums in Eq. (25) gives are
 
X N Z 
N X  2 2 2 2
ui1
dX i
uj wj þ ui
dY i
uj wj þ uiþ1
dZ i
uj wj nds ui1  ui  þ uiþ1
dx dx dx niþ1  ni1 niþ1  ni1 niþ2  ni niþ2  ni
@B
i¼1 j¼1 Z niþ1
N Z
X ¼ Ldx : ð33Þ
¼ Lwj uj dx : ð26Þ ni
j¼1 B
Currently, it is impossible to determine the unknown coeffi-
The integration of Eq. (26) yields a value only for the case i ¼ j, cients ui because two linear independent equations are still miss-
since the test function is 0 otherwise. This results in ing, namely the boundary conditions. At the left boundary it holds
2681
Cheng-Chieh Wu, D. Völker, S. Weisbrich et al. Materials Today: Proceedings 62 (2022) 2679–2683

Table 1
The solution of the example problem using finite volume method.

Volume i 1 2 3 4 5
x 0.002 0.006 0.01 0.014 0.018
U 150 218 254 258 230

u1  u0 u1  UA 9. Verification
¼ : ð34Þ
x1  x0 x1  n1
For x0 ¼ n1 , we get Using an example problem presented in [3, p. 121], we imple-
mented the above considerations in Python [5]. The mentioned
u0 ¼ UA : ð35Þ problem in the book is formulated as follows.
The same applies to the right boundary
uNþ1  uN UB  uN d
2
¼ : ð36Þ 0:5 U ¼ 106 ð47Þ
xNþ1  xN n N  xN dx2
For xNþ1 ¼ nNþ1 , we obtain with the following boundary conditions

uNþ1 ¼ UB : ð37Þ
UðxA ¼ 0Þ ¼ 100 and UðxB ¼ 0:02Þ ¼ 200 : ð48Þ
Eq. (33), Eq. (35) as well as Eq. (37) results a system of linear
equations (SLE) of N þ 2 equations with N þ 2 unknown coeffi- The solution to this problem was approximated using five con-
cients ui . The SLE can be written in matrix notation to solve for trol volumes and is shown in Table 1.
the unknown coefficients and reads To show that the proposed alternative derivation of the FVM
is equivalent to the ordinary derivation of the FVM, the two
Ku ¼ f : ð38Þ
results must agree exactly to the last decimal place. If the same
Here K denotes the LHS (left-hand side) matrix, the wanted problem were solved using other numerical methods such as
unknown coefficients ui are stored in the vector u, and the vector FEM or FDM, similar but not exactly the same results would
f is the vector of the right-hand side of the equation system. In this be obtained due to the deviations in the coefficients of the sys-
representation, the unknown vector u can be determined by tem of linear equations. The results of the ordinary FVM have
been taken from the book of Versteeg and Malalasekera’s book
u ¼ K1 f : ð39Þ [3, p. 121] and computed from the solver laplacianFoam from
the professional open-source software for computational fluid
dynamics (CFD) OpenFOAM [6]. The results from the ordinary
8. Implementation
derivation of the FVM are exactly the same as the result from
the proposed alternative derivation shown in the Table 1. A
The linear system of equations derived from the previous sec-
graphical comparison is unnecessary, because otherwise the
tion is implemented and solved in the Python [5] programming
curves would be on top of each other anyway, since it was just
language using the SciPy package [14]. The matrix K is a tridiagonal
explained that all results are exactly the same. As a conclusion,
matrix. Non-zero values occur only on the main diagonal and the
this verification shows that the proposed alternative derivation
two adjacent secondary diagonals. This property can be exploited
of the FVM is equivalent to the classical derived FVM for this
to save memory. The space requirement is reduced by storing only
particular case.
the non-zero values in a vector v and the corresponding row and
column indices in the vectors I and J. Thus, the storage of the sparse
matrix K is done in the so-called coordinate format:
K ¼ cooðI; J; v Þ : ð40Þ 10. Conclusion

The first unknown u0 in vector u is determined from the bound- It has been shown that the alternative derivation of the FVM
ary value as described in Eq. (35) and the following hold as proposed in this paper for the 1D Poisson problem is equivalent
I ¼ ½ 0    ; J ¼ ½ 0    ; v ¼ ½1     and f ¼ ½ UA    T : to the ordinary derived FVM. The essential difference between
FEM and FVM can be reduced to the selection of a suitable trial
ð41Þ and test function for the approximate solution of a weak formu-
For the internal cell values u1 to uN the entries read as lated problem. The characteristic approach of FVM for approximate
solution of differential equations is established in the trial function
I ¼ ½ i i i  ; ð42Þ in Eq. (10) and test function in equation Eq. (18). This has the con-
sequence that in the FVM only the first term on the left side of the
J ¼ ½ i  1 i i þ 1  ; ð43Þ equal sign of the weak formulation in Eq. (7) is used, since the sec-
h  i ond term of the same equation is omitted. Compared to FEM,
v¼  2
niþ1 ni1
 n 2
iþ1 ni1
n 2
iþ2 ni
2
niþ2 ni
 ; ð44Þ which has a different trial and test function, uses rather the second
term of the weak formulation, since the first term disappears using
h Rn iT FEM. Despite these differences in the choice of the trial and test
f ¼    n iþ1 Ldx    : ð45Þ function, the procedures of both numerical methods are identical
i
from the point of view of the variational calculation [4]. With this
The last unknown uNþ1 in the vector u is treated in analogy to understanding, someone familiar with FEM can thereby easily
u0 and it holds understand and learn FVM. In the further research it must be
I ¼ ½   N þ 1 ; J ¼ ½   N þ 1 ; v ¼ ½   T
1  and f ¼ ½   UB  : ð46Þ shown that the trial and test function proposed in this paper also
works on the 3D cases.
2682
Cheng-Chieh Wu, D. Völker, S. Weisbrich et al. Materials Today: Proceedings 62 (2022) 2679–2683

CRediT authorship contribution statement [4] C.-C. Wu, The measurement- and model-based structural analysis for damage
detection, Verlag der Bayerischen Akademie der Wissenschaften, Vol. C, No.
844, München, 2020
Cheng-Chieh Wu: Conceptualization, Methodology, Software, [5] G. Van Rossum, F.L. Drake, Python 3 Reference Manual, CreateSpace, Scotts
Validation, Formal analysis, Investigation, Writing – original draft. Valley, 2009.
[6] OpenCFD Limited and community, OpenFOAM The Open Source CFD Toolbox
Daniel Völker: Investigation, Writing – original draft. Sven
User Guide, OpenCFD Limited, Berkshire, 2019.
Weisbrich: Conceptualization, Methodology, Investigation, Writ- [7] C.A.J. Fletcher, Computational Techniques for Fluid Dynamics 1, second ed.,
ing – review & editing. Frank Neitzel: Supervision. Springer-Verlag, Berlin, 1998.
[8] P.M. Gerhart, A.L. Gerhart, J.I. Hochstein, Munson, Young and Okiishi’s
Fundamentals of Fluid Mechanics, eighth ed., John Wiley & Sons, Hoboken,
Declaration of Competing Interest 2016.
[9] F. Moukalled L. Mangani, M. Darwish, The Finite Volume Method in
Computational Fluid Dynamics, Springer International Publishing
The authors declare that they have no known competing finan- Switzerland, 2016.
cial interests or personal relationships that could have appeared [10] J. Bey, Finite-Volumen- und Mehrgitter-Verfahren für elliptische
Randwertprobleme, Springer Fachmedien, Wiesbaden, 1998.
to influence the work reported in this paper.
[11] K. Ghaib, Einführung in die numerische Strömungsmechanik, Springer
Fachmedien, Wiesbaden, 2019.
[12] A. Logg, K.A. Mardal, G.N. Wells, Automated solution of differential equations
References by the finite element method, FEniCS Project (2011).
[13] K.J. Bathe, Finite Element Procedures, second ed., K.J. Bathe, Watertown, 2016.
[1] W.H. Press, S.A. Teukolsky, W.T. Vetterling, B.P. Flannery, Numerical Recipes: [14] P. Virtanen, R. Gommers, T.E. Oliphant, M. Haberland, T. Reddy, D. Cournapeau,
The Art of Scientific Computing, third ed., Cambridge University Press, New E. Burovski, P. Peterson, W. Weckesser, J. Bright, S.J. van der Walt, M. Brett, J.
York, 2007. Wilson, K.J. Millman, N. Mayorov, A.R.J. Nelson, E. Jones, R. Kern, E. Larson, C.J.
[2] O.C. Zienkiewicz, R.L. Taylor, J. Zhu, The Finite Element Method: Its Basis and Carey, I. Polat, Y. Feng, E.W. Moore, J. VanderPlas, D. Laxalde, J. Perk-told, R.
Fundamentals, seventh ed., Elsevier, Netherland, 2014. Cimrman, I. Henriksen, E.A. Quintero, C.R. Harris, A.M. Archibald, A.H. Ribeiro,
[3] H.K. Versteeg, W. Malalasekera, An Introduction to Computational Fluid F. Pedregosa, P. van Mulbregt, Nat. Methods 17 (2020) 261–272.
Dynamics, second ed., Pearson Education Limited, Harlow, 2007.

2683

You might also like