ibfoamrig.core.FieldData#
- class ibfoamrig.core.FieldData(frame)[source]#
Bases:
objectCell values of one or more fields together with the cell centres.
- Variables:
frame (polars.DataFrame) – One row per cell with columns
cellI,x,y,z, and one column per field component.
- classmethod from_file(path, *, fields=None)[source]#
Loads a table written by a function object.
- Parameters:
- Returns:
The loaded field data.
- Raises:
TypeError – If
fieldsis a single string.FileNotFoundError – If the file does not exist.
FoamParseError – If a requested column is missing from the file.
- Return type:
- classmethod from_fields(centres, fields, volumes=None)[source]#
Builds field data from OpenFOAM field files.
Vector and tensor fields are split into one column per component, e.g.
UintoUx, Uy, Uz. Uniform fields are expanded to all cells.- Parameters:
- Returns:
The field data, with cells in mesh order.
- Raises:
ValueError – If
centresis not a nonuniform vector field, a field does not match the number of cells, or two columns get the same name.- Return type:
- project_line(start, end, tol)[source]#
Selects cells whose centres lie within
tolof a line segment.Each cell is projected onto the segment. Two columns are added:
s, the distance of the projection fromstart, anddistance, the distance of the centre from the line. The values are the raw cell values.- Parameters:
- Returns:
The selected cells, sorted by
s.- Raises:
ValueError – If
startandendcoincide ortolis not positive.- Return type: