Hello Maciej Nowakowski
Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.
If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.
Please login with a confirmed email address before reporting spam
Posted:
9 years ago
13 lug 2015, 11:23 GMT-4
Hi, I have the same [or at least related] question.
How does the random function work. For example, if I define a property of a rock permeability to be, say, 100 [mD]*(1+0.1*rn1(x)) then when does that random function get computed - ever iteration of the solver or just when the "Compute" button is launched. If I have that permeability being referenced by two different physics then does each get the same value of permeability or both cause the random number to be relaunched.
I guess what exactly fits my need is for the randomness to be at the instant I type it in as a material property and from then on to be constant for every other chain down the line.
And if so, then that does raise the question then of how to reseed the random number to run the chain on a different permeability.
Thanks, John
Hi, I have the same [or at least related] question.
How does the random function work. For example, if I define a property of a rock permeability to be, say, 100 [mD]*(1+0.1*rn1(x)) then when does that random function get computed - ever iteration of the solver or just when the "Compute" button is launched. If I have that permeability being referenced by two different physics then does each get the same value of permeability or both cause the random number to be relaunched.
I guess what exactly fits my need is for the randomness to be at the instant I type it in as a material property and from then on to be constant for every other chain down the line.
And if so, then that does raise the question then of how to reseed the random number to run the chain on a different permeability.
Thanks, John
Gunnar Andersson
COMSOL Employee
Please login with a confirmed email address before reporting spam
Posted:
9 years ago
14 lug 2015, 02:11 GMT-4
I guess what exactly fits my need is for the randomness to be at the instant I type it in as a material property and from then on to be constant for every other chain down the line.
The random function is random but constant: rn1(x) is guaranteed to always return the same value. Without this property, random functions would become much less useful, especially in nonlinear models where it would be hard to get convergence.
There is no seed to the random function generator, but you can achieve the same effect by adding an offset to the argument: If you replace rn1(x) with rn1(x+0.1), you get the same effect. You can make this more explicit by defining a parameter called "seed" under Global Definitions > Parameters and using rn1(x+seed) where the function is used.
[QUOTE]I guess what exactly fits my need is for the randomness to be at the instant I type it in as a material property and from then on to be constant for every other chain down the line.[/QUOTE]
The random function is random but constant: rn1(x) is guaranteed to always return the same value. Without this property, random functions would become much less useful, especially in nonlinear models where it would be hard to get convergence.
There is no seed to the random function generator, but you can achieve the same effect by adding an offset to the argument: If you replace rn1(x) with rn1(x+0.1), you get the same effect. You can make this more explicit by defining a parameter called "seed" under Global Definitions > Parameters and using rn1(x+seed) where the function is used.