Difference between revisions of "RandSeed Command"

From OSUPDOCS
Jump to navigation Jump to search
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 you run calculations with stochastic settings the results will be slightly different, it can be challenging to set up calculations. To fix this isse, the <tt>RandSeed</tt> command lets you pick a random number seed. When a specific number is picked, each run will see the same random number and will there for be reproducible. Once initial set is complete, however, you must remove this command to make sure you modeling actually will be stochastic modeling.


They can only be entered using <tt>XML</tt> commands and they must be in the <tt>&lt;Header&gt;</tt> block:
A random number seed can only be set in <tt>XML</tt> commands and must be in the <tt>&lt;Header&gt;</tt> block:


  &lt;DevelFlag Number='0'&gt;2&lt;/DevelFlag&gt;
  &lt;RandSeed&gt;5278&lt;/RandSeed&gt;


This command sets a development flag by number, which must be from 0 to 4. The value must be an integer. The default for all flags is zero. Any non-zero flags will be listed in the output file after the description. During development or in specific calculations, the code might be modified to alter the calculations depending on these flags. These flags should not, however, be relied upon to mean anything permanent.
Any number greater than 0 will be used as a random number seed. If the enter is zero or negative, the random numbers will be seeded by the current time, which will differ every time you run the calculations.


To insert a developer flag when using scripted input commands, you can use an [[XMLData Command]] targeted to the "Header" section:
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"
     &lt;DevelFlag Number='0'&gt;2&lt;/DevelFlag&gt;
     &lt;RandSeed&gt;5278&lt;/RandSeed&gt;
  EndXMLData
  EndXMLData

Revision as of 17:36, 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 you run calculations with stochastic settings the results will be slightly different, it can be challenging to set up calculations. To fix this isse, the RandSeed command lets you pick a random number seed. When a specific number is picked, each run will see the same random number and will there for be reproducible. Once initial set is complete, however, you must remove this command to make sure you modeling actually will be 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 enter is zero or negative, the random numbers will be seeded by the current time, which will differ every time you run the 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