Skip to content
/ ParFDS Public
forked from slink/ParFDS

Python parametric wrapper code for NIST's Fire Dynamics Simulator (FDS) & Reax Engineering's Generalized Pyrolysis Model (GPyro)

License

Notifications You must be signed in to change notification settings

JLUrban/ParFDS

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The code is a number of files plus an example FDS input file.

  • parFDS.py - the code which orchestrates the calls to FDS and wrapping
  • example_input_file.fds - an example modified FDS input template

Most of the important stuff takes place after the if __name__ == '__main__' in ParFDS.py

Here's a walkthrough:

The first line which defines 'input_file' tells the code where to look for the template input file.

Parameters are defined via an augmented FDS/GPyro syntax which is parsed in the code base. Variables in this syntax for these parametric studies are {Variable_Name SWEEP First_Value, Second_Value, Number_Steps}, where SWEEP is a protected word which lets ParFDS know that we will be attempting a linear parametric study in that variable.

Parameters can be constrained by using the optional keyword axis followed by the axis_index, an integer number denoting what group of swept parameters it belongs to. This is implemented with the following syntax: {Variable_Name SWEEP First_Value, Second_Value, Number_Steps, axis, axis_index}. Parameter sweeps without a specified axis will be treated as if they are unconstrained, unique axis (i.e. backwards compatible).

The 'kwargs', dictionary sets things like:

  • 'test_name' - which is the prefix appended to all the generated FDS input files and folder names
  • 'base_path' - the name of the base folder which will contain the folders and input files generated by the code (assumed to be under the folder containing pafFDS.py)
  • 'funct' : the actual subprocess call for fds_mpi (please see this function if you want to turn mpi on or off or set the -np flag for mpirun) if you are not using mpi it is a trivial change on the subprocess.call line.
  • 'multiproc' is currently set to True, creating the multiprocessing pool used throughout.
  • 'pool_size' the number of workers in the pool

Note, that if you use mpirun -np X and set pool_size to Y, the number of processes you will have running is X*Y at any one time as the code will spin up Y workers, which will each make an mpirun call, spinning up X processes.

The code is then run using the main function, with the syntax:

main(input_file, parameters, **kwargs)

One more thing: in the example_input_file.fds example file, certain of the variables are in curley braces eg. {COLD_TEMP SWEEP 20, 20, 1}. That is actually used for the variable replacement in Python, which occurs in build_input_files() in helper_functions.py. The point here is that if the key 'STEP_WMAX' exists in the parameters dictionary, and also exists in the FDS input file in the form {COLD_TEMP SWEEP 20, 20, 1}, the code will know to replace that string with the appropriate numerical value when it generates the input files.

Functional Note: the current fork fo this code has only been run under Ubuntu, and it is not known if it will work on Windows. Work In Progress: Unit testing - guidance on testing will be updated soon. ~~If you are going to use this on Windows, please ensure (at a minimum) that the command 'nosetests ./tests/*.py' run at the command prompt passes first. ~~

About

Python parametric wrapper code for NIST's Fire Dynamics Simulator (FDS) & Reax Engineering's Generalized Pyrolysis Model (GPyro)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%