Dear Angwenyi,
  For an ensemble filtering approach, please can you talk to my student Ali Gregory about how he did it?
http://www.imperial.ac.uk/people/a.gregory14

If you are working with an ensemble, then one approach is to use a list of Firedrake fields for the different states. Then, the Kalman update needs to be implemented through a PyOP2 parloop. Ali can help you with this (he has done it for the ETPF).

all the best
--cjc

On 27 June 2016 at 12:16, Angwenyi David <kipkoej@gmail.com> wrote:
The numpy random number generator works! Thanks Colin.

Angwenyi
On 27 Jun 2016, at 09:16, Angwenyi David <kipkoej@gmail.com> wrote:

Thanks, Collins.

Could you please, if it won’t matter to you, send me the code for the stochastic quasi geostrophic equation you implemented. It shall help me a great deal. 

How about implementing a Kalman filter with the system of equations 3.3 and 3.4 as a model equations with given data? I presume it is possible; for the system can be represented as psi^(n+1)=A^(n)*psi^(n)+noise. The complication I see is having the spatial discretisation of phi fit into the matrix A. Links to the articles with similar problems are appreciated.

Thanks.

Angwenyi

On 27 Jun 2016, at 08:12, Colin Cotter <colin.cotter@imperial.ac.uk> wrote:

Hi! 

Yes, you can just use the numpy random number generator to write to the basis coefficients for this.

from numpy import random

F = Function(V)
F.dat.data[:] = random.randn(N)

etc.

The main thing you have to be careful of is MPI parallelism.

We have been using this to implement a stochastic QG equation for example.

It might be nice to integrate random number generators into TSFL generated code so that we can use them directly in UFL expressions - that would tidy up a lot of our code (and help make it more parallel safe).

cheers
--cjc

On 26 June 2016 at 21:27, Angwenyi David <kipkoej@gmail.com> wrote:
Thanks, Francis.

True, the DE is driven by white noise, that is, I assume it is gaussian with zero mean vector and identity covariance matrix premultiplied by the square root of the time-step.
On 26 Jun 2016, at 22:16, Francis Poulin <fpoulin@uwaterloo.ca> wrote:

Hello,

I can't say whether there is anything specific to firedrake but I can say that in general it depends on what kind of noise you are considering in the SDE.

If you are using coloured noise, then you treat your forcing term as you would any other term.  However, given the fact that you are using W I imagine you are using White noise.

In that case the popular thing to do is to use a splitting method.  For the "regular" deterministic terms, you use whatever time stepping scheme you normally would use. However, for the white noise you probably want to use an Euler step.  Basically, that means you have square root of dt in front of the random variable.  The stochastic part is only first order accurate but it's much easier than using other techniques, but they do exist.  

Anyhow, that's my two cents worth.

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 Angwenyi David [kipkoej@gmail.com]
Sent: Sunday, June 26, 2016 4:11 PM
To: firedrake@imperial.ac.uk
Subject: [firedrake] Stochastic differential equations

Dear all,

Is it possible to solve pdes driven by some noise using Firedrake? For example, see equation 3.2 in the attachment whose discretisation yields a system 3.3 and 3.4, where dW(t):=sqrt(dt)N(0,Identity). My other related concern is whether It is possible to implement, say, A Kalman filter with equation 3.2 as model equation on Firedrake.

Thanks in advance.

Angwenyi David
<Screen Shot 2016-06-26 at 21.51.52.png>
_______________________________________________
firedrake mailing list
firedrake@imperial.ac.uk
https://mailman.ic.ac.uk/mailman/listinfo/firedrake




--
_______________________________________________
firedrake mailing list
firedrake@imperial.ac.uk
https://mailman.ic.ac.uk/mailman/listinfo/firedrake





--
http://www.imperial.ac.uk/people/colin.cotter

www.cambridge.org/9781107663916