Skip to content

Control finite volume element method - problem solving

Notifications You must be signed in to change notification settings

LorranSutter/CVFEM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Control Volume Finite Element Method

Project presented as part of the Final Term Paper in Exact Sciences of the Universidade Federal de Juiz de Fora

CVFEM  |   Problem presentation  |   Dependencies  |   How to run  |   Technologies  |   References  

✏️ What is CVFEM?

Control Volume Finite Element Method is a combination of two well known numerical methods: Finite Element Method (FEM) and Finite Volume Method (FVM). These methods aims to represent and evaluate partial differential equations (PDE) in the form of algebric equations.

The problems that these methods solve are usually two or three dimensional physical problems, such as heat transfer, fluid dynamics and magnetic flux, which are represented by complex and difficult to solve PDE. Therefore, numerical methods are generally used to discretize the domain in numerous elements and solving the equations for each of them.

CVFEM uses unstructured meshes, starting with a conservation equation in integral form. The solution domain is divided in an finite number of control volumes (CV) and the conservation equation is applied to each CV.

📌 Problem presentation

In this problem, CVFEM was used to obtain the discrete form of the conservation equation for a scalar quantity. Each integral represents, respectively, conservation of linear momentum, source, diffusion and advection:

$$\frac{d}{dt}\int_{V}\phi dV \ - \ \int_{V}Q dV \ - \ \int_{A}\kappa\nabla\phi\cdot\boldsymbol{n}dA \ + \ B\int_{A}(\boldsymbol{v}\cdot \boldsymbol{n})\phi dA \ = \ 0$$

This process is employed in the discretization of this equation generating a linear system of algebric equations. Thus, it is possible to obtain the following equation:

$$a_{i}\phi_{i} \ = \ \sum_{j=1}^{n_i}a_{i,j}\phi_{S_{i,j}} \ + \ b_i$$

Where $a_i$ and $a_{ij}$ are the coefficients of the linear system of equations for the variable $\phi$, and $b_i$ represents all source, transient and boundary terms contributions.

The figure bellow illustrates the relationship of a node $i$ with its adjacent nodes in the support matrix $S_{ij}$ and its CV:

The case studied is a steady state advection-diffusion problem withoud sources. The domain geometry is a quarter of a circular crown, and considering a field of velocities and diffusivity varying radially and not including sources, the problem can be solved analytically for comparison criteria:

Finally, follow the numerical solution compared to analytical solution:

Solution

📝 Dependencies

Besides, of course, Python, you will need NumPy library for numerical operations and Matplotlib library for plotting.

Also, if you want to generate your own mesh you may use the free mesh generator Gmsh.

🏃 How to run

After install dependencies, open your terminal in the folder you want to clone the project:

# Clone this repo
git clone https://github.com/LorranSutter/CVFEM.git

# Go to the project folder
cd CVFEM

The following command read a .msh file generate by Gmsh to be read by the solver code:

python3 readGmsh.py mesh.msh

Then, run the solver code having the output of the previous code as an input:

python3 cvfem.py outputMesh.dat

💻 Technologies

  • Python - interpreted, high-level, general-purpose programming language
  • NumPy - general-purpose array-processing package
  • Matplotlib - plotting library for the Python
  • Gmsh - three-dimensional finite element mesh generator

📖 References

  • Voller, Vaughan R, Basic control volume finite element methods for fluids and solids
  • Versteeg, Henk Kaarle and Malalasekera, Weeratunge, An introduction to computational fluid dynamics: The Finite Volume Method

Releases

No releases published

Packages

No packages published

Languages