Dear all
How I can add random noise with mean 0 and standard deviation s to the solution u of 3D Stokes problem.
Thanks
Adding stochastic coefficients to a PDE is non-trivial. Could you possibly elaborate on precisely what you're trying to achieve in terms of using FEniCS?
I want to solve the stokes problem to get a solution u for a fixed 3D shape. Then I want to perturb the data u by Gaussian noise to use it as a synthetic data to solve an inverse problem.
If u is your vector you can do
N = u.vector.size() u.vector()[:] = numpy.random.random(N)
Be aware that the mean will then be 0 in l1 rather than L1. If you want it to be zero in L1 you would do something like
c = assemble(u*dx) u.vector()[:] -= c