Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lorransutter/cvfem

Control finite volume element method - problem solving
https://github.com/lorransutter/cvfem

convection-diffusion convex-hull finite-volume-methods matplotlib python steady-state

Last synced: 5 days ago
JSON representation

Control finite volume element method - problem solving

Awesome Lists containing this project

README

        


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  

## :pencil2: 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.

## :pushpin: 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](https://res.cloudinary.com/lorransutter/image/upload/v1589497916/CVFEM_solution.svg)

## :pencil: Dependencies

Besides, of course, [Python](https://www.python.org/), you will need [NumPy](https://numpy.org/) library for numerical operations and [Matplotlib](https://matplotlib.org/) library for plotting.

Also, if you want to generate your own mesh you may use the free mesh generator [Gmsh](https://gmsh.info/).

## :runner: How to run

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

```sh
# 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:

```sh
python3 readGmsh.py mesh.msh
```

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

```sh
python3 cvfem.py outputMesh.dat
```

## :computer: Technologies

- [Python](https://www.python.org/) - interpreted, high-level, general-purpose programming language
- [NumPy](https://numpy.org/) - general-purpose array-processing package
- [Matplotlib](https://matplotlib.org/) - plotting library for the Python
- [Gmsh](https://gmsh.info/) - three-dimensional finite element mesh generator

## :book: 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*