luminarycloud¶
Submodules¶
Attributes¶
Classes¶
Creates a Luminary API client. |
|
Represents a Geometry object. |
|
Represents a Mesh object. |
|
Represents a Project object. |
|
Reference values needed for computing forces, moments and other |
|
Represents a simulation object. |
|
Simulation configuration that supports multiple physics. |
|
Represents a simulation template object. |
|
Represents a solution for a simulation. |
|
Represents a selection of volumes on which geometry modification operations can be performed. |
Functions¶
|
Create a project owned by the user. |
|
Get the default client object used by wrappers. |
|
Get a specific geometry with the given ID. |
|
Get a specific mesh with the given ID. |
|
Returns the mesh metadata of a specific mesh with the given ID. |
|
Get a specific project by ID. |
|
Retrieve a specific simulation by ID. |
|
Retrieve a specific simulation template by ID. |
|
Iterate over all projects accessible by the user. |
|
List projects accessible by the user. |
|
Set the default client object used by wrappers. |
|
Configures the SDK to make API calls to the Luminary Cloud ITAR Environment, |
|
Configures the SDK to make API calls to the Luminary Cloud Standard Environment, |
Package Contents¶
- class luminarycloud.Client(target: str = LC_DOMAIN, localhost: bool = False, grpc_channel_options: collections.abc.Iterable[tuple[str, str]] | None = None, channel_credentials: grpc.ChannelCredentials | None = None, api_key: str | None = LC_API_KEY, **kwargs: Any)¶
Bases:
luminarycloud._proto.api.v0.luminarycloud.project.project_pb2_grpc.ProjectServiceStub
,luminarycloud._proto.api.v0.luminarycloud.mesh.mesh_pb2_grpc.MeshServiceStub
,luminarycloud._proto.api.v0.luminarycloud.simulation.simulation_pb2_grpc.SimulationServiceStub
,luminarycloud._proto.api.v0.luminarycloud.simulation_template.simulation_template_pb2_grpc.SimulationTemplateServiceStub
,luminarycloud._proto.api.v0.luminarycloud.geometry.geometry_pb2_grpc.GeometryServiceStub
,luminarycloud._proto.api.v0.luminarycloud.solution.solution_pb2_grpc.SolutionServiceStub
,luminarycloud._proto.api.v0.luminarycloud.upload.upload_pb2_grpc.UploadServiceStub
,luminarycloud._proto.api.v0.luminarycloud.vis.vis_pb2_grpc.VisAPIServiceStub
Creates a Luminary API client.
The returned client automatically obtains access tokens for the Luminary API and sends them with each RPC call. See auth/auth.py for details.
Supports “with” syntax to set as the default client for all API calls inside the “with” block. Exiting the block restores the previous default client.
- Parameters:
- targetstr
The URL of the API server.
- localhostbool
True if the API server is running locally.
- grpc_channel_optionsOptional[Iterable[tuple[str, str]]]
A list of gRPC channel args. The full list is available here: https://github.com/grpc/grpc/blob/v1.46.x/include/grpc/impl/codegen/grpc_types.h
- api_keyOptional[str]
The API key to use for authentication.
- **kwargsdict, optional
Additional arguments are passed to Auth0Client. See auth/auth.py.
Examples
Using the “with” syntax to set the default client within a scope:
>>> import luminarycloud as lc >>> with lc.Client(access_token="blahblahblah"): >>> project = lc.list_projects()[0] >>> sims = project.list_simulations()
- get_token() str ¶
- property apiserver_domain: str¶
- property channel: grpc.Channel¶
- property internal: bool¶
- property primary_domain: str | None¶
- class luminarycloud.Geometry(proto_type: google.protobuf.message.Message | None = None)¶
Bases:
luminarycloud._wrapper.ProtoWrapperBase
Represents a Geometry object.
- add_farfield(shape: luminarycloud.params.geometry.Shape) None ¶
Create a farfield feature in the geometry.
- Parameters:
- shapeCube | Cylinder | HalfSphere | Sphere | Torus | Cone
The shape of the farfield.
- check() tuple[bool, list[str]] ¶
Check the geometry for any issues that may prevent meshing.
- Returns:
- okboolean
If true, the geometry is ready for meshing.
If false, the geometry contains errors. Inspect issues and resolve any errors.
- issueslist[str]
A list of issues with the geometry.
When ok=True, issues may be empty or non-empty but contain only warning or informational messages. When ok=False, issues will contain at least one error message and possibly additional warning or informational messages.
- create_tag(name: str, entities: list[luminarycloud.params.geometry.Volume | luminarycloud.params.geometry.Surface]) None ¶
Create a tag in the geometry.
- Parameters:
- namestr
The name of the tag to create.
- entitieslist of Volumes or Surfaces
The Volumes and Surfaces to tag.
- list_entities() tuple[list[luminarycloud.params.geometry.Surface], list[luminarycloud.params.geometry.Volume]] ¶
List all the entities in the geometry.
- Returns:
- surfaceslist[Surface]
A list of all the surfaces in the geometry.
- volumeslist[Volume]
A list of all the volumes in the geometry.
- list_feature_issues() list[luminarycloud._proto.geometry.geometry_pb2.FeatureIssues] ¶
List any issues with features in the geometry.
- Returns:
- feature_issueslist[FeatureIssues]
A list of any issues with features in the geometry. Issues may be informational, warnings or errors.
- list_features() list[luminarycloud._proto.geometry.geometry_pb2.Feature] ¶
List the current features in the geometry.
- Returns:
- featureslist[Feature]
A list of the current features in the geometry.
- list_tags() list[luminarycloud.tag.Tag] ¶
Get the tags currently associated with the geometry.
- Returns:
- list[Tag]
- modify(modification: luminarycloud._proto.geometry.geometry_pb2.Modification) None ¶
Apply a modification to the geometry.
- Parameters:
- modificationModification
The modification to apply to the geometry.
- project() luminarycloud.project.Project ¶
The project the geometry belongs to.
- select_volumes(volumes: list[luminarycloud.params.geometry.Volume | int]) luminarycloud.volume_selection.VolumeSelection ¶
Select the given volumes in the geometry for modification.
- Parameters:
- volumeslist[Volume | int]
The volumes or volume IDs to select. Empty selection is allowed.
- property create_time: datetime.datetime¶
The time the geometry was created.
- id: str¶
Geometry ID.
- name: str¶
Geometry name.
- class luminarycloud.Mesh(proto_type: google.protobuf.message.Message | None = None)¶
Bases:
luminarycloud._wrapper.ProtoWrapperBase
Represents a Mesh object.
- delete() None ¶
Delete the mesh.
- geometry_version() luminarycloud.geometry_version.GeometryVersion ¶
Get the geometry version associated with this mesh.
- refresh() Mesh ¶
Sync the Mesh object with the backend.
- Returns:
- Mesh
Updated mesh consistent with the backend.
- update(*, name: str = '') None ¶
Update mesh attributes.
Mutates self.
- Parameters:
- namestr
New mesh name, maximum length of 256 characters.
- wait(*, interval_seconds: float = 5, timeout_seconds: float = float('inf')) luminarycloud.enum.MeshStatus ¶
Wait until the mesh has either completed or failed processing.
- Parameters:
- interval_secondsfloat, optional
Number of seconds between polls. Default is 5 seconds.
- timeout_secondsfloat, optional
Number of seconds before timeout.
- Returns:
- luminarycloud.enum.MeshStatus
Current status of the mesh.
- property create_time: datetime.datetime¶
- id: luminarycloud.types.MeshID¶
Mesh ID.
- name: str¶
Mesh name.
- status: luminarycloud.enum.MeshStatus¶
Mesh status. May not reflect the current status.
- class luminarycloud.Project(proto_type: google.protobuf.message.Message | None = None)¶
Bases:
luminarycloud._wrapper.ProtoWrapperBase
Represents a Project object.
- create_geometry(cad_file_path: os.PathLike, *, name: str | None = None, scaling: float | None = None, wait: bool = False) luminarycloud.geometry.Geometry ¶
Create a new geometry in the project by uploading a supported CAD file.
For more information on supported formats and best practices, see: https://docs.luminarycloud.com/en/articles/9274255-upload-cad
- Parameters:
- cad_file_pathPathLike or str
Path or URL to the CAD file to upload.
- Returns:
- Geometry
The newly created Geometry.
- Other Parameters:
- namestr, optional
Name of the geometry on Luminary Cloud. A default name will be used if unset.
- scalingfloat, optional
Scaling to apply to the source CAD file upon import. Defaults to 1.0 if unset.
- waitbool, optional
If set to True, this function will block until the geometry import completes. Otherwise, it will return immediately and the import will occur in the background. Defaults to False.
- create_mesh(params: luminarycloud._proto.api.v0.luminarycloud.mesh.mesh_pb2.MeshGenerationParams | luminarycloud.meshing.MeshAdaptationParams | luminarycloud.meshing.MeshGenerationParams, *, name: str) luminarycloud.mesh.Mesh ¶
Create a new mesh in the project.
Deprecated since version 0.10.0: create_mesh() will be removed in v0.11.0, it is replaced by create_or_get_mesh().
- Parameters:
- paramsMeshGenerationParams | MeshAdaptationParams
The parameters to use to create the mesh. If generating a new mesh from an existing geometry, use MeshGenerationParams. If adapting a mesh from an existing, solution use MeshAdaptationParams.
- namestr
(Optional) Mesh name. Max 256 characters.
- create_or_get_mesh(params: luminarycloud._proto.api.v0.luminarycloud.mesh.mesh_pb2.MeshGenerationParams | luminarycloud.meshing.MeshAdaptationParams | luminarycloud.meshing.MeshGenerationParams, *, name: str) luminarycloud.mesh.Mesh ¶
Create a new mesh in the project, or return an existing mesh with the same parameters if it already exists.
- Parameters:
- paramsMeshGenerationParams | MeshAdaptationParams
The parameters to use to create the mesh. If generating a new mesh from an existing geometry, use MeshGenerationParams. If adapting a mesh from an existing, solution use MeshAdaptationParams.
- namestr
(Optional) Mesh name. Max 256 characters. Will be ignored if a mesh with the same parameters already exists.
- create_simulation(mesh_id: luminarycloud.types.MeshID, name: str, simulation_template_id: str, *, description: str = '', batch_processing: bool = True, gpu_type: luminarycloud.enum.GPUType | None = None, gpu_count: int | None = None) luminarycloud.simulation.Simulation ¶
Create a new simulation.
- Parameters:
- mesh_idstr
Mesh ID.
- namestr
Simulation name. If empty, a default name will be generated.
- simulation_template_idstr
ID of the SimulationTemplate used to set up the simulation.
- Other Parameters:
- descriptionstr, optional
Simulation description.
- batch_processingbool, default True
If True, batch processing will be used for this simulation. Use Batch Processing on simulations that are not time-sensitive to save up to 65% in credits.
- gpu_typeGPUType, optional
GPU type to use for the simulation.
- gpu_countint, optional
Number of GPUs to use for the simulation. Must be specified to a positive value if gpu_type is specified.
- create_simulation_template(name: str, *, parameters: luminarycloud._proto.client.simulation_pb2.SimulationParam | None = None, params_json_path: os.PathLike | None = None) luminarycloud.simulation_template.SimulationTemplate ¶
Create a new simulation template object.
- Parameters:
- namestr
Human-readable name to identify the template. Does not need to be unique. Max 256 characters.
- Other Parameters:
- parametersSimulationParam, optional
Complete simulation parameters. Ignored if params_json_path is set.
- params_json_pathpath-like, optional
Path to local JSON file containing simulation params.
- create_table(table_type: luminarycloud.enum.TableType, table_file_path: os.PathLike, simulation_template: luminarycloud.simulation_template.SimulationTemplate) luminarycloud.tables.RectilinearTable ¶
Create a new table in the project and make it available in a simulation template.
- Parameters:
- table_typeTableType
The type of table being created, this defines the format expected for the file.
- table_file_pathpath-like
Path to the file (usually a csv or c81 file) with the data used to create the table.
- simulation_templateSimulationTemplate
Simulation template that is updated with the new table.
- Returns:
- RectilinearTable
A reference to the created table, which can be used for tabulated simulation parameters. For example, profile boundary conditions.
- delete() None ¶
Delete the project.
- list_geometries() list[luminarycloud.geometry.Geometry] ¶
List all geometries in project.
- Returns:
- list[Geometry]
A list of all available Geometries in the project.
- list_meshes() list[luminarycloud.mesh.Mesh] ¶
List all meshes in project.
- list_simulation_templates() list[luminarycloud.simulation_template.SimulationTemplate] ¶
List all simulation templates in project.
- list_simulations() list[luminarycloud.simulation.Simulation] ¶
List all simulations in project.
- load_geometry_to_setup(geometry: luminarycloud.geometry.Geometry) None ¶
Load a geometry to the setup phase. NOTE: this operation is irreversible and deletes all the existing meshes and simulations in the project.
- Parameters:
- geometryGeometry
Geometry to load to the setup phase.
- set_surface_deformation(file_path: os.PathLike, simulation_param: luminarycloud.simulation_param.SimulationParam) None ¶
Upload a surface deformation file with global IDs and coordinates of the surface points and update the simulation params to use this deformation.
Warning
This feature is experimental and may change or be removed without notice.
- Parameters:
- file_pathpath-like
Path to the file with deformed coordinates of points.
- simulation_paramSimulationParam
Simulation parameters that are updated with the deformation.
- update(*, name: str = '', description: str = '') None ¶
Update/Edit project attributes.
Mutates self.
- Parameters:
- namestr, optional
New project name.
- descriptionstr, optional
New project description.
- upload_mesh(path: os.PathLike | str, *, name: str | None = None, scaling: float | None = None, mesh_type: luminarycloud.enum.MeshType | None = None, do_not_read_zones_openfoam: bool | None = None) luminarycloud.mesh.Mesh ¶
Upload a mesh to the project.
For more information on supported formats and best practices see: https://docs.luminarycloud.com/en/articles/9275233-upload-a-mesh
- Parameters:
- pathpathlike or str
Path or URL to the mesh file to upload.
- Other Parameters:
- namestr, optional
Name of the mesh resource on Luminary Cloud. Defaults to the filename.
- scalingfloat, optional
If set, apply a scaling factor to the mesh.
- mesh_typeMeshType, optional
The file format of the mesh file. Required for OpenFOAM format.
- do_not_read_zones_openfoambool, default False
If true, disables reading cell zones in the polyMesh/cellZones file for OpenFOAM meshes.
- property create_time: datetime.datetime¶
- description: str¶
- id: luminarycloud.types.ProjectID¶
- name: str¶
- storage_usage_bytes: int¶
- property update_time: datetime.datetime¶
- class luminarycloud.ReferenceValues¶
Reference values needed for computing forces, moments and other non-dimensional output quantities.
- area_ref: float = 1.0¶
Reference area for computing force and moment coefficients. Default: 1.0
- length_ref: float = 1.0¶
Reference length for computing moment coefficients. Default: 1.0
- length_ref_pitch: float = 1.0¶
Reference length for computing pitching moment coefficients. Default: 1.0
- length_ref_roll: float = 1.0¶
Reference length for computing rolling moment coefficients. Default: 1.0
- length_ref_yaw: float = 1.0¶
Reference length for computing yawing moment coefficients. Default: 1.0
- p_ref: float = 101325.0¶
Absolute static reference pressure for computing force and moment coefficients. This value is independent of the simulation reference pressure. Default: 101325.0
- reference_value_type: luminarycloud.enum.ReferenceValuesType¶
Method of specification for the reference values used in force and moment computations. Default: PRESCRIBE_VALUES
- t_ref: float = 288.15¶
Reference temperature for computing force and moment coefficients. Default: 288.15
- use_aero_moment_ref_lengths: bool = False¶
Whether to use separate reference lengths for pitching, rolling and yawing moments. Default: False
- v_ref: float = 1.0¶
Reference velocity magnitude for computing force and moment coefficients. Default: 1.0
- class luminarycloud.Simulation(proto_type: google.protobuf.message.Message | None = None)¶
Bases:
luminarycloud._wrapper.ProtoWrapperBase
Represents a simulation object.
- delete() None ¶
Delete the simulation.
The simulation will be stopped first if running. This operation cannot be reverted and all the simulation data will be deleted as part of this request.
- download_global_residuals(normalization: luminarycloud.enum.ResidualNormalization = ResidualNormalization.RELATIVE) _DownloadedTextFile ¶
Download global residuals in csv format.
- Parameters:
- normalizationResidualNormalization, optional
The type of normalization to use. Default is relative normalization.
- Returns:
- io.StringIO
Stream of text. The filename can be retrieved from the “filename” attribute of the object.
Examples
Create a Pandas dataframe:
>>> from luminarycloud.enum import ResidualType >>> import pandas as pd >>> with simulation.download_global_residuals() as dl: ... residuals_df = pd.read_csv(dl)
Save to disk:
>>> with download_global_residuals() as dl: ... with open(dl.filename, "wb") as fp: ... fp.write(dl.read())
- download_surface_output(quantity_type: luminarycloud.enum.QuantityType, surface_ids: list[str], *, reference_values: luminarycloud.reference_values.ReferenceValues = None, calculation_type: luminarycloud.enum.CalculationType = CalculationType.PER_SURFACE, frame_id: str = '', force_direction: luminarycloud.types.Vector3Like | None = None, moment_center: luminarycloud.types.Vector3Like | None = None, averaging_type: luminarycloud.enum.AveragingType = AveragingType.UNSPECIFIED, vector_component: luminarycloud.enum.Vector3Component = Vector3Component.UNSPECIFIED) _DownloadedTextFile ¶
Downloads surface outputs (e.g. lift, drag, …) in csv format.
- Parameters:
- quantity_typeluminarycloud.enum.QuantityType
Surface quantity type to compute (e.g. lift, drag).
- surface_idslist of str
List of names of the surfaces to compute the quantities for. Should have at least one element.
- Returns:
- io.StringIO
Stream of text. The filename can be retrieved from the “filename” attribute of the object.
- Other Parameters:
- reference_valuesReferenceValues, optional
Reference values used for computing forces, moments and other non-dimensional output quantities. If not provided, default reference values will be used.
- calculation_typeCalculationType, optional
Whether the calculation should be done for all the surfaces together or each surface individually. Default is PER_SURFACE.
- frame_id: str, optional
The ID of the reference frame that this output should be reported in for “force” quantity types.
- force_directionVector3Like, optional
The direction of the query component for “force” quantity types. Required for certain quantity types.
- moment_centerVector3Like, optional
The center of moment for “force” quantity types. Required for certain quantity types. Ignored if not applicable.
- averaging_typeAveragingType, optional
The averaging method used to compute “surface average” quantity types. Ignored if not applicable.
- vector_componentVector3Component, optional
For 3-vector quantity types (e.g. QuantityType.VELOCITY), the component of the vector to extract. Ignored for scalar quantity types.
Examples
Create a Pandas dataframe:
>>> from luminarycloud.enum import QuantityType >>> import pandas as pd >>> with simulation.download_surface_output(QuantityType.LIFT, ["0/bound/airfoil"], frame_id="body_frame_id") as dl: ... outputs_df = pd.read_csv(dl)
Save to disk:
>>> with simulation.download_surface_output(QuantityType.LIFT, ["0/bound/airfoil"]) as dl: ... with open(dl.filename, "w") as fp: ... fp.write(dl.read())
- get_parameters() luminarycloud._proto.client.simulation_pb2.SimulationParam ¶
- list_solutions() list[luminarycloud.solution.Solution] ¶
List all solutions for this simulation in ascending order of iteration.
- refresh() Simulation ¶
Sync the Simulation object with the backend.
- Returns:
- Simulation
Updated simulation consistent with the backend.
- suspend() None ¶
Suspend the simulation.
- update(*, name: str = None) None ¶
Update/Edit simulation attributes.
Mutates self.
- Parameters:
- namestr, optional
New project name.
- wait(*, print_residuals: bool = False, interval_seconds: float = 5, timeout_seconds: float = float('inf')) luminarycloud.enum.SimulationStatus ¶
Wait until the simulation is completed, failed, or suspended.
- Parameters:
- print_residualsbool, optional
If true, residual values for the latest completed iteration will be printed. Frequency is based on interval_seconds.
- intervalfloat, optional
Number of seconds between polls.
- timeoutfloat, optional
Number of seconds before timeout.
- Returns:
- luminarycloud.enum.SimulationStatus
Current status of the simulation.
- property create_time: datetime.datetime¶
- description: str¶
Simulation description.
- id: luminarycloud.types.SimulationID¶
Simulation ID.
- mesh_id: luminarycloud.types.MeshID¶
ID of the simulation mesh.
- name: str¶
Simulation name.
- project_id: luminarycloud.types.ProjectID¶
ID of the project containing this simulation.
- status: luminarycloud.enum.SimulationStatus¶
Simulation status. May not reflect current status.
- property update_time: datetime.datetime¶
- class luminarycloud.SimulationParam¶
Bases:
luminarycloud.params.param_wrappers.simulation_param_.SimulationParam
Simulation configuration that supports multiple physics.
- assign_material(material: luminarycloud.params.param_wrappers.simulation_param.material_entity_.MaterialEntity, volume: luminarycloud.params.geometry.Volume | str) None ¶
Assigns a material entity to a volume ID.
- assign_physics(physics: luminarycloud.params.param_wrappers.simulation_param.physics_.Physics, volume: luminarycloud.params.geometry.Volume | str) None ¶
Assigns a physics entity to a volume ID.
- configure_adjoint_surface_output(quantity_type: luminarycloud.enum.QuantityType, surface_ids: list[str], *, reference_values: luminarycloud.reference_values.ReferenceValues = None, frame_id: str = '', force_direction: luminarycloud.types.Vector3Like | None = None, moment_center: luminarycloud.types.Vector3Like | None = None, averaging_type: luminarycloud.enum.AveragingType = AveragingType.UNSPECIFIED) None ¶
Helper to configure the surface output differentiated by the adjoint solver. See Simulation.download_surface_output() for details on the input parameters.
Warning
This feature is experimental and may change or be removed without notice.
- classmethod from_json(path: os.PathLike) SimulationParam ¶
- classmethod from_proto(proto: luminarycloud._proto.client.simulation_pb2.SimulationParam) SimulationParam ¶
- convergence_criteria: luminarycloud.params.convergence_criteria.ConvergenceCriteria¶
Convergence criteria for the simulation.
- reference_values: luminarycloud.reference_values.ReferenceValues¶
Reference values for outputs and stopping conditions.
- class luminarycloud.SimulationTemplate(proto_type: google.protobuf.message.Message | None = None)¶
Bases:
luminarycloud._wrapper.ProtoWrapperBase
Represents a simulation template object.
Simulation templates can be used to create simulations with the same parameters. However, unlike simulations, the parameters of a simulation template are mutable. They can be used to partially set up the parameters of a simulation and then be persisted to the Luminary Cloud backend.
- delete() None ¶
Delete the simulation template.
- get_simulation_param() luminarycloud.simulation_param.SimulationParam ¶
Returns the simulation parameters associated with this template to allow customization of the parameters.
- list_tables(table_type: luminarycloud.enum.TableType | None = None) list[luminarycloud.tables.RectilinearTable] ¶
Lists the tables available in the simulation template.
- Parameters:
- table_typeTableType
(Optional) Filter the list to only include this type of table.
- Returns:
- list[RectilinearTable]
List of tables.
- update(*, name: str | None = None, parameters: luminarycloud._proto.client.simulation_pb2.SimulationParam | luminarycloud.simulation_param.SimulationParam | os.PathLike | None = None) None ¶
Update simulation template.
- Parameters:
- namestr, optional
New project name.
- parametersSimulationParam or path-like
New complete simulation parameters object or path to local JSON file containing simulation parameters. In the former case, the input argument is modified to reflect changes applied by the backend (server), for example due to presets. Any differences between input and result are printed on screen.
- property create_time: datetime.datetime¶
- id: luminarycloud.types.SimulationTemplateID¶
Simulation template ID.
- name: str¶
Simulation name.
- parameters: luminarycloud._proto.client.simulation_pb2.SimulationParam¶
Simulation description.
- property update_time: datetime.datetime¶
- class luminarycloud.Solution(proto_type: google.protobuf.message.Message | None = None)¶
Bases:
luminarycloud._wrapper.ProtoWrapperBase
Represents a solution for a simulation.
- download_surface_data() tarfile.TarFile ¶
Download the raw surface data as a gzipped tarball containing .vtu files.
- Returns:
- tarfile.Tarfile
Examples
>>> with solution.download_surface_data() as streaming_tar_file: ... path = f"./surface_data_{solution.id}" ... streaming_tar_file.extractall(path) ... print(f"Extracted files to {path}:") ... print("\t" + "\n\t".join(os.listdir(path))) Extracted files to ./surface_data_<solution.id>: surface_0_bound_z_minus.vtu summary.vtm surface_0_bound_airfoil.vtu surface_0_bound_z_plus.vtu surface_0_bound_farfield.vtu
- download_surface_deformation_template(dst: os.PathLike | None = None) None ¶
Download the surface deformation template into the destination file or into a default-named file. The template has 4 numerical columns [[id], [x], [y], [z]] for the IDs and XYZ coordinates of the mesh nodes of the deformation/sensitivity surfaces. Deformation templates are created by a simulation if SimulationParam.adjoint.deformed_coords_id is set to ‘template’. The point coordinates in the template can be modified and used in Project.set_surface_deformation to create simulations with volume mesh morphing.
- download_surface_sensitivity_data(dst: os.PathLike | None = None) None ¶
Download the surface sensitivity data associated with an adjoint solution into the destination file or into a default-named file. The data consists of 4 numerical columns [[id], [df/dx], [df/dy], [df/dz]] for the IDs and sensitivity of the adjoint output with respect to the coordinates of the mesh nodes of the deformation/sensitivity surfaces. The IDs of the sensitivity data are consistent with the node IDs of the surface deformation.
- download_volume_data() tarfile.TarFile ¶
Download volume solution for a completed steady simulation as a gzipped tarball containing .vtu & .vtp files.
The output may be broken up into multiple .vtu files for large simulations.
- Returns:
- tarfile.Tarfile
Examples
>>> with solution.download_volume_data() as streaming_tar_file: ... path = f"./volume_data_{solution.id}" ... streaming_tar_file.extractall(path) ... print(f"Extracted files to {path}:") ... for root, dirs, filenames in os.walk(path): ... print("\t" + "\n\t".join([os.path.join(root, file) for file in filenames])) Extracted files to ./volume_data_<solution.id>: ./volume_data_<solution.id>/volume_data_<solution.id>.vtm ./volume_data_<solution.id>/volume_data_<solution.id>/volume_data_<solution.id>_1_0.vtp ./volume_data_<solution.id>/volume_data_<solution.id>/volume_data_<solution.id>_3_0.vtp ./volume_data_<solution.id>/volume_data_<solution.id>/volume_data_<solution.id>_4_0.vtp ./volume_data_<solution.id>/volume_data_<solution.id>/volume_data_<solution.id>_2_0.vtp ./volume_data_<solution.id>/volume_data_<solution.id>/volume_data_<solution.id>_0_0.vtu
- id: luminarycloud.types.SolutionID¶
Solution ID.
- iteration: str¶
Iteration index of the solution.
- physical_time: float¶
The physical time, in seconds, of the solution iteration (for transient simulations).
- simulation_id: luminarycloud.types.SimulationID¶
Simulation ID of parent
- class luminarycloud.VolumeSelection(geometry: luminarycloud.geometry.Geometry, volumes: list[luminarycloud.params.geometry.Volume | int])¶
Represents a selection of volumes on which geometry modification operations can be performed.
When a modification is applied, the selection is updated as volumes are created and/or deleted. Newly created volumes are added to the selection, while deleted volumes are removed from the selection. This allows for chaining modifications together easily.
Examples
>>> s = geometry.select_volumes([]) >>> s.create_shape( ... lc.params.geometry.Sphere(radius=1.0, center=lc.types.Vector3(0, 0, 0)), ... ) >>> s.translate(lc.types.Vector3(1, 0, 0)) >>> s.tag("sphere")
>>> s = geometry.select_volumes() # select all >>> s.union() >>> a = s.volumes()
>>> s.clear() >>> s.import_cad("/path/to/cube.cgns") >>> s.translate(lc.types.Vector3(1, 0, 1)) >>> b = s.volumes()
>>> s.clear() >>> s.select(a) >>> s.subtract(b)
- chop(tool_volumes: list[luminarycloud.params.geometry.Volume], *, propagate_tags: bool = False, feature_name: str = 'Chop') None ¶
Chop the selected volumes with the tool volumes.
The tool volumes are removed, and the original volumes are replaced with the result of the chop.
- Parameters:
- tool_volumeslist[Volume]
The volumes to chop the selected volumes with.
- propagate_tagsbool
Whether to propagate the tool volume tags to the surfaces created by the chop.
- feature_namestr
The name of the feature.
- circular_pattern(angle: float, axis: luminarycloud.types.Vector3Like, origin: luminarycloud.types.Vector3Like, quantity: int, *, feature_name: str = 'Circular Pattern') None ¶
Repeat the selected volumes evenly along a circular arc.
- Parameters:
- anglefloat
The angle of the circular arc, in degrees. If the angle is 360, the volumes are evenly distributed around a full circle.
- axisVector3Like
The axis of the circular arc.
- originVector3Like
The origin of the circular arc.
- quantityint
The number of times to repeat the selected volumes.
- feature_namestr
The name of the feature.
- clear() None ¶
Clear the selection.
- create_shape(shape: luminarycloud.params.geometry.Shape, *, feature_name: str | None = None) None ¶
Create a simple shape in the geometry.
The resulting volume is added to selected volumes.
- Parameters:
- shapeShape
The shape to create.
- feature_namestr
The name of the feature. Not the name of the created shape.
- delete(*, feature_name: str = 'Delete') None ¶
Delete the selected volumes.
- Parameters:
- feature_namestr
The name of the feature.
- import_cad(cad_file_path: os.PathLike, *, scaling: float = 1.0, force_discrete: bool = False, feature_name: str = 'Import CAD') None ¶
Import a CAD file into the geometry. Add the imported volumes to the selection.
- Parameters:
- cad_file_pathPathLike
The path to the CAD file to import.
- scalingfloat
The scaling factor to apply to the CAD file.
- force_discretebool
Whether to force the CAD file to be imported as a discrete mesh.
- feature_namestr
The name of the feature. This is not a tag name.
- intersection(*, feature_name: str = 'Intersection') None ¶
Create an intersection of the selected volumes.
The original volumes are removed.
- Parameters:
- feature_namestr
The name of the feature.
- linear_pattern(vector: luminarycloud.types.Vector3Like, quantity: int, *, feature_name: str = 'Linear Pattern') None ¶
Repeat the selected volumes evenly along a vector.
- Parameters:
- vectorVector3Like
The vector to repeat the selected volumes along.
- quantityint
The number of times to repeat the selected volumes.
- feature_namestr
The name of the feature.
- rotate(angle: float, axis: luminarycloud.types.Vector3Like, origin: luminarycloud.types.Vector3Like, *, feature_name: str = 'Rotate') None ¶
Rotate the selected volumes.
The selected volumes are modified in-place.
- Parameters:
- anglefloat
The angle to rotate the selected volumes by, in degrees.
- axisVector3Like
The axis to rotate the selected volumes around.
- originVector3Like
The origin to rotate the selected volumes around.
- feature_namestr
The name of the feature.
- scale(factor: float, origin: luminarycloud.types.Vector3Like, *, feature_name: str = 'Scale') None ¶
Isotropically scale the selected volumes.
The selected volumes are modified in-place.
- Parameters:
- factorfloat
The scaling factor.
- originVector3Like
The origin to scale the selected volumes from.
- feature_namestr
The name of the feature.
- select(volumes: Iterable[luminarycloud.params.geometry.Volume]) None ¶
Add volumes to the selection.
- select_all() None ¶
Select all volumes in the geometry.
- shrinkwrap(resolution_min: float | None = None, resolution_max: float | None = None, *, feature_name: str = 'Shrinkwrap') None ¶
Shrinkwrap the selected volumes.
- Parameters:
- resolution_minfloat, optional
The minimum resolution to shrinkwrap the selected volumes to.
- resolution_maxfloat, optional
The maximum resolution to shrinkwrap the selected volumes to.
- feature_namestr
The name of the feature.
- subtract(tool_volumes: list[luminarycloud.params.geometry.Volume], *, propagate_tags: bool = False, feature_name: str = 'Subtract') None ¶
Boolean subtract the tool volumes from the selected volumes.
The selected volumes are modified in-place, and the tool volumes are removed.
- Parameters:
- tool_volumeslist[Volume]
The volumes to subtract from the selected volumes.
- propagate_tagsbool
Whether to propagate the tool volume tags to the surfaces created by the subtraction.
- feature_namestr
The name of the feature.
- tag(name: str) None ¶
Tag the selected volumes.
- transform(transform: luminarycloud.types.Matrix3, translation: luminarycloud.types.Vector3Like, *, feature_name: str = 'Transform') None ¶
Transform the selected volumes.
The selected volumes are modified in-place.
- Parameters:
- transformMatrix3
The linear transformation to apply to the selected volumes.
- translationVector3Like
The translation to apply to the selected volumes.
- feature_namestr
The name of the feature.
- translate(displacement: luminarycloud.types.Vector3Like, *, feature_name: str = 'Translate') None ¶
Translate the selected volumes.
The selected volumes are modified in-place.
- Parameters:
- displacementVector3Like
The displacement to translate the selected volumes by.
- feature_namestr
The name of the feature.
- union(*, feature_name: str = 'Union') None ¶
Merge the selected volumes.
The original volumes are removed.
- Parameters:
- feature_namestr
The name of the feature.
- unselect(volumes: Iterable[luminarycloud.params.geometry.Volume]) None ¶
Remove volumes from the selection.
- volumes() list[luminarycloud.params.geometry.Volume] ¶
Get the volumes that are currently selected.
- luminarycloud.create_project(name: str, description: str = '') Project ¶
Create a project owned by the user.
- Parameters:
- namestr
Project name.
- descriptionstr
Project description.
- luminarycloud.get_default_client() client.Client ¶
Get the default client object used by wrappers.
- luminarycloud.get_geometry(id: str) Geometry ¶
Get a specific geometry with the given ID.
- Parameters:
- idstr
Geometry ID.
- Returns:
- Geometry
The requested Geometry.
- luminarycloud.get_mesh(id: luminarycloud.types.MeshID) Mesh ¶
Get a specific mesh with the given ID.
- Parameters:
- idstr
Mesh ID.
- luminarycloud.get_mesh_metadata(id: luminarycloud.types.MeshID) luminarycloud._proto.api.v0.luminarycloud.mesh.mesh_pb2.MeshMetadata ¶
Returns the mesh metadata of a specific mesh with the given ID.
- Parameters:
- idstr
Mesh ID.
- luminarycloud.get_project(id: luminarycloud.types.ProjectID) Project ¶
Get a specific project by ID.
- Parameters:
- idstr
Project ID.
- luminarycloud.get_simulation(id: luminarycloud.types.SimulationID) Simulation ¶
Retrieve a specific simulation by ID.
- Parameters:
- idstr
Simulation ID.
- luminarycloud.get_simulation_template(id: luminarycloud.types.SimulationTemplateID) SimulationTemplate ¶
Retrieve a specific simulation template by ID.
- Parameters:
- idstr
Simulation template ID.
- luminarycloud.iterate_projects(page_size: int = 50) ProjectIterator ¶
Iterate over all projects accessible by the user.
The projects are fetched lazily in batches using pagination to optimize memory usage and API calls.
- Parameters:
- page_sizeint, optional
Number of projects to fetch per page. Defaults to 50, max is 500.
- Returns:
- ProjectIterator
An iterator that yields Project objects one at a time.
Examples
Fetch all projects and filter them for large ones. (Somewhat contrived example, such filtering should really be done on the server side.)
>>> large_projects = [p for p in iterate_projects() if p.storage_usage_bytes > 100e6] [Project(...), Project(...)]
Lazily fetch projects. (A batch size of 2 is a bad idea in real-world usage, but it helps demonstrate the lazy fetching.)
>>> my_projects = iterate_projects(batch_size=2) # no network request has been made yet >>> next(my_projects) # first page of projects is fetched, first project is returned Project(...) >>> next(my_projects) # second project is returned from memory Project(...) >>> next(my_projects) # second page of projects is fetched, third project is returned Project(...) >>> next(my_projects) # if there areno more projects, this call raises StopIteration
- luminarycloud.list_projects() list[Project] ¶
List projects accessible by the user.
Deprecated since version 0.10.1: list_projects() will be removed in v0.11.0, it is replaced by iterate_projects() because the latter provides a more efficient way to fetch projects.
- luminarycloud.set_default_client(client: client.Client) None ¶
Set the default client object used by wrappers.
This may be useful for setting custom options or mocking the client for testing.
Examples
>>> options = [("grpc.keepalive_time_ms", 800)] >>> client = Client(grpc_channel_options=options) >>> set_default_client(client)
- luminarycloud.use_itar_environment() None ¶
Configures the SDK to make API calls to the Luminary Cloud ITAR Environment, rather than the Standard Environment.
This function only needs to be called once in your script, before making any API calls.
Examples
>>> import luminarycloud as lc >>> lc.use_itar_environment() >>> lc.list_projects() # lists projects in the user's ITAR environment
- luminarycloud.use_standard_environment() None ¶
Configures the SDK to make API calls to the Luminary Cloud Standard Environment, rather than the ITAR Environment.
This function only needs to be called once in your script, before making any API calls.
Examples
>>> import luminarycloud as lc >>> lc.use_standard_environment() >>> lc.list_projects() # lists projects in the user's Standard environment
- luminarycloud.logger¶