casefoam.loadData.posField_to_timeSeries¶
-
casefoam.loadData.posField_to_timeSeries(solutionDir, file, postFunction, caseStructure=None, baseCase='.', **kwargs)[source]¶ Converts multiple posionalFields to timeSeries with a function
Load all postional Fields of a given case, manipulate the data for each time step and save the manipulated results into one pandas.DataFrame for all times.
Parameters: - solutionDir : str
Solution directory in the OpenFOAM case
postProcessingdirectory.- file : str
File name of the solution file.
- postFunction : function
User function to manipulate the solution data
['x', 'y', 'z', 'values', ...]. The function must return output DataFrame should has and has to have the parameters(caseComb, time, currentDataFrame)- caseStructure : list, optional
List of parent, child and grandchild names:
[[parent1, parent2], [child1, child2, child3], [grandchild1, grandchild2]]
- baseCase : str, optional
Root directory of all cases.
- **kwargs
Keyword arguments if needed by
postFunction.
Returns: - outputDf : pandas.DataFrame
pandas.DataFrame with solutions for all times.
Examples
Define a user
postFunction.>>> def userFunction(caseComb, time, currentDataFrame): t = time minimum = currentDataFrame.iloc[:, 1].min() mean = currentDataFrame.iloc[:, 1].mean() maximum = currentDataFrame.iloc[:, 1].max() df = pd.DataFrame(np.array([time, minimum, mean, maximum], ndmin=2), columns=['time', 'min', 'mean', 'max']) df = df.set_index('time') return df