PyEFVLib
A library used to solve physical problems governed by partial differential equations, in particular conservation equations using the Element-based Finite Volume Method.
Install / Use
/learn @GustavoExel/PyEFVLibREADME
PyEFVLib
PyEFVLib is a Python library that provides tools to support the solution of systems of partial differential equations (PDEs) using the Element-based Finite Volumes Method (EbFVM)
Summary
- Installation
- Numerical Method
- PyEFVLib Classes - Geometrical Entities
- PyEFVLib Classes - Non-Geometrical Entities
- Tutorial
- 3rd-party Softwares
- 2D vs 3D considerations
- bellbird
1. Installation
Install PyEFVLib using pip, by typing in the command line:
pip install PyEFVLib
2. Numerical Method
2.1 - Partial Differential Equations
- A differential equation is an equation that relates one or more functions and their derivatives.
- A partial differential equation (PDE) is an equation that relates one or more functions dependent on two or more variables, to the partial derivatives of these functions in relation to the independent variables.
- In physics, differential equations relate physical properties (e.g., pressure, temperature, displacement, turbulent kinetic energy, speed) to their spatial and temporal derivatives, and model natural and everyday phenomena.
2.2 - Example: Integrating a PDE in space

Take the heat equation as an example
Integrating in the control volume (CV)
And applying the divergence theorem
2.3 - Domain Discretization

Previously it was shown that a differential equation in the differential form can be integrated in any control volume, but to achieve a detailed solution along the domain of interest, the finite volume method discretizes the domain in several control volumes forming a mesh. The more refined the mesh, the better the solution to the problem will be.
Note: The black bordered triangles shown in the figure are actually the elements, the control volumes are outlined by the blue lines.
2.4 - Field Approximations
As it is the nature of PDEs, the equations involve spatial derivatives, but since we are storing a finite number of variables, we need a way to approximate the field continuously to evaluate the spatial derivatives, and the EbFVM does this using the shape functions.
We'll start by evaluating the field within an element of our mesh. It'll be expressed by a linear combination of the property values at the vertices of the element, and the weight of the property at each vertex is given by the shape functions at each point inside the element, as in the figure below:

And as we know the entire field inside the element, we can evaluate its partial derivatives, as shown below:
2.5 - Problem Solution
Previously, the differential equations expressed the values of the unknowns as a function of their partial derivatives, but as we can express the partial derivatives as a function of the values of the field at the neighboring vertices, so the solution of the problem becomes a system of algebraic equations.
And in the case of a linear system of equations
3. PyEFVLib Classes - Geometrical Entities
3.1 - Grid
| Attribute | Description | | :-------------- | :---------------------------------------------------- | | vertices | a list of the grid's vertices | | elements | a list of the grid's elements | | regions | a list of the grid's regions | | boundaries | a list of the grid's boundaries | | dimension | the dimension of the mesh (2 or 3) | | gridData | a data structure that holds the information provided by mesh file |
3.2 - Vertex
| Attribute | Description | | :------------ | :------------------------------------------------------------- | | x | vertex x coordinate | | y | vertex y coordinate | | z | vertex z coordinate | | handle | the vertex index in the grid | | elements | a list of all elements to which vertex belongs | | volume | the volume of the control volume at which vertex is centered | | coordinates | a numpy array with the vertex coordinates |
| Method | Parameters | Return type | Description | | :---------------------- | :-------------------- | :----------------- | :-------------------------------------------------------------------------------- | | getLocal | element | int | returns the local index of the vertex within the element | | getInnerFaces | | list[InnerFace] | returns the innerFaces next to vertex | | getSubElementVolume | element | float | returns the volume of the section of element that is inside vertex control volume |
Vertex is a child class of the class Point
It is possible to do operations like vertex1 + vertex2, a * vertex, ...
3.3 - Region
Region is a class used to perform simulations where there are multiple regions with different properties, so the properties are specific to each region. If the domain is homogeneous (has constant properties) one single region will be created containing all the elements. The region names are set in the mesh file.

| Attribute | Description | | :---------------- | :------------------------------------- | | name | the name of the region | | handle | the region index in the grid | |
Related Skills
node-connect
336.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
82.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
336.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
82.9kCommit, push, and open a PR
