libICEpost.src.base.Functions.functionsForOF

@author: F. Ramognino <federico.ramognino@polimi.it> Last update: 12/06/2023

Functions used to handle OpenFOAM files

Functions

readOFscalarList(→ Iterable[float])

Reads an OpenFOAM file storing a scalarList. Automatically detects if the file is binary or not.

writeOFscalarList(→ None)

Write an OpenFOAM file storing a scalarList.

Module Contents

libICEpost.src.base.Functions.functionsForOF.readOFscalarList(fileName: str) Iterable[float][source]

Reads an OpenFOAM file storing a scalarList. Automatically detects if the file is binary or not.

Parameters:

fileName (str) – Name of the OpenFOAM file.

Raises:

IOError – If the file does not exist or if it does not store a scalarList

Returns:

The data stored in the file.

Return type:

Iterable[float]

libICEpost.src.base.Functions.functionsForOF.writeOFscalarList(values: Iterable[float], path: str, *, overwrite: bool = False, binary: bool = False) None[source]

Write an OpenFOAM file storing a scalarList.

Parameters:
  • values (Iterable[float]) – The data to store.

  • path (str) – The location where to file the scalarList.

  • overwrite (bool, optional) – Overwrite if found? Defaults to False.

  • binary (bool, optional) – Write in binary? Defaults to False.

Raises:

IOError – If the file exists and overwrite is False.