FiniteVolumeTransportPhenomena / PyFVTool

Finite volume toolbox in Python
GNU Lesser General Public License v2.1
13 stars 4 forks source link

Extract/visualize CellVariable profiles #10

Closed mhvwerts closed 1 year ago

mhvwerts commented 1 year ago

Utility functions have been added to pyfvtool.cell for obtaining cell coordinates and cell values over the entire domain of a CellVariable, calculating the values at the outer faces using the ghost cells. The code was taken from pyfvtool.visualization.visualizeCells() and these functions now replace that code, avoiding code repetition.

Moreover, these utility functions can now also be used outside of visualizeCells, for exporting/analysing/plotting CellVariable (FVM solutions) data with other code.

The utility functions could later become methods of the CellVariable class. For now, separate methods are provided for 1D, 2D and 3D meshes, and we could later envisage a single 'portal' function that calls the appropriate function depending on the type of mesh of the CellVariable. This has not been done at this stage, in order to keep things simple.

simulkade commented 1 year ago

This is a great addition. The only function I can add to the to-do list is an interpolator that calculates the value of a cell variable for a specified location that is not necessarily at a cell center.

mhvwerts commented 1 year ago

Standard interpolation may be done using functions from scipy.interpolate on basis of the output from the get_CellVariable_profile functions. This could be documented in a future Notebook (and later in the the full PyFVTool documentation...).