Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

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.

about the Random function

Please login with a confirmed email address before reporting spam

there is an example, named "phase separation", in the model library of comsol 4
it uses a Random function as the initial condition, and the geometry is a square with sidelengths equal to 2*pi [m]
when I reduce the sidelength to 1[mm], the model cannot be computed correctly. I figure the problem is the Random function. when I reduce the geometry size, something must be done about the Random function. For the Random function, the default range of the argument is [0, 1], maybe it should be changed, but there is no corresponding setting option in the Random function definition interface.

12 Replies Last Post 3 févr. 2011, 13:51 UTC−5
Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 1 févr. 2011, 02:43 UTC−5
Hi

I believe its a question of understanding then, the random function has a RMS standard deviation in "normal mode" or a boundary limit pk-pk amplitude in "Uniform mode".
So if you fill a 1x1 m domain the default settings are ok to cover the full area, if you reduce the area you should also scale the random function accordingly, either by using a variable for the range, or by multiplying your random function by a factor

--
Good luck
Ivar
Hi I believe its a question of understanding then, the random function has a RMS standard deviation in "normal mode" or a boundary limit pk-pk amplitude in "Uniform mode". So if you fill a 1x1 m domain the default settings are ok to cover the full area, if you reduce the area you should also scale the random function accordingly, either by using a variable for the range, or by multiplying your random function by a factor -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 1 févr. 2011, 10:34 UTC−5

Hi

I believe its a question of understanding then, the random function has a RMS standard deviation in "normal mode" or a boundary limit pk-pk amplitude in "Uniform mode".
So if you fill a 1x1 m domain the default settings are ok to cover the full area, if you reduce the area you should also scale the random function accordingly, either by using a variable for the range, or by multiplying your random function by a factor

--
Good luck
Ivar


HI, Ivar, thank you!
I don't quite understand "by using a variable for the range, or by multiplying your random function by a factor"
If my random function is as follows:
Number of arguments: 2
Distribution: Uniform
mean: 0.5
range: 0.01
This random function is suitable for 1*1 m domain
How should I change the random function to make it suitable to 100*100 um domain?
Can you give me an example?

By the way, I wonder the number-to-number spacing of the random function, for example, for 1*1 m domain, the number-to-number spacing is relatively small enough to the domain size, i.e., there are enough random numbers in the domain. But for smaller domains, for example, 100*100 um domain, the number-to-number spacing is comparable to the domain size, as a result, there are not enough random numbers in the domain. Am I right?
[QUOTE] Hi I believe its a question of understanding then, the random function has a RMS standard deviation in "normal mode" or a boundary limit pk-pk amplitude in "Uniform mode". So if you fill a 1x1 m domain the default settings are ok to cover the full area, if you reduce the area you should also scale the random function accordingly, either by using a variable for the range, or by multiplying your random function by a factor -- Good luck Ivar [/QUOTE] HI, Ivar, thank you! I don't quite understand "by using a variable for the range, or by multiplying your random function by a factor" If my random function is as follows: Number of arguments: 2 Distribution: Uniform mean: 0.5 range: 0.01 This random function is suitable for 1*1 m domain How should I change the random function to make it suitable to 100*100 um domain? Can you give me an example? By the way, I wonder the number-to-number spacing of the random function, for example, for 1*1 m domain, the number-to-number spacing is relatively small enough to the domain size, i.e., there are enough random numbers in the domain. But for smaller domains, for example, 100*100 um domain, the number-to-number spacing is comparable to the domain size, as a result, there are not enough random numbers in the domain. Am I right?

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 1 févr. 2011, 10:57 UTC−5
Hi

I believe I'm not fully understanding your question so you are saying that you have scaled the height (pk-pk value) and average, so OK that is what I was referring to.

But then you talk about a 1x1m domain, how is your domain sampled ?
to know where you are triggering the call to the random function. That is probably on the mesh nodes or even in between depending on the shape function selected.

So I would suggest check your output, refine the mesh and see if its related, is this is pure guess from my side, without a model it's difficult to coordinate ;)

--
Good luck
Ivar
Hi I believe I'm not fully understanding your question so you are saying that you have scaled the height (pk-pk value) and average, so OK that is what I was referring to. But then you talk about a 1x1m domain, how is your domain sampled ? to know where you are triggering the call to the random function. That is probably on the mesh nodes or even in between depending on the shape function selected. So I would suggest check your output, refine the mesh and see if its related, is this is pure guess from my side, without a model it's difficult to coordinate ;) -- Good luck Ivar

