-
Notifications
You must be signed in to change notification settings - Fork 3
BasicExample
Table of Contents
Example File: empty_room.xml
<fds>
<!-- file naming -->
<info chid="'empty_room'" outfile="'empty_room.fds'"/>
<!-- fixed input parameter -->
<input text="TIME T_END=0.0" />
<section id="mesh">
<!-- grid spacing of 0.2 m -->
<var delta = "0.2" />
<!-- spacial dimensions -->
<var lx = "2.4" ly = "3.6" lz = "1.8" />
<!-- compute gird dimensions -->
<var nx = "int(lx / delta)" ny="int(ly / delta)" nz="int(lz / delta)" />
<!-- info output to FDS file -->
<dump str="'! create FDS mesh with a grid spacing of %f and an extension of %f x %f x %f'%(delta, lx, ly, lz)" />
<!-- create mesh -->
<fds_mesh ijk="nx, ny, nz" xb="0, lx, 0, ly, 0, lz" />
</section>
</fds>The above example produces the following FDS input file (named empty_room.fds):
&HEAD CHID='empty_room', TITLE='title' /
&TIME T_END=0.0 /
! create FDS mesh with a grid spacing of 0.200000 and an extension of 2.400000 x 3.600000 x 1.800000
&MESH ID='none', IJK=11, 18, 9, XB=0, 2.400000, 0, 3.600000, 0, 1.800000/
&TAIL/The following procedure has been used:
-
Every FDS-XML input file must be enclosed by the tag FDS.
-
Comments in XML are indicated by
<!-- COMMENT -->. -
The info tag setups the essential header for a FDS input file, it sets the
CHIDtoempty_roomin theHEADsection. Additionally the output filename is set, here toempty_room.fds. -
The following input tag demonstrates the direct input of fixed strings into a FDS input file, i.e. the value of the attribute
textis written unprocessed to the FDS file. An&is appended and a closing/added to the output. -
The enclosing section tag is just used for structuring the XML file, no processing happens here.
-
The following two variable definition in the var tags define variables for the grid spacing and the extension of the room. This is followed by the computation of the grid size in each dimension.
-
The intrinsic FDS tag
fds_meshwrites the according FDS input line with the precomputed values for the grid size and grid extension.
As described in the sample above you can name the CHID and input by the line:
<info chid="'empty_room'" title="empty_room" outfile="'empty_room.fds'" />The CHID and TITLE are directly submitted to the HEAD-Line in FDS-Input file. The parameter outfile is the name of the resulting FDS-File, in this case empty_room.fds
While using this parameter with multiple dimensions (para-command) see parameter space definition.
If you don't want to use the included commands to create a line in the input file you can as well just type in the FDS-Input line into the python-script by the command:
<input text="TIME T_END=300." />There is no need to put an & at the beginning or an / to the end, this will be inserted automatically by the input-command.
All variables can by computed from other variables. The operations are evaluated by the Python interpreter. Rarely a typecast (e.g. conversion of a floating point number into an integer) is needed, like in the above example:
<var nx = "int(lx / delta)" ny="int(ly / delta)" nz="int(lz / delta)" />The above statements compute the number of grid cells in each direction based on the predefined room extension and grid spacing. The typecast int() is needed here, as FDS does accept only integer values for IJK. Note: formally the value 1.0 is not equal to 1.
Often a direct usage of the FDS syntax is useful. Therefore some common FDS input identifier, like MESH, DEVC, OBST, are also available. The above example computes all values needed for the mesh definition and uses the according FDS intrinsic to create the FDS input line.
<fds_mesh ijk="nx, ny, nz" xb="0, lx, 0, ly, 0, lz" />This results in the following FDS input line
&MESH ID='none', IJK=11, 18, 9, XB=0, 2.400000, 0, 3.600000, 0, 1.800000/The simple burner example demonstrates the variable placement of a fire source, see simple_burner.xml.
<fds>
<!-- variables for the position and diameter of the burner -->
<var xpos = "0.6" ypos = "1.0" diameter = "0.4"/>
<!-- file naming -->
<info chid="'simple_burner'" title="'Example file for FDSgeogen'" outfile="'simple_burner.fds'"/>
<!-- fixed input parameter -->
<input text="TIME T_END=5.0" />
<!--================================
========= mesh definition ==========
=================================-->
<!-- mesh dimensions and number of cells -->
<fds_mesh ijk="15,15,12" xb="0.0,3.0,0.0,3.0,0.0,2.4" />
<!-- mesh boundaries -->
<fds_vent mb = "'XMIN'" surf_id = "'OPEN'" />
<fds_vent mb = "'XMAX'" surf_id = "'OPEN'" />
<fds_vent mb = "'YMIN'" surf_id = "'OPEN'" />
<fds_vent mb = "'YMAX'" surf_id = "'OPEN'" />
<fds_vent mb = "'ZMAX'" surf_id = "'OPEN'" />
<!--================================
========= fire definition ==========
=================================-->
<!-- definition of the reaction -->
<fds_reac id="'METHANE'" fuel="'METHANE'" soot_yield="0.05"/>
<!-- burning surface -->
<fds_surf id="'burner'" hrrpua="1000" />
<!-- creating and positioning the burner -->
<fds_obst xb="xpos-diameter/2., xpos+diameter/2., ypos-diameter/2., ypos+diameter/2., 0.0, 0.4" surf_ids="'burner', 'INERT', 'INERT'"/>
</fds>This example is build up as follows:
- For convenience of easy parameter change, the variables controlling the position
xposandyposand extensiondiameterof the fire are defined right at the top. - This is followed by a standard info, simulation time and mesh definition parts.
- The last tag in the fire definition section computes the position of the burning obstruction as a function of
xposandyposwith the set extensiondiameter.