Skip to content

Commit de40652

Browse files
committed
Updated example in readme
1 parent e770744 commit de40652

File tree

1 file changed

+17
-21
lines changed

1 file changed

+17
-21
lines changed

README.md

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,9 @@ token = "..."
6666
The exact contents of both of the above options can be obtained directly by clicking the **Create new run** button on the web UI. Note that the environment variables have preference over the config file.
6767

6868
## Usage example
69-
{Replace the example below with a similar example exhibiting how to use your Connector. The example for the FDS (Fire Dynamics Simulator) connector is given below:}
7069

7170
```python
72-
from simvue_fds.connector import FDSRun
71+
from simvue_openfoam.connector import OpenfoamRun
7372

7473
...
7574

@@ -79,45 +78,42 @@ if __name__ == "__main__":
7978

8079
# Using a context manager means that the status will be set to completed automatically,
8180
# and also means that if the code exits with an exception this will be reported to Simvue
82-
with FDSRun() as run:
81+
with OpenfoamRun() as run:
8382

8483
# Specify a run name, along with any other optional parameters:
8584
run.init(
86-
name = 'my-fds-simulation', # Run name
87-
metadata = {'number_fires': 3}, # Metadata
88-
tags = ['fds', 'multiple-fires'], # Tags
89-
description = 'FDS simulation of fires in a parking garage.', # Description
90-
folder = '/fds/parking-garage/trial_1' # Folder path
85+
name = 'my-openfoam-simulation', # Run name
86+
metadata = {'angle_of_attack': 30}, # Metadata
87+
tags = ['fds', 'airfoil', '2D'], # Tags
88+
description = 'OpenFOAM simulation of a 2D airfoil.', # Description
89+
folder = '/openfoam/airfoil2D/trial_1' # Folder path
9190
)
9291

9392
# Set folder details if necessary
9493
run.set_folder_details(
95-
metadata = {'simulation_type': 'parking_garage'}, # Metadata
96-
tags = ['fds'], # Tags
97-
description = 'FDS simulations with fires in different areas' # Description
94+
metadata = {'simulation_type': 'airfoil2D'}, # Metadata
95+
tags = ['openfoam'], # Tags
96+
description = 'OpenFOAM simulations of airfoils' # Description
9897
)
9998

10099
# Can use the base Simvue Run() methods to upload extra information, eg:
101100
run.save_file(os.path.abspath(__file__), "code")
102101

103102
# Can add alerts specific to your simulation, eg:
104103
run.create_metric_threshold_alert(
105-
name="visibility_below_five_metres", # Name of Alert
106-
metric="eye_level_visibility", # Metric to monitor
104+
name='ux_residuals_too_high', # Name of Alert
105+
metric='residuals.initial.Ux', # Metric to monitor
107106
frequency=1, # Frequency to evaluate rule at (mins)
108-
rule="is below", # Rule to alert on
109-
threshold=5, # Threshold to alert on
107+
rule="is above", # Rule to alert on
108+
threshold=0.1, # Threshold to alert on
110109
notification='email', # Notification type
111110
trigger_abort=True # Abort simulation if triggered
112111
)
113112

114-
# Launch the FDS simulation
113+
# Launch the OpenFOAM simulation
115114
run.launch(
116-
fds_input_path='path/to/my/input_file.i', # Path to your FDS input file
117-
workdir_path='path/to/my/results_dir', # Path where results should be created
118-
run_in_parallel=True, # Whether to run in parallel using MPI
119-
num_processors=2 # Number of cores to use if in parallel
120-
115+
openfoam_case_dir='path/to/my/openfoam/case', # Path to your OpenFOAM case directory
116+
upload_as_zip=True, # Whether to upload inputs & results as zip files
121117
)
122118

123119
```

0 commit comments

Comments
 (0)