luminarycloud¶
Submodules¶
Attributes¶
Classes¶
Represents a Geometry object. |
|
Represents a Mesh object. |
|
Parameters used to create a new mesh with mesh adaptation. |
|
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 3-dimensional vector. |
Functions¶
|
Create a project owned by the user. |
|
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. |
|
List projects accessible by the user. |
|
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.Geometry(proto_type: google.protobuf.message.Message | None = None)¶
Bases:
luminarycloud._wrapper.ProtoWrapperBase
Represents a Geometry object.
- 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.
- 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.
- modify(modification: luminarycloud._proto.geometry.geometry_pb2.Modification) tuple[list[luminarycloud._proto.geometry.geometry_pb2.Volume], list[luminarycloud._proto.geometry.geometry_pb2.Feature], list[luminarycloud._proto.geometry.geometry_pb2.FeatureIssues]] ¶
Apply a modification to the geometry.
- Parameters:
- modificationModification
The modification to apply to the geometry.
- Returns:
- volumeslist[Volume]
A list of the volumes in the geometry, after the requested modification was applied.
- featureslist[Feature]
A list of currently active features in the geometry, after the requested modification was applied.
- feature_issueslist[FeatureIssues]
A list of issues that may affect the feature.
- 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.
- 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.MeshAdaptationParameters(source_simulation_id: str, target_cv_count: int, h_ratio: float)¶
Parameters used to create a new mesh with mesh adaptation.
- Attributes:
- source_simulation_idstr
(Required) The simluation ID of a previously completed simulation. The source simulation will be used to extract the input mesh and mesh adaptation sensor from the solution.
- target_cv_countint
(Required) Target count of mesh CVs.
- h_ratiofloat
(Required) Boundary layer scaling.
- h_ratio: float¶
- source_simulation_id: luminarycloud.types.SimulationID¶
- target_cv_count: int¶
- class luminarycloud.Project¶
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(*, name: str, adaptation_params: luminarycloud.mesh.MeshAdaptationParameters) luminarycloud.mesh.Mesh ¶
Create a new mesh in the project.
- Parameters:
- namestr
(Optional) Mesh name. Max 256 characters.
- adaptation_paramsMeshAdaptationParameters
(Required) Should be specified if creating a new mesh via mesh adaptation. Note: this parameter will become optional in the future when additional ways of creating a mesh are supported.
- create_simulation(mesh_id: luminarycloud.types.MeshID, name: str, simulation_template_id: str, *, description: str = '', batch_processing: bool = False, 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 False
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.
- 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.
- 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, chunk_size: int | 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 without the extension.
- scalingfloat, optional
If set, apply a scaling factor to the mesh.
- chunk_sizeint, optional
Number of bytes per uploaded chunk. Default size is 1 MB.
- 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.vector3.Vector3 | None = None, moment_center: luminarycloud.vector3.Vector3 | None = None, averaging_type: luminarycloud.enum.AveragingType = AveragingType.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_directionVector3, optional
The direction of the query component for “force” quantity types. Required for certain quantity types.
- moment_centerVector3, 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.
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.
- 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.
- status: luminarycloud.enum.SimulationStatus¶
Simulation status. May not reflect current status.
- property update_time: datetime.datetime¶
- class luminarycloud.SimulationParam¶
Bases:
luminarycloud.params._param_wrappers.SimulationParam
Simulation configuration that supports multiple physics.
- assign_material(material: luminarycloud.params.materials.Material, volume: luminarycloud.params.geometry.Volume | str)¶
- assign_physics(physics: luminarycloud.params.physics.Physics, volume: luminarycloud.params.geometry.Volume | str)¶
- classmethod from_json(path: os.PathLike)¶
- classmethod from_proto(proto: luminarycloud._proto.client.simulation_pb2.SimulationParam)¶
- convergence_criteria: luminarycloud.params.convergence_criteria.ConvergenceCriteria¶
Convergence criteria for the simulation.
- materials: list[luminarycloud.params.materials.Material]¶
List of materials.
- physics: list[luminarycloud.params.physics.Physics]¶
List of physics solvers.
- 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.
- update(*, name: str | None = None, parameters: luminarycloud._proto.client.simulation_pb2.SimulationParam | None = None, params_json_path: os.PathLike | None = None) None ¶
Update simulation template.
- Parameters:
- namestr, optional
New project name.
- parametersstr, optional
New complete simulation parameters. Ignored if params_json_path is set.
- params_json_pathpath-like, optional
Path to local JSON file containing simulation params.
- 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.Vector3¶
Represents a 3-dimensional vector.
- x: float = 0.0¶
- y: float = 0.0¶
- z: float = 0.0¶
- luminarycloud.create_project(name: str, description: str = '') Project ¶
Create a project owned by the user.
- Parameters:
- namestr
Project name.
- descriptionstr
Project description.
- 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.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¶