-
Notifications
You must be signed in to change notification settings - Fork 5
ParaSpace
Table of Contents
One application scenario of the FDSgeogen tool is to evaluate parameter spaces. To do so, a set of FDS input files, depending on the parameter values, has to be created. The tag [wiki:TagPara para] allows to create sets of input files. This tag describes for which parameter values the XML file shall be parsed.
The para tag allows to automatically generate input files with varying parameter. A simple example to this tag is as follows
<para var='xpos' list='1.0, 1.2, 1.4, 1.6, 1.8, 2.0' />
This example will parse the XML file six times. Each time a variable named xpos
will be created and set to the current value out of the list defined in the node.
To distinguish between various parameter iteration the variable para_id
is set, the starting value is 0. It is just a counter and may be used e.g. to name the FDS input file.
The following example basic_para.xml demonstrates the usage:
<fds>
<para var='xpos' list='1.0, 1.2, 1.4, 1.6, 1.8, 2.0' />
<!-- file naming -->
<info chid="'basic_para'" outfile="'basic_para_id%03d.fds'%para_id"/>
<!-- simple control output -->
<dump str="'! para id : %3d'%para_id" />
<dump str="'! xpos : %f'%xpos" />
</fds>
The above example will create six FDS input files:
basic_para_id000.fds
basic_para_id001.fds
basic_para_id002.fds
basic_para_id003.fds
basic_para_id004.fds
basic_para_id005.fds
The content of e.g. basic_para_id002.fds
is
&HEAD CHID='basic_para', TITLE='title' /
! para id : 2
! xpos : 1.400000
&TAIL/
To process multiple variables, there must be distinguished between:
- a single or multiple set of parameter which is iterated simultaneously,
- two or more sets (dimensions) of parameter that are independently iterated.
The first case iterates multiple sets (of same length) simultaneously:
- given two sets
s1 = [1,2,3,4]
s2 = [10,11,12,13]
- there are four elements in each set, therefore four iterations are needed:
-
s1 -> 1
ands2 -> 10
-
s1 -> 2
ands2 -> 11
-
s1 -> 3
ands2 -> 12
-
s1 -> 4
ands2 -> 13
In the second case, all possible combinations of the parameter sets (withindependent lengths) elements are iterated:
- given two sets
s1 = [1,2]
s2 = [10,11,12]
- there exist six possible combinations of the above set elements and therefore six iterations will be executed:
-
s1 -> 1
ands2 -> 10
-
s1 -> 2
ands2 -> 10
-
s1 -> 1
ands2 -> 11
-
s1 -> 2
ands2 -> 11
-
s1 -> 1
ands2 -> 12
-
s1 -> 2
ands2 -> 12
To group sets that shall be iterated together, the attribute dim
can be used. The above examples translate into
<para dim='same' var='s1' list='1,2,3,4' />
<para dim='same' var='s2' list='10,11,12,13' />
and
<para dim='d1' var='s1' list='1,2' />
<para dim='d2' var='s2' list='10,11,12' />
The following example illustrates a combination of both iteration ways (see multidim_para.xml):
<fds>
<para dim='position' var='xpos' list='1.0, 1.2, 1.4, 1.6, 1.8, 2.0' />
<para dim='position' var='ypos' list='range(6)' />
<para dim='diam' var="diameter" list='0.1, 0.2, 0.3' />
<!-- file naming -->
<info chid="'basic_para'" outfile="'basic_para_id%03d.fds'%para_id"/>
<!-- simple control output -->
<dump str="'! para_id : %2d, xpos : %f, ypos : %f, diameter : %f'%(para_id,xpos,ypos,diameter)" />
</fds>
This example produces 18 FDS input files with the following parameter combinations for xpos
, ypos
and diameter
:
para_id : 0, xpos : 1.000000, ypos : 0.000000, diameter : 0.100000
para_id : 1, xpos : 1.000000, ypos : 0.000000, diameter : 0.200000
para_id : 2, xpos : 1.000000, ypos : 0.000000, diameter : 0.300000
para_id : 3, xpos : 1.200000, ypos : 1.000000, diameter : 0.100000
para_id : 4, xpos : 1.200000, ypos : 1.000000, diameter : 0.200000
para_id : 5, xpos : 1.200000, ypos : 1.000000, diameter : 0.300000
para_id : 6, xpos : 1.400000, ypos : 2.000000, diameter : 0.100000
para_id : 7, xpos : 1.400000, ypos : 2.000000, diameter : 0.200000
para_id : 8, xpos : 1.400000, ypos : 2.000000, diameter : 0.300000
para_id : 9, xpos : 1.600000, ypos : 3.000000, diameter : 0.100000
para_id : 10, xpos : 1.600000, ypos : 3.000000, diameter : 0.200000
para_id : 11, xpos : 1.600000, ypos : 3.000000, diameter : 0.300000
para_id : 12, xpos : 1.800000, ypos : 4.000000, diameter : 0.100000
para_id : 13, xpos : 1.800000, ypos : 4.000000, diameter : 0.200000
para_id : 14, xpos : 1.800000, ypos : 4.000000, diameter : 0.300000
para_id : 15, xpos : 2.000000, ypos : 5.000000, diameter : 0.100000
para_id : 16, xpos : 2.000000, ypos : 5.000000, diameter : 0.200000
para_id : 17, xpos : 2.000000, ypos : 5.000000, diameter : 0.300000
Parameter sets can be read out of a file. Given a parameter file
1.,1.
1.8,1.2
2.6,1.4
The syntax of a parameter file is supposed to be a simple comma separated value text file.
The according XML file uses the para tag to point to the parameter input file (extract of simple_burner_read_parameter_file.xml)
<fds>
<!-- reading in the parameter file -->
<para var="xpos" file="data.csv" col="0" />
<para var="ypos" file="data.csv" col="1" />
<!-- variable for the diameter of the burner -->
<var diameter = "0.4"/>
<!-- file naming according to the parameter id-->
<info chid="'simple_burner_id%i'%para_id" title="'Example file for FDSgeogen'" outfile="'simple_burner_id%i.fds'%para_id"/>
<!-- fixed input parameter -->
<input text="TIME T_END=5.0" />
<!--================================
========= mesh definition ==========
=================================-->
[...]
<!--================================
========= 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'"/>
<!--================================
======== output definition =========
=================================-->
<!-- creates 10 temperature devices with vertical distance of 0.1 m above the center of the burner. The lowest device is in a height of 0.5m -->
<loop var="z" start="0" stop="9">
<devc id="'TEMP_z%i'%(z)" x="xpos" y="ypos" z="0.5+0.1*z" q="'TEMPERATURE'" />
</loop>
<fds_slcf pby="ypos" quantity="'VELOCITY'" vector="True" />
</fds>