luminarycloud.simulation¶
Classes¶
Represents a simulation object. |
Functions¶
|
Retrieve a specific simulation by ID. |
Module Contents¶
- class luminarycloud.simulation.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.
- luminarycloud.simulation.get_simulation(id: str) Simulation ¶
Retrieve a specific simulation by ID.
- Parameters:
- idstr
Simulation ID.