Mesh¶
A Mesh
represents the computational mesh. This could be an uploaded mesh file, a mesh generated from a Geometry
, or a mesh adapted from a previous simulation. No matter the origin, you will need a mesh to run a Simulation
.
Uploading a Mesh¶
Once you’ve created a Project
, you can upload a mesh file. Supported file formats are listed on the learning site. See upload_mesh()
for syntax and parameters.
You can use uploaded meshes to run simulations in the same project.
To see an example using the SDK, take a look at the corresponding section in our end-to-end tutorial.
Generating a Mesh¶
To generate a mesh, you will need a Project
containing a Geometry
. Click on the links for more info.
To set up the parameters for the mesh generation, you will need to create a MeshGenerationParams
object.
from luminarycloud.meshing import MeshGenerationParams
from luminarycloud.meshing.sizing_strategy import MaxCount
mesh_generation_params = MeshGenerationParams(
geometry_id=geometry.id,
sizing_strategy=MaxCount(1000000),
)
At minimum, you will need to specify the two parameters set in the example above. The geometry_id
parameter is the ID of the geometry to generate a mesh for. The sizing_strategy
parameter can take one of three values: MinimalCount
, TargetCount
, or MaxCount
. Click on the links for the full descriptions of each strategy.
Without specifying any additional parameters, the mesh generation will mesh all volumes in the geometry using default values. See MeshGenerationParams
to learn more about the other parameters you can set.
Once you’ve set the parameters, you can generate a mesh by calling create_or_get_mesh()
with the mesh parameters on the project.
mesh = project.create_or_get_mesh(mesh_generation_params)
Before you can use the mesh in a simulation, you will need to wait for the mesh to finish processing. You can do this by calling wait()
on the mesh, which will block the script from proceeding until the meshing is complete.
mesh.wait()