Giter Club home page Giter Club logo

cvfem's Introduction

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

cvfem's People

Contributors

lorransutter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.