CFD Online Logo CFD Online URL
Home > Forums

Basic finite volume tools

Register Blogs Members List Search Today's Posts Mark Forums Read

Rate this Entry

Basic finite volume tools

Posted July 1, 2013 at 11:29 by sbaffini

At the following link:

there is a basic MATLAB tool to handle unstructured finite volume grids (fluent .msh or .cas files) and to perform basic interpolations, gradient computations, plots etc. No actual FV computation is ever performed or implemented, however, the main structure of the code is clearly there.


The tool is actually a collection of functions, grouped by tasks under several folders plus a main test.m file which contains some useful examples.

The following folders are present (in logical order):

input: it is the folder for the mesh files input. It includes a subfolder "files" with actual example .msh files and a simple single-block structured grid generator (the three routines inside the folder).

grid: it contains the main routine (readmsh.m) for reading .msh grids and .cas fluent case files (both in ascii format) and routine trasformation.m to apply a simple manipulation to the grid nodes.

fvgeom: this folder contains several pre-processing tools which are useful within the code.

fieldfunctions: basic routines to define a scalar or vectorial test field or its derivative.

fvcomp: it contains a gradient and a filtering routine.

kdtree: routines and data structures for a k-search algorithm. Fully taken from MATLAB Exchange without any modification.

rbf: simple routines to perform basic Radial Basis Function Interpolation and derivative computation.

plot: a collection of plotting functions.

vtk: the routine used to export to .vtk, with the resulting file (both in 2D/3D) being readily available for plotting in Paraview. Note that, at the moment, there is no support for general polyhedral cells (i was unable to find a reference) but only for hexa/quad, tetra/tri, wedge, pyramids.

This is more or less a description of the several tools available. In the test.m file there are several examples on the different tools and all the subroutines are, in my opinion, heavily commented so you should be able (after a while) to understand how things work.

As you can see, all the material is at a very rough development stage yet so, it goes without saying, EVERYTHING COMES WITHOUT ANY FORM OF WARRANTY. Besides this, you can use it as you want.


I want to collect here the critical points/routines or parts where a full testing is still needed:

- general: boundary conditions are read from the .msh file but, NOWHERE IN THE TOOL they are considered (e.g., in the gradient computation).

- input\writemsh.m: it actually works and i've been using it for a while now without any problem. Nonetheless, sometimes Fluent launches a warning in reading the meshes written by this file... still, it can work it out without problems.

- fvcomp\fvfilter.m: i never used the routine or even tested it; might also be totally wrong (ok, maybe not that bad...).

- kdtree\...: the whole tool was not developed by me and i know nothing about it.

- vtk\vtkwrite.m: i already said this but i repeat it, there is a lack of support for polyhedral cells. I don't know if polygonal cells (2D) are supported because i didn't have any tool to create them.
Posted in Uncategorized
Views 2363 Comments 0 Edit Tags Email Blog Entry
« Prev     Main     Next »
Total Comments 0



All times are GMT -4. The time now is 04:38.