Gmsh is an open-source lightweight and easy to use meshing tool. With it, it is possible to use APIs in multiple programming languages to launch the meshing steps. Running your Gmsh meshing on Qarnot is as easy as uploading your case and launching a script. Here’s a walk-through of the different steps.
The test case uses Gmsh 4.8.4, release in 2021.
If you are interested in another version, please send us an email at qlab@qarnot.com.
Please ensure that you have created a Qarnot account.
This test case is based on three simple cubes to mesh. You can download the files here, which contains the geometry definition in a Gmsh file. You should put it at the same folder level as the script to launch the calculation. Please note that it needs to be unzipped before it can be used on Qarnot.
Before starting a calculation with the Python SDK, a few steps are required:
Note: in addition to the Python SDK, Qarnot provides C# and Node.js SDKs and a Command Line.
Once everything is set up, the following script needs to be used to start the calculation.
Be sure you have copied your authentication token in the script (instead of <<<MY_SECRET_TOKEN>>>
) to be able to launch the task on Qarnot.
import qarnot
# Create a connection, from which all other objects will be derived
# Enter client token here
conn=qarnot.connection.Connection(client_token='<<<MY_SECRET_TOKEN>>>')
# Create a task
task = conn.create_task("Hello World - Gmsh", "docker-batch", 1)
# Create the input bucket and synchronize with a local folder
# Insert a local folder directory
input_bucket = conn.create_bucket("gmsh-in")
input_bucket.sync_directory("hex")
# Attach the bucket to the task
task.resources.append(input_bucket)
# Create a result bucket and attach it to the task
task.results = conn.create_bucket("gmsh-out")
# Define the Docker image and the command to be run in the container
task.constants["DOCKER_REPO"] = "qarnotlab/gmsh"
task.constants["DOCKER_TAG"] = "4.8.4"
task.constants['DOCKER_CMD'] = "gmsh hex.geo -3 -format vtk"
# Submit the task
task.run(output_dir="gmsh_results")
To launch this script, simply copy the preceding code in a Python script, put at the same level as the hex folder and execute python3 gmsh.py &
in your terminal.
At any given time, you can monitor the status of your task on the general web interface.
You should also now have a result folder in the output bucket and on your computer containing the mesh result. You can open the hex.vtk file in Paraview or any other viewer. You can also use our Paraview Web payload to view the results online if needed.
That’s it! If you have any questions, please contact qlab@qarnot.com and we will help you with pleasure!