Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

Random function in distribution material properties

Please login with a confirmed email address before reporting spam

Hi,

I would like to use random distribution of material properties.

In the user’s guide to version 4.3 it was written that I can add following functions to the material: analytic, interpolation, piecewise. It is possible to choose them in material tab.

Could you please tell me if you know that it is possible to use random function from the global definitions tab with material?

I tried to use it with Young Modulus distribution and it works only with the simplest model - fixed to ground cube with boundary load from the top. However it doesn’t work with any more complex models. There is an error “Maximum number of Newton iterations reached. Returned solution is not converged.” Increasing number of iteration doesn't help. Can you please give me some suggestions?

regards,

Maciej

2 Replies Last Post 14 juil. 2015, 02:11 UTC−4
COMSOL Moderator

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 juil. 2015, 11:23 UTC−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 juil. 2015, 02:11 UTC−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.

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.