luminarycloud

Subpackages

Submodules

Attributes

Classes

Geometry

Represents a Geometry object.

Mesh

Represents a Mesh object.

MeshAdaptationParameters

Parameters used to create a new mesh with mesh adaptation.

Project

Represents a Project object.

Simulation

Represents a simulation object.

SimulationTemplate

Represents a simulation template object.

Vector3

Represents a 3-dimensional vector.

ReferenceValues

Reference values needed for computing forces, moments and other

Functions

get_geometry(→ Geometry)

Get a specific geometry with the given ID.

get_mesh(→ Mesh)

Get a specific mesh with the given ID.

get_mesh_metadata(...)

Returns the mesh metadata of a specific mesh with the given ID.

create_project(→ Project)

Create a project owned by the user.

get_project(→ Project)

Get a specific project by ID.

list_projects(→ list[Project])

List projects accessible by the user.

get_simulation(→ Simulation)

Retrieve a specific simulation by ID.

get_simulation_template(→ SimulationTemplate)

Retrieve a specific simulation template by ID.

use_itar_environment(→ None)

Configures the SDK to make API calls to the Luminary Cloud ITAR Environment,

use_standard_environment(→ None)

Configures the SDK to make API calls to the Luminary Cloud Standard Environment,

Package Contents

luminarycloud.logger
luminarycloud.get_geometry(id: str) Geometry

Get a specific geometry with the given ID.

Parameters:
idstr

Geometry ID.

Returns:
Geometry

The requested Geometry.

class luminarycloud.Geometry(proto_type: google.protobuf.message.Message | None = None)

Represents a Geometry object.

id: str

Geometry ID.

name: str

Geometry name.

property create_time: datetime.datetime

The time the geometry was created.

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.

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.

issuestuple[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.

luminarycloud.get_mesh(id: str) Mesh

Get a specific mesh with the given ID.

Parameters:
idstr

Mesh ID.

luminarycloud.get_mesh_metadata(id: str) 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.

class luminarycloud.Mesh(proto_type: google.protobuf.message.Message | None = None)

Represents a Mesh object.

id: str

Mesh ID.

name: str

Mesh name.

status: luminarycloud.enum.MeshStatus

Mesh status. May not reflect the current status.

property create_time: datetime.datetime
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.

delete() None

Delete the mesh.

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.

source_simulation_id: str
target_cv_count: int
h_ratio: float
luminarycloud.create_project(name: str, description: str = '') Project

Create a project owned by the user.

Parameters:
namestr

Project name.

descriptionstr

Project description.

luminarycloud.get_project(id: str) Project

Get a specific project by ID.

Parameters:
idstr

Project ID.

luminarycloud.list_projects() list[Project]

List projects accessible by the user.

class luminarycloud.Project

Represents a Project object.

id: str
name: str
description: str
storage_usage_bytes: int
property create_time: datetime.datetime
property update_time: datetime.datetime
update(*, name: str = '', description: str = '') None

Update/Edit project attributes.

Mutates self.

Parameters:
namestr, optional

New project name.

descriptionstr, optional

New project description.

delete() None

Delete the project.

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.

list_geometries() list[luminarycloud.geometry.Geometry]

List all geometries in project.

Returns:
list[Geometry]

A list of all available Geometries in the project.

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.

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.

list_meshes() list[luminarycloud.mesh.Mesh]

List all meshes in project.

create_simulation(mesh_id: str, name: str, simulation_template_id: str, *, description: str = '', batch_processing: bool = False) 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.

list_simulations() list[luminarycloud.simulation.Simulation]

List all simulations in project.

list_simulation_templates() list[luminarycloud.simulation_template.SimulationTemplate]

List all simulation templates in project.

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.

luminarycloud.get_simulation(id: str) Simulation

Retrieve a specific simulation by ID.

Parameters:
idstr

Simulation ID.

class luminarycloud.Simulation(proto_type: google.protobuf.message.Message | None = None)

Represents a simulation object.

id: str

Simulation ID.

name: str

Simulation name.

description: str

Simulation description.

status: luminarycloud.enum.SimulationStatus

Simulation status. May not reflect current status.

mesh_id: str

ID of the simulation mesh.

property create_time: datetime.datetime
property update_time: datetime.datetime
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.

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())
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.

suspend() None

Suspend the simulation.

list_solutions() list[luminarycloud.solution.Solution]

List all solutions for this simulation in ascending order of iteration.

get_parameters() luminarycloud._proto.client.simulation_pb2.SimulationParam
luminarycloud.get_simulation_template(id: str) SimulationTemplate

Retrieve a specific simulation template by ID.

Parameters:
idstr

Simulation template ID.

class luminarycloud.SimulationTemplate(proto_type: google.protobuf.message.Message | None = None)

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.

id: str

Simulation template ID.

name: str

Simulation name.

parameters: luminarycloud._proto.client.simulation_pb2.SimulationParam

Simulation description.

property create_time: datetime.datetime
property update_time: datetime.datetime
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.

delete() None

Delete the simulation template.

class luminarycloud.Vector3

Represents a 3-dimensional vector.

x: float = 0.0
y: float = 0.0
z: float = 0.0
class luminarycloud.ReferenceValues

Reference values needed for computing forces, moments and other non-dimensional output quantities.

reference_value_type: luminarycloud.enum.ReferenceValuesType

Method of specification for the reference values used in force and moment computations. Default: PRESCRIBE_VALUES

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

use_aero_moment_ref_lengths: bool = False

Whether to use separate reference lengths for pitching, rolling and yawing moments. Default: False

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

t_ref: float = 288.15

Reference temperature for computing force and moment coefficients. Default: 288.15

v_ref: float = 1.0

Reference velocity magnitude for computing force and moment coefficients. Default: 1.0

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