Fire Dynamics Simulator is an open source Computational Fluid Dynamics (CFD) software used to simulate the propagation of fire and smoke. It uses a Large-Eddy Simulations (LES) model applied to low-speed flows with thermal transport. It also comes with Smokeview, a visualization module.
Here are the currently available versions on Qarnot:
If you are interested in another version, please send us an email at qlab@qarnot.com.
Before starting a calculation with the Python SDK, a few steps are required:
In addition to the Python SDK, Qarnot provides C# and Node.js SDKs and a Command Line.
This test case is based on a roman Temple of Portonus fire simulation.
You can download the case folder here, which contains the test case as a .fds 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.
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 YOUR_SECRET_TOKEN
) to be able to launch the task on Qarnot.
fds.py
#!/usr/bin/env python
"""Script to run an FDS sample computation on Qarnot cloud"""
import qarnot
from qarnot.scheduling_type import OnDemandScheduling
# =============================== Setup Variables =============================== #
# To change
CLIENT_TOKEN="YOUR_SECRET_TOKEN"
# If needed
TASK_NAME=f"RUN SAMPLE FDS"
FDS_VERSION="6.7.9"
NB_INSTANCES=1
# =============================================================================== #
# Create a connection, from which all other objects will be derived
conn = qarnot.connection.Connection(client_token=CLIENT_TOKEN)
# Create a task
task = conn.create_task(TASK_NAME, "fds", NB_INSTANCES)
# Create the input bucket and synchronize with a local folder
input_bucket = conn.create_bucket('fds-temple')
input_bucket.sync_directory('temple')
task.resources.append(input_bucket)
# Create a result bucket and attach it to the task
output_bucket = conn.create_bucket(f'fds-temple-out')
task.results = output_bucket
# Configure task parameters
task.constants["DOCKER_TAG"] = FDS_VERSION
task.constants["FDS_CMD"] = "mpiexec -np 16 fds temple_16_MPI_PROC.fds"
# Number of processes per node in the mpihost file, e.g. "26" out of 28 cores.
# task.constants['SETUP_CLUSTER_NB_SLOTS'] = "26"
# Define interval time in seconds when your simulation will be saved to your bucket.
task.snapshot(900)
# OnDemand setup
# task.scheduling_type=OnDemandScheduling()
# ---------- Optional ----------
OUTPUT_DIR="temple-out"
task.submit()
# The following will download result to the OUTPUT_DIR
# It will also print the state of the task to your console
LAST_STATE = ''
SSH_TUNNELING_DONE = False
while not SSH_TUNNELING_DONE:
if task.state != LAST_STATE:
LAST_STATE = task.state
print(f"** {LAST_STATE}")
# Wait for the task to be FullyExecuting
if task.state == 'Success':
print(f"** {LAST_STATE}")
task.download_results(OUTPUT_DIR, True)
SSH_TUNNELING_DONE = True
# Display errors on failure
if task.state == 'Failure':
print(f"** Errors: {task.errors[0]}")
SSH_TUNNELING_DONE = True
To launch this script, simply copy the preceding code in a Python script, put at the same level as the temple folder. Your tree view should look like this:
├─ temple/
│ ├─ temple_16_MPI_PROC.fds
├─ run-fds.py
Launching the test-case
Now you can execute python3 fds.py
in your terminal.
Here is an example of how to run an FDS simulation with SSH and VNC activated on the platform.
With SSH you can interact with your node(s) through command line, and with VNC you can have a desktop visualization.
If you want to connect through SSH, you will need an SSH public key. You can create one by following this tutorial.
#!/usr/bin/env python
"""Script to run an FDS sample computation on Qarnot cloud"""
import qarnot
from qarnot.scheduling_type import OnDemandScheduling
# =============================== Setup Variables =============================== #
# To change
CLIENT_TOKEN="YOUR_SECRET_TOKEN"
SSH_PUBLIC_KEY="YOUR_SSH_PUBLIC_KEY"
# If needed
TASK_NAME=f"RUN SAMPLE FDS VNC"
FDS_VERSION="6.7.9"
NB_INSTANCES=1
NO_EXIT="false"
# =============================================================================== #
# Create a connection, from which all other objects will be derived
conn = qarnot.connection.Connection(client_token=CLIENT_TOKEN)
# Create a task
task = conn.create_task(TASK_NAME, "fds-vnc-ssh", NB_INSTANCES)
# Create the input bucket and synchronize with a local folder
input_bucket = conn.create_bucket('fds-temple')
input_bucket.sync_directory('temple')
task.resources.append(input_bucket)
# Create a result bucket and attach it to the task
output_bucket = conn.create_bucket(f'fds-temple-out')
task.results = output_bucket
# Configure task parameters
task.constants["DOCKER_TAG"] = FDS_VERSION
task.constants["FDS_CMD"] = "mpiexec -np 16 fds temple_16_MPI_PROC.fds"
task.constants['DOCKER_SSH'] = SSH_PUBLIC_KEY
# Set to 'true' to keep cluster alive once your simulation is done.
task.constants['NO_EXIT'] = NO_EXIT
# Number of processes per node in the mpihost file, e.g. "26" out of 28 cores.
# task.constants['SETUP_CLUSTER_NB_SLOTS'] = "26"
# Define interval time in seconds when your simulation will be saved to your bucket.
task.snapshot(900)
# OnDemand setup
# task.scheduling_type=OnDemandScheduling()
task.submit()
To launch the computation on Qarnot, save the above code as a Python script in your working directory. Before running it, make sure to update the following constants at the beginning of the script:
MY_SECRET_TOKEN
with your actual authentication token.SSH_PUBLIC_KEY
with your actual SSH key.And now, you can execute python3 run-vnc-ssh.py
.
On the simulation page, you can monitor your instances states, logs or execution time and check your task configuration you set up such as a profile name, the FDS version or your SSH key.
In case of an SSH task, IP and port can be found under the Port Forward section.
Your results will be stored in the fds-temple-out
bucket and can be retrieved with three methods:
You should also now have a result folder in the output bucket and on your computer containing all the numerical results. You can open the IMP_TEMPLE.smv in Smokeview.
In both VNC on Qarnot of on your computer, simply use the following command in a terminal : smokeview IMP_TEMPLE.smv
.
Please note the VNC link in the logs section, which you can use to access your task with desktop visualization.
To output images of the results, simply use the render option in Smokeview.
That’s it! If you have any questions, please contact qlab@qarnot.com and we will help you with pleasure!