Fluent files#

[1]:
%load_ext autoreload
%autoreload 2
[2]:
from majordome import (
    FluentFvParticlesParser,
    FluentInterpolationParser
)

Parsing particle track files#

Fluent export DPM results in several formats; majordome supports fieldview particle tracks through FluentFvParticlesParser. Loading a file is as simple as:

[3]:
dpm = FluentFvParticlesParser("data/sample.fvp")

You can retrieve the names of columns and number of individual tracks with the following properties:

[4]:
dpm.variable_names, dpm.n_tracks
[4]:
(['x', 'y', 'z', 'residence_time', 'time_step'], 2)

For convenience, tracks can be recovered as data frames through object indexing:

[5]:
dpm[0]
[5]:
x y z residence_time time_step
0 0.128501 0.537214 -0.622358 0.000000 0.000000e+00
1 0.128493 0.537929 -0.619682 0.000107 1.697420e-07
2 0.128493 0.537964 -0.619554 0.000112 2.738057e-07
3 0.128488 0.538534 -0.617419 0.000176 4.008972e-07
4 0.128477 0.539842 -0.612481 0.000299 7.041471e-07

Parsing interpolation files#

Sometimes being able to read and compute new quantites for an interpolation files may be useful, especially in reasearch settings. Class FluentInterpolationParser is able to read the contents of an interpolation file exported in plain text format. Below you find an example of parsing.

[6]:
ip = FluentInterpolationParser("data/sample.ip")
             x0 in range (        11:        16)
             x1 in range (        17:        22)
       pressure in range (        23:        28)
     x-velocity in range (        29:        34)
     y-velocity in range (        35:        40)
    temperature in range (        41:        46)
              k in range (        47:        52)
          omega in range (        53:        58)

Names of variables are provided by property variable_names:

[7]:
ip.variable_names
[7]:
['x0',
 'x1',
 'pressure',
 'x-velocity',
 'y-velocity',
 'temperature',
 'k',
 'omega']

Valid names can be used to retrieve data for a given variable:

[8]:
ip.get_data("x0")
[8]:
array([0.1, 0.1, 0.2, 0.3, 0.4])

The whole data table can be retreived with data property, where each variable correspond to a column:

[9]:
ip.data
[9]:
array([[0.1, 1. , 9. , 9. , 9. , 9. , 9. , 9. ],
       [0.1, 2. , 1. , 1. , 1. , 1. , 1. , 1. ],
       [0.2, 3. , 2. , 2. , 2. , 2. , 2. , 2. ],
       [0.3, 4. , 3. , 3. , 3. , 3. , 3. , 3. ],
       [0.4, 5. , 4. , 4. , 4. , 4. , 4. , 4. ]])