Replies: 1 comment
-
The parsed function code is a fork of fparser ( http://warp.povusers.org/FunctionParser/fparser.html ), which does make it easy at the C++ level to hook in other functions (they even offer drand48() as an example!) ... but rand() is an especially tricky sort of function to use. Look at your example. Do you want rand() to be evaluated once for the entire simulation, and then that value gets used for every x and y? (i.e. you've got a trigonometric mode and you're giving it a random amplitude) Or do you want it to be evaluated independently at every quadrature point (i.e. you've got noise and you're giving it a trigonometric amplitude)? The way our parsed functions get evaluated would do the latter, but you almost certainly would want the former - you'd get that by using a single global If you really want noise, I'd look at MOOSE's RandomIC. Getting something that behaves like noise but with a PRNG that can be reliably seeded and that is independent of parallel partitioning (for reproducability) isn't trivial. |
Beta Was this translation helpful? Give feedback.
-
Dear all,
We are working with mooseframework and have been implementing our research in.
Today, we faced the problem of using random functions to define some material properties.
We have been trying for months with no success to define a function where the material properties vary
with coordinates in a random manner.
we want f(x,y,z) = rand() * sin(x) * cos(y) * ...
with rand returning a random value in [0,1[.
in the input file of moose, we could use polynomial and trigonometric functions, but not rand() or similar functions.
When looking in moose files, we think that the possibility of using classical functions is offered by libmesh and wonder how to make
a shortcut to std::rand() to call it in my moose input file as we do with other functions.
regards,
Beta Was this translation helpful? Give feedback.
All reactions