Python API reference¶
The planned gradientdynamics package exposes Studio concepts as typed Python
objects. Projects own versioned geometry, meshes, simulations and solutions;
long-running work returns a job object that can be inspected, waited on or
cancelled.
Important
This is a design preview for integration planning. The package name, signatures and types can change before general availability. Studio remains the supported self-service interface and no public Python package or credentials are currently available.
Object-first workflow¶
from gradientdynamics import Client
from gradientdynamics.fluxcore import (
Farfield,
ForceOutput,
Fluid,
SimulationConfig,
Wall,
)
from gradientdynamics.meshing import PrismLayers, PrismOctreeConfig
gd = Client.from_environment()
project = gd.projects.create(name="Road-car baseline")
geometry = project.geometry.upload("drivaer.stl")
mesh_job = geometry.mesh(
PrismOctreeConfig(
target_cell_count=12_000_000,
minimum_spacing=0.002,
maximum_spacing=0.5,
prism_layers=PrismLayers(count=12, first_height=0.0002),
)
)
mesh = mesh_job.wait().result()
simulation = mesh.simulations.create(
SimulationConfig.rans(
fluid=Fluid.air(temperature=300.0),
boundaries={
"farfield": Farfield(velocity=(30.0, 0.0, 0.0)),
"vehicle": Wall.adiabatic(),
},
outputs=[ForceOutput.drag(name="vehicle_drag", surfaces=["vehicle"])],
)
)
solution = simulation.run().wait().result()
print(solution.outputs["vehicle_drag"].coefficient)
solution.fields.download("road_car.cgns")
The example shows intended object relationships, not currently executable code.
Package map¶
Namespace |
Main objects |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
Typed validation, capacity, resource and execution errors |
Resource lifecycle¶
Client
└── Project
├── Geometry ──mesh()──────────────▶ Job[Mesh] ──result()──▶ Mesh
├── Mesh ──────simulations.create()────────────────────────▶ Simulation
└── Simulation ──run()─────────────▶ Job[Solution] ────────▶ Solution
├── outputs
├── histories
└── fields