report.DataItem#

class DataItem#

Bases: Flow360BaseModel

Represents a retrievable data item that can be post-processed.

The DataItem class retrieves data from a specified path within a Case and allows for:
  • Excluding specific boundaries (if applicable).

  • Applying one or more post-processing operations (e.g., mathematical expressions, averaging). Averaging should be applied as the last expression, accessing variables through /averages in path will automatically append an averaging operation to the object’s operations.

  • Introducing additional variables for use in these operations.

Attributes

data: str#

Path to the data item to retrieve from a Case. The path can include nested attributes and dictionary keys (e.g., “results.surface_forces”).

title: str, optional#

A human-readable title for this data item. If omitted, the title defaults to the last component of the data path.

Default:

None

include: list[str], optional#

Boundaries to be included in the retrieved data (e.g., certain surfaces). Only applicable to some data types, such as surface forces or slicing force distributions.

Default:

None

exclude: list[str], optional#

Boundaries to be excluded from the retrieved data (e.g., certain surfaces). Only applicable to some data types, such as surface forces or slicing force distributions.

Default:

None

operations: list[Average | Expression | GetAttribute], optional#

A list of operations to apply to the retrieved data. Supported operations include: Expression and Average.

Default:

None

variables: list[Variable], optional#

Additional user-defined variables that may be referenced in the Expression operations.

Default:

None

Additional Constructors

classmethod from_file(filename)#

Loads a Flow360BaseModel from .json, or .yaml file.

Parameters:

filename (str) – Full path to the .yaml or .json file to load the Flow360BaseModel from.

Returns:

An instance of the component class calling load.

Return type:

Flow360BaseModel

Example

>>> params = Flow360BaseModel.from_file(filename='folder/sim.json') 

Methods

calculate(case, cases)#

Calculates the DataItem values based on specified operations.

Parameters:
  • case (Case) – The target case for which the delta is calculated.

  • cases (List[Case]) – A list of available cases, including the reference case.

Returns:

The computed data array.

Return type:

float

help(methods=False)#

Prints message describing the fields and methods of a Flow360BaseModel.

Parameters:

methods (bool = False) – Whether to also print out information about object’s methods.

Return type:

None

Example

>>> params.help(methods=True) 
to_file(filename, **kwargs)#

Exports Flow360BaseModel instance to .json or .yaml file

Parameters:

filename (str) – Full path to the .json or .yaml or file to save the Flow360BaseModel to.

Return type:

None

Example

>>> params.to_file(filename='folder/flow360.json')