First example

This example doesn’t do much, it just reads and makes a simple plot of OpenFoam field

First read a scalar field

Note

It just reads a scalar field and store it in alpha variable

# import readscalar function from fluidfoam package
from fluidfoam import readscalar

sol = '../output_samples/bin/'
timename = '0'

alpha = readscalar(sol, timename, 'alpha')
Reading file ../output_samples/bin/0/alpha

Now plot this scalar field

In this example, we haven’t read the mesh, and can be structured or unstructured

import matplotlib.pyplot as plt
plt.figure()
plt.plot(alpha)
plot 0 field
[<matplotlib.lines.Line2D object at 0x7f00e2224f50>]

Total running time of the script: (0 minutes 0.137 seconds)

Gallery generated by Sphinx-Gallery