Difference between revisions of "RandSeed Command"
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Some MPM materials have options to randomly assign certain properties (''e.g.,'' an [[Isotropic Softening Material]]). Similarly, you can write expressions for any use that generate random numbers (see [[Expression Syntax#Supported Functions|<tt>rand(x)</tt> function]]. | Some MPM materials have options to randomly assign certain properties (''e.g.,'' an [[Isotropic Softening Material]]). Similarly, you can write expressions for any use that generate random numbers (see [[Expression Syntax#Supported Functions|<tt>rand(x)</tt> function]]). Because each time you run calculations with stochastic settings the results will be slightly different, it can be challenging to set up calculations. To help with this issue, the <tt>RandSeed</tt> command lets you pick a random number seed. When a specific seed is used, each run will see the same random numbers and will therefore be reproducible. Once initial set is complete, however, you must remove this command to make sure your modeling reverts to actual stochastic modeling. | ||
A random number seed can only be set in <tt>XML</tt> commands and must be in the <tt><Header></tt> block: | |||
< | <RandSeed>5278</RandSeed> | ||
Any number greater than 0 will be used as a random number seed. If the number is zero or negative, the random number will be seeded by the current time, which will differ every time you run calculations. | |||
To | To specify a random number seed when using scripted input commands, you can use an [[XMLData Command]] targeted to the "Header" section: | ||
XMLData "Header" | XMLData "Header" | ||
< | <RandSeed>5278</RandSeed> | ||
EndXMLData | EndXMLData |
Latest revision as of 16:39, 17 April 2024
Some MPM materials have options to randomly assign certain properties (e.g., an Isotropic Softening Material). Similarly, you can write expressions for any use that generate random numbers (see rand(x) function). Because each time you run calculations with stochastic settings the results will be slightly different, it can be challenging to set up calculations. To help with this issue, the RandSeed command lets you pick a random number seed. When a specific seed is used, each run will see the same random numbers and will therefore be reproducible. Once initial set is complete, however, you must remove this command to make sure your modeling reverts to actual stochastic modeling.
A random number seed can only be set in XML commands and must be in the <Header> block:
<RandSeed>5278</RandSeed>
Any number greater than 0 will be used as a random number seed. If the number is zero or negative, the random number will be seeded by the current time, which will differ every time you run calculations.
To specify a random number seed when using scripted input commands, you can use an XMLData Command targeted to the "Header" section:
XMLData "Header" <RandSeed>5278</RandSeed> EndXMLData