carbonfly.control_dict module

Writers and helpers for OpenFOAM system/controlDict.

This module provides utilities to generate and customize controlDict files for OpenFOAM cases, supporting both steady-state and transient simulations.

carbonfly.control_dict.make_default(mode: str = 'transient', application: str | None = None) Dict[str, Any][source]

Return a default controlDict config dict.

Parameters:
  • mode (str) – “transient”/”unsteady” or “steady”.

  • application (str, optional) – Override application entry.

Returns:

controlDict config dict.

Return type:

Dict[str, Any]

carbonfly.control_dict.write_control_dict(case_root: Path, cfg: Dict[str, Any]) Path[source]

Write system/controlDict using a config dict.

Parameters:
  • case_root (Path) – Case root directory.

  • cfg (Dict[str, Any]) – controlDict configuration.

Returns:

Written system/controlDict path.

Return type:

Path

carbonfly.control_dict.write_control_dict_from_json(case_root: Path, cfg_json: str) Path[source]

Parse a JSON string and write system/controlDict.

Parameters:
  • case_root (Path) – Case root directory.

  • cfg_json (str) – JSON string representing a config dict.

Returns:

Written system/controlDict path.

Return type:

Path

Raises:

ValueError – If the parsed JSON is not a JSON object.