dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #21892
Re: [Question #148576]: Gaussian random numbers
On Thu, Mar 10, 2011 at 02:30:39PM -0000, Achim Schroll wrote:
> New question #148576 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/148576
>
> Hi,
>
> has the random number generator changed since 0.9.8 ?
>
> in DOLFIN 0.9.8 the instructions following instructions worked fine
>
> from dolfin import *
> from random import *
>
> # random funtion
> class myrand(Expression):
> def eval(self, values, x):
> values[0] = gauss(0,1)
>
> # Create mesh and finite element
> mesh = UnitCircle(60)
> V = FunctionSpace(mesh, "CG", 1)
>
> unoise = Function(V)
> noise = myrand(V=V)
>
> but in the latest version 0.9.10 we get the error:
>
> Calling FFC just-in-time (JIT) compiler, this may take some time.
> Traceback (most recent call last):
> File "noiser.py", line 23, in <module>
> noise = myrand(V=V)
> File "/usr/lib/python2.6/dist-packages/dolfin/function/expression.py", line 146, in __init__
> raise TypeError, "expected only 'kwargs' from one of "\
> TypeError: expected only 'kwargs' from one of 'element', or 'degree'
It's the V=V that is the problem. Just remove that argument and it
should be fine.
--
Anders
Follow ups
References