Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Solving reaction-diffusion system with Theano

I am new to Theano, and I try to implement a numerical integrator of a reaction-diffusion system - FitzHugh–Nagumo model of this version:

enter image description here

enter image description here

For now my expressions are:

import theano as th
import theano.tensor as T

u = T.dmatrix('u')
v = T.dmatrix('v')
e = T.dscalar('e')
a0 = T.dscalar('a0')
a1 = T.dscalar('a1')

dudt = u - u**3 -v
dvdt = e*(u - a1*v - a0)

So I haven't implemented the finite-differences laplacian operator yet. My question is whether there is a smart way of doing it in Theano?

like image 781
Ohm Avatar asked Feb 21 '16 08:02

Ohm


2 Answers

Is there any reason for using Theano? There are other ways in Python to solve a system of coupled non-linear ODEs.

The reaction-diffusion system definition from Google seems to suggest that u(x,y,t), v(x,y,t).

I am not a user of Theano, but it looks like casting the problem in the form of an equation like b = Ax is the way to go.

Some resources that I came across on Google for using Theano and generally solving PDEs are below.

Expressing the Laplacian using Theano

Solving a reaction-diffusion problem using numpy

Github project using Theano to solve the shallow water PDE

like image 197
wandadars Avatar answered Oct 26 '22 17:10

wandadars


An interesting example of a similar, but simpler problem, solved using convolutional networks on Google's tensorflow can be found here:

https://www.tensorflow.org/versions/r0.7/tutorials/pdes/index.html

In particular they use the following definition of the diffusion kernel:

  laplace_k = make_kernel([[0.5, 1.0, 0.5],
                           [1.0, -6., 1.0],
                           [0.5, 1.0, 0.5]])
like image 2
Alessandro Avatar answered Oct 26 '22 17:10

Alessandro