Project#
- class Project[source]#
Bases:
BaseModelProject class containing the interface for creating and running simulations.
Attributes
- metadata: ProjectMeta#
Metadata of the project.
- project_tree: ProjectTree#
Properties
- tags: List[str]#
Returns the tags of the project.
- Returns:
List of the project’s tags.
- Return type:
List[str]
- length_unit: LengthType.Positive#
Returns the length unit of the project.
- Returns:
The length unit.
- Return type:
LengthType.Positive
- geometry: Geometry#
Returns the geometry asset of the project. There is always only one geometry asset per project.
- Raises:
Flow360ValueError – If the geometry asset is not available for the project.
- Returns:
The geometry asset.
- Return type:
- surface_mesh: SurfaceMeshV2#
Returns the last used surface mesh asset of the project.
If the project is initialized from surface mesh, the surface mesh asset is the root asset.
- Raises:
Flow360ValueError – If the surface mesh asset is not available for the project.
- Returns:
The surface mesh asset.
- Return type:
SurfaceMeshV2
- volume_mesh: VolumeMeshV2#
Returns the last used volume mesh asset of the project.
- Raises:
Flow360ValueError – If the volume mesh asset is not available for the project.
- Returns:
The volume mesh asset.
- Return type:
VolumeMeshV2
- case#
Returns the case asset of the project.
- Raises:
Flow360ValueError – If the case asset is not available for the project.
- Returns:
The case asset.
- Return type:
- imported_geometries: List[Geometry]#
Get all imported geometry components in the project.
- Returns:
A list of Geometry objects representing the imported geometry components.
- Return type:
List[Geometry]
- imported_surfaces: List[ImportedSurface]#
Get all imported surface components in the project.
- Returns:
A list of ImportedSurface objects representing the imported surface components.
- Return type:
List[ImportedSurface]
Additional Constructors
- classmethod from_geometry(files, /, name=None, solver_version='release-25.8', length_unit='m', tags=None, run_async=False, folder=None)[source]#
Initializes a project from local geometry files.
- Parameters:
files (Union[str, list[str]] (positional argument only)) – Geometry file paths.
name (str, optional) – Name of the project (default is None).
solver_version (str, optional) – Version of the solver (default is None).
length_unit (LengthUnitType, optional) – Unit of length (default is “m”).
tags (list of str, optional) – Tags to assign to the project (default is None).
run_async (bool, optional) – Whether to create project asynchronously (default is False).
folder (Optional[Folder], optional) – Parent folder for the project. If None, creates in root.
- Returns:
An instance of the project. Or Project ID when run_async is True.
- Return type:
- Raises:
Flow360FileError – If the project cannot be initialized from the file.
Example
>>> my_project = fl.Project.from_geometry( ... "/path/to/my/geometry/my_geometry.csm", ... name="My_Project_name", ... solver_version="release-Major.Minor" ... length_unit="cm" ... tags=["Quarter 1", "Revision 2"] ... )
- classmethod from_surface_mesh(file, /, name=None, solver_version='release-25.8', length_unit='m', tags=None, run_async=False, folder=None)[source]#
Initializes a project from a local surface mesh file.
- Parameters:
file (str (positional argument only)) – Surface mesh file path. For UGRID file the mapbc file needs to be renamed with the same prefix under same folder.
name (str, optional) – Name of the project (default is None).
solver_version (str, optional) – Version of the solver (default is None).
length_unit (LengthUnitType, optional) – Unit of length (default is “m”).
tags (list of str, optional) – Tags to assign to the project (default is None).
run_async (bool, optional) – Whether to create project asynchronously (default is False).
folder (Optional[Folder], optional) – Parent folder for the project. If None, creates in root.
- Returns:
An instance of the project. Or Project ID when run_async is True.
- Return type:
- Raises:
Flow360FileError – If the project cannot be initialized from the file.
Example
>>> my_project = fl.Project.from_surface_mesh( ... "/path/to/my/mesh/my_mesh.ugrid", ... name="My_Project_name", ... solver_version="release-Major.Minor" ... length_unit="inch" ... tags=["Quarter 1", "Revision 2"] ... )
- classmethod from_volume_mesh(file, /, name=None, solver_version=None, length_unit=None, tags=None, run_async=False, folder=None)[source]#
Initializes a project from a local volume mesh file or an existing cloud volume mesh.
- Parameters:
file (Union[str, VolumeMeshV2] (positional argument only)) – Volume mesh file path or a VolumeMeshV2 cloud object. For file path: UGRID files need the mapbc file renamed with the same prefix under the same folder. For VolumeMeshV2: creates a new project by cloning the existing volume mesh. The solver_version and length_unit default to the values from the original volume mesh’s project.
name (str, optional) – Name of the project (default is None for file input, or the original project’s solver version for VolumeMeshV2 input).
solver_version (str, optional) – Version of the solver (default is the current solver version for file input, or the original volume mesh’s solver version for VolumeMeshV2 input).
length_unit (LengthUnitType, optional) – Unit of length (default is “m” for file input, or the original project’s length unit for VolumeMeshV2 input).
tags (list of str, optional) – Tags to assign to the project (default is None for file input, or the original volume mesh’s tags for VolumeMeshV2 input).
run_async (bool) – Whether to create project asynchronously (default is False).
folder (Optional[Folder], optional) – Parent folder for the project. If None, creates in root.
- Returns:
An instance of the project. Or Project ID when run_async is True.
- Return type:
- Raises:
Flow360FileError – If the project cannot be initialized from the file.
Example
>>> my_project = fl.Project.from_volume_mesh( ... "/path/to/my/mesh/my_mesh.cgns", ... name="My_Project_name", ... solver_version="release-Major.Minor" ... length_unit="inch" ... tags=["Quarter 1", "Revision 2"] ... )
>>> volume_mesh = fl.VolumeMeshV2.from_cloud("vm-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") >>> my_project = fl.Project.from_volume_mesh(volume_mesh, name="Cloned_Project")
- classmethod from_file(file, name=None, solver_version='release-25.8', length_unit='m', tags=None, run_async=False)[source]#
[Deprecated function] Initializes a project from a file.
- Parameters:
file (str) – Path to the file.
name (str, optional) – Name of the project (default is None).
solver_version (str, optional) – Version of the solver (default is None).
length_unit (LengthUnitType, optional) – Unit of length (default is “m”).
tags (list of str, optional) – Tags to assign to the project (default is None).
run_async (bool, optional) – Whether to create project asynchronously (default is False).
- Returns:
An instance of the project. Or Project ID when run_async is True.
- Return type:
- Raises:
Flow360ValueError – If the project cannot be initialized from the file.
- classmethod from_cloud(project_id, *, new_run_from=None)[source]#
Loads a project from the cloud.
- Parameters:
project_id (str) – ID of the project.
new_run_from (Optional[Union[Geometry, SurfaceMeshV2, VolumeMeshV2, Case]]) –
The cloud resource that the current run should be based on. The root asset will use entity settings (grouping, transformation etc) from this resource. This results in the same behavior when user clicks New run on webUI. By default this will be the root asset (what user uploaded) of the project.
TODO: We can add ‘last’ as one option to automatically start from the latest created asset within the project.
- Returns:
An instance of the project.
- Return type:
- Raises:
Flow360WebError – If the project cannot be loaded from the cloud.
Flow360ValueError – If the root asset cannot be retrieved for the project.
- classmethod from_example(example_id=None, by_name=None)[source]#
Creates a project from an existing example in the cloud.
- Parameters:
- Returns:
An instance of the project created from the example.
- Return type:
- Raises:
Flow360ValueError – If neither or both example_id and by_name are provided, or if no matching example is found when using by_name.
Flow360WebError – If the example cannot be copied or the project cannot be loaded.
Methods
- classmethod show_remote(search_keyword=None)[source]#
Shows all projects on the cloud.
- Parameters:
search_keyword (str, optional)
- get_surface_mesh(asset_id=None)[source]#
Returns the surface mesh asset of the project.
- Parameters:
asset_id (str, optional) – The ID of the asset from among the generated assets in this project instance. If not provided, the property contains the most recently run asset.
- Raises:
Flow360ValueError – If the surface mesh asset is not available for the project.
- Returns:
The surface mesh asset.
- Return type:
SurfaceMeshV2
- get_volume_mesh(asset_id=None)[source]#
Returns the volume mesh asset of the project.
- Parameters:
asset_id (str, optional) – The ID of the asset from among the generated assets in this project instance. If not provided, the property contains the most recently run asset.
- Raises:
Flow360ValueError – If the volume mesh asset is not available for the project.
- Returns:
The volume mesh asset.
- Return type:
VolumeMeshV2
- get_case(asset_id=None)[source]#
Returns the last used case asset of the project.
- Parameters:
asset_id (str, optional) – The ID of the asset from among the generated assets in this project instance. If not provided, the property contains the most recently run asset.
- Raises:
Flow360ValueError – If the case asset is not available for the project.
- Returns:
The case asset.
- Return type:
- get_surface_mesh_ids()[source]#
Returns the available IDs of surface meshes in the project
- Returns:
An iterable of asset IDs.
- Return type:
Iterable[str]
- get_volume_mesh_ids()[source]#
Returns the available IDs of volume meshes in the project
- Returns:
An iterable of asset IDs.
- Return type:
Iterable[str]
- get_case_ids(tags=None)[source]#
Returns the available IDs of cases in the project, optionally filtered by tags.
- classmethod get_project_ids(tags=None)[source]#
Returns the available IDs of projects, optionally filtered by tags.
- import_geometry(file, /, name, length_unit='m', tags=None, run_async=False)[source]#
Imports a geometry dependency resource from local geometry files into the project.
- Parameters:
file (Union[str, list[str]] (positional argument only)) – Geometry file paths.
name (str) – Name of the geometry dependency resource.
length_unit (LengthUnitType, optional) – Unit of length (default is “m”).
tags (list of str, optional) – Tags to assign to the geometry dependency resource (default is None).
run_async (bool, optional) – Whether to create the geometry dependency resource asynchronously (default is False).
- Returns:
An instance of the geometry resource added to the project.
- Return type:
- Raises:
Flow360FileError – If the geometry dependency resource cannot be initialized from the file.
- import_surface_mesh(file, /, name, length_unit='m', tags=None, run_async=False)[source]#
Imports a surface mesh dependency resource from a local surface mesh file into the project.
- Parameters:
file (str (positional argument only)) – Surface mesh file path.
name (str) – Name of the surface mesh dependency resource.
length_unit (LengthUnitType, optional) – Unit of length (default is “m”).
tags (list of str, optional) – Tags to assign to the surface mesh dependency resource (default is None).
run_async (bool, optional) – Whether to create the surface mesh dependency resource asynchronously (default is False).
- Returns:
An ImportedSurface object with the file name and surface mesh ID.
- Return type:
ImportedSurface
- Raises:
Flow360FileError – If the surface mesh dependency resource cannot be initialized from the file.
- refresh_project_tree()[source]#
Refresh the local project tree by fetching the latest project tree from cloud.
- rename(new_name)[source]#
Rename the current project.
- Parameters:
new_name (str) – The new name for the project.
- print_project_tree(line_width=30, is_horizontal=True)[source]#
Print the project tree to the terminal.
- generate_surface_mesh(params, name='SurfaceMesh', run_async=True, solver_version=None, use_beta_mesher=None, use_geometry_AI=False, raise_on_error=True, tags=None, draft_only=False, **kwargs)[source]#
Runs the surface mesher for the project.
- Parameters:
params (SimulationParams) – Simulation parameters for running the mesher.
name (str, optional) – Name of the surface mesh (default is “SurfaceMesh”).
run_async (bool, optional) – Whether to run the mesher asynchronously (default is True).
solver_version (str, optional) – Optional solver version to use during this run (defaults to the project solver version)
use_beta_mesher (bool, optional) – Whether to use the beta mesher (default is None). Must be True when using Geometry AI.
use_geometry_AI (bool, optional) – Whether to use the Geometry AI (default is False).
raise_on_error (bool, optional) – Option to raise if submission error occurs (default is True)
tags (List[str], optional) – A list of tags to add to the generated surface mesh.
draft_only (bool, optional) – Whether to only create and submit a draft and not generate the surface mesh.
- Raises:
Flow360ValueError – If the root item type is not Geometry.
- Returns:
The surface mesh asset or the draft if draft_only is True.
- Return type:
SurfaceMeshV2 | Draft
- generate_volume_mesh(params, name='VolumeMesh', run_async=True, solver_version=None, use_beta_mesher=None, use_geometry_AI=False, raise_on_error=True, tags=None, draft_only=False, **kwargs)[source]#
Runs the volume mesher for the project.
- Parameters:
params (SimulationParams) – Simulation parameters for running the mesher.
name (str, optional) – Name of the volume mesh (default is “VolumeMesh”).
run_async (bool, optional) – Whether to run the mesher asynchronously (default is True).
solver_version (str, optional) – Optional solver version to use during this run (defaults to the project solver version)
use_beta_mesher (bool, optional) – Whether to use the beta mesher (default is None). Must be True when using Geometry AI.
use_geometry_AI (bool, optional) – Whether to use the Geometry AI (default is False).
raise_on_error (bool, optional) – Option to raise if submission error occurs (default is True)
tags (List[str], optional) – A list of tags to add to the generated volume mesh.
draft_only (bool, optional) – Whether to only create and submit a draft and not generate the volume mesh.
- Raises:
Flow360ValueError – If the root item type is not Geometry.
- Returns:
The volume mesh asset or the draft if draft_only is True.
- Return type:
VolumeMeshV2 | Draft
- run_case(params, name='Case', run_async=True, fork_from=None, interpolate_to_mesh=None, solver_version=None, use_beta_mesher=None, use_geometry_AI=False, raise_on_error=True, tags=None, draft_only=False, billing_method=None, priority=None, **kwargs)[source]#
Runs a case for the project.
- Parameters:
params (SimulationParams) – Simulation parameters for running the case.
name (str, optional) – Name of the case (default is “Case”).
run_async (bool, optional) – Whether to run the case asynchronously (default is True).
fork_from (Case, optional) – Which Case we should fork from (if fork).
interpolate_to_mesh (VolumeMeshV2, optional) – If specified, forked case will interpolate parent case results to this mesh before running solver.
solver_version (str, optional) – Optional solver version to use during this run (defaults to the project solver version)
use_beta_mesher (bool, optional) – Whether to use the beta mesher (default is None). Must be True when using Geometry AI.
use_geometry_AI (bool, optional) – Whether to use the Geometry AI (default is False).
raise_on_error (bool, optional) – Option to raise if submission error occurs (default is True)
tags (List[str], optional) – A list of tags to add to the case.
draft_only (bool, optional) – Whether to only create and submit a draft and not run the case.
billing_method (Optional[Literal["VirtualGPU", "FlexCredit"]]) – Override to default billing method.
priority (Optional[int]) – Queue priority for Virtual GPU jobs, from 1 (lowest) to 10 (highest). Only applicable when
billing_method="VirtualGPU".
- Returns:
The case asset or the draft if draft_only is True.
- Return type:
Case | Draft