Magnus Ringh COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 1 févr. 2011, 11:28 UTC−5
Hi,

The random function's range is the difference between the largest and smallest values that the function can return. A random function of two variables that is called with the space coordinate variables x and y works for any 2D domain. The spacing between the random values is given by the computational mesh.

The reason that the Phase Separation model does not work directly when changing the geometry size by several orders of magnitude is likely that the phase field parameters in the Settings window for the Phase Field Model node are not adapted to the new geometry. For example, the parameter controlling the interface thickness cannot be 0.08 meters if the domain is 0.1 mm by 0.1 mm. The other phase field parameters probably need some scaling as well.

Best regards,
Magnus Ringh, COMSOL
Hi, The random function's range is the difference between the largest and smallest values that the function can return. A random function of two variables that is called with the space coordinate variables x and y works for any 2D domain. The spacing between the random values is given by the computational mesh. The reason that the Phase Separation model does not work directly when changing the geometry size by several orders of magnitude is likely that the phase field parameters in the Settings window for the Phase Field Model node are not adapted to the new geometry. For example, the parameter controlling the interface thickness cannot be 0.08 meters if the domain is 0.1 mm by 0.1 mm. The other phase field parameters probably need some scaling as well. Best regards, Magnus Ringh, COMSOL

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 1 févr. 2011, 17:26 UTC−5

Hi

I believe I'm not fully understanding your question so you are saying that you have scaled the height (pk-pk value) and average, so OK that is what I was referring to.

But then you talk about a 1x1m domain, how is your domain sampled ?
to know where you are triggering the call to the random function. That is probably on the mesh nodes or even in between depending on the shape function selected.

So I would suggest check your output, refine the mesh and see if its related, is this is pure guess from my side, without a model it's difficult to coordinate ;)

--
Good luck
Ivar

Hi, Ivar
for comsol 4, you can see the model "phase separation", in Model Library: Chemical Engineering Module ---Multiphase flow.
keep all of the settings the same but just reduce the domain size to 1 mm, for example, the model will not be computed correctly.
[QUOTE] Hi I believe I'm not fully understanding your question so you are saying that you have scaled the height (pk-pk value) and average, so OK that is what I was referring to. But then you talk about a 1x1m domain, how is your domain sampled ? to know where you are triggering the call to the random function. That is probably on the mesh nodes or even in between depending on the shape function selected. So I would suggest check your output, refine the mesh and see if its related, is this is pure guess from my side, without a model it's difficult to coordinate ;) -- Good luck Ivar [/QUOTE] Hi, Ivar for comsol 4, you can see the model "phase separation", in Model Library: Chemical Engineering Module ---Multiphase flow. keep all of the settings the same but just reduce the domain size to 1 mm, for example, the model will not be computed correctly.

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2 févr. 2011, 01:33 UTC−5
hI

AS mAGNUS IS WRITING, YOU NEED TO CHECK CAREFULLY ALL SETTINGS, SEVERAL ARE DOMAIN SIZE RELATED, AND ALL DO not SCALE READILY (WITHOUT SOME MANUAL INTERVENTION) WITH THE GEOEMTRY SIZE

--
Good luck
Ivar
hI AS mAGNUS IS WRITING, YOU NEED TO CHECK CAREFULLY ALL SETTINGS, SEVERAL ARE DOMAIN SIZE RELATED, AND ALL DO not SCALE READILY (WITHOUT SOME MANUAL INTERVENTION) WITH THE GEOEMTRY SIZE -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2 févr. 2011, 10:10 UTC−5

hI

AS mAGNUS IS WRITING, YOU NEED TO CHECK CAREFULLY ALL SETTINGS, SEVERAL ARE DOMAIN SIZE RELATED, AND ALL DO not SCALE READILY (WITHOUT SOME MANUAL INTERVENTION) WITH THE GEOEMTRY SIZE

--
Good luck
Ivar


Thank you, Ivar, I've got it .
[QUOTE] hI AS mAGNUS IS WRITING, YOU NEED TO CHECK CAREFULLY ALL SETTINGS, SEVERAL ARE DOMAIN SIZE RELATED, AND ALL DO not SCALE READILY (WITHOUT SOME MANUAL INTERVENTION) WITH THE GEOEMTRY SIZE -- Good luck Ivar [/QUOTE] Thank you, Ivar, I've got it .

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2 févr. 2011, 10:40 UTC−5
Hi

I expect you'll manage, there are many menus so it's easily to overlook some.

(sory for the caps lock, didnt notice it was on (I'm cheating time from a workshop ;)

--
Good luck
Ivar
Hi I expect you'll manage, there are many menus so it's easily to overlook some. (sory for the caps lock, didnt notice it was on (I'm cheating time from a workshop ;) -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2 févr. 2011, 15:58 UTC−5

Hi,

The random function's range is the difference between the largest and smallest values that the function can return. A random function of two variables that is called with the space coordinate variables x and y works for any 2D domain. The spacing between the random values is given by the computational mesh.

The reason that the Phase Separation model does not work directly when changing the geometry size by several orders of magnitude is likely that the phase field parameters in the Settings window for the Phase Field Model node are not adapted to the new geometry. For example, the parameter controlling the interface thickness cannot be 0.08 meters if the domain is 0.1 mm by 0.1 mm. The other phase field parameters probably need some scaling as well.

Best regards,
Magnus Ringh, COMSOL


Thank you!
I solve the problem according to your suggestion, thank you !

I have anther question. When I just reduce the geometry size, why the result at time=0 is not the same as the initial condition ( the random function), I thought the result at time=0 should always equal to the initial condition.
[QUOTE] Hi, The random function's range is the difference between the largest and smallest values that the function can return. A random function of two variables that is called with the space coordinate variables x and y works for any 2D domain. The spacing between the random values is given by the computational mesh. The reason that the Phase Separation model does not work directly when changing the geometry size by several orders of magnitude is likely that the phase field parameters in the Settings window for the Phase Field Model node are not adapted to the new geometry. For example, the parameter controlling the interface thickness cannot be 0.08 meters if the domain is 0.1 mm by 0.1 mm. The other phase field parameters probably need some scaling as well. Best regards, Magnus Ringh, COMSOL [/QUOTE] Thank you! I solve the problem according to your suggestion, thank you ! I have anther question. When I just reduce the geometry size, why the result at time=0 is not the same as the initial condition ( the random function), I thought the result at time=0 should always equal to the initial condition.

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 3 févr. 2011, 06:02 UTC−5
Hi

I believe that the initial conditions and the solution at t=0 are not necessarily equal, as initial conditions are not necessarily a "stable" stationary starting point, but I wuld expect that my solution solved at t=0 is coherent an unique

--
Good luck
Ivar
Hi I believe that the initial conditions and the solution at t=0 are not necessarily equal, as initial conditions are not necessarily a "stable" stationary starting point, but I wuld expect that my solution solved at t=0 is coherent an unique -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 3 févr. 2011, 10:05 UTC−5

Hi

I believe that the initial conditions and the solution at t=0 are not necessarily equal, as initial conditions are not necessarily a "stable" stationary starting point, but I wuld expect that my solution solved at t=0 is coherent an unique

--
Good luck
Ivar


Hi, thank you, Ivar
You mean, if the initial condition given is not good enough, as you said not a stable stationary starting point, comsol will do something to make it a stable one, and this stable one will be the solution at t=0 ?
Thank you!
[QUOTE] Hi I believe that the initial conditions and the solution at t=0 are not necessarily equal, as initial conditions are not necessarily a "stable" stationary starting point, but I wuld expect that my solution solved at t=0 is coherent an unique -- Good luck Ivar [/QUOTE] Hi, thank you, Ivar You mean, if the initial condition given is not good enough, as you said not a stable stationary starting point, comsol will do something to make it a stable one, and this stable one will be the solution at t=0 ? Thank you!

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 3 févr. 2011, 13:51 UTC−5
Hi

that is my understanding, but I havent really tested it out.
It is true that in certain cases I run a stationary solution with all t=0 settings, such to be sure I have a fully stabilised starting point , I store the solution and run the transient starting from this first run.

--
Good luck
Ivar
Hi that is my understanding, but I havent really tested it out. It is true that in certain cases I run a stationary solution with all t=0 settings, such to be sure I have a fully stabilised starting point , I store the solution and run the transient starting from this first run. -- Good luck Ivar

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.