Dear Lawrence,

Thanks, that worked very nicely. 

I will think of what I can add to the issues page.

Cheers, Francis


------------------
Francis Poulin                    
Associate Professor
Department of Applied Mathematics
University of Waterloo

email:           fpoulin@uwaterloo.ca
Web:            https://uwaterloo.ca/poulin-research-group/
Telephone:  +1 519 888 4567 x32637


From: firedrake-bounces@imperial.ac.uk [firedrake-bounces@imperial.ac.uk] on behalf of Lawrence Mitchell [lawrence.mitchell@imperial.ac.uk]
Sent: Tuesday, April 26, 2016 3:15 AM
To: firedrake@imperial.ac.uk
Subject: Re: [firedrake] how to set up random initial conditions?


Dear Francis,

On 26 Apr 2016, at 02:38, Francis Poulin <fpoulin@uwaterloo.ca> wrote:

q0.dat.data[:] += 0.01*np.random.randn(*q0.dat.shape)

However, when I try running it using mpirun on my mac it fails because the declaration of a random variable is not broadcast.

: operands could not be broadcast together with shapes (2500,) (2724,) (2500,) 

ValueError: operands could not be broadcast together with shapes (2500,) (2908,) (2500,) 


This occurs because the shape includes the ghost or halo region of the data, whereas the left hand side array is only the local portion. Please try using:

q0.dof_dset.size

For the number of values. 

We should probably document this kind of stuff more clearly. If you have any comments feel free to add them here: https://github.com/firedrakeproject/firedrake/issues/761

Thanks,

Lawrence