Tatiana
Tatiana

Reputation: 113

Freefem Fisher's equation

I'm new with Freefem++, the problem I'm trying to solve is Fisher's equation:

du/dt = d^2u/dx^2 + d^2u/dy^2 + k * u * (1-u)

du/dn = 0 - border condition

I've tried to reformulate the problem in weak form, however Freefem shows a mistake with formula:

problem Fisher(uh, vh) = int2d(Th)(uh * vh/dt + Grad(uh)' * Grad(vh) ) - int2d(Th)(k * uh * vh) + int2d(Th)(uh0 * vh/dt) - int2d(Th)(k * uh * vh * uh);

Could you please tell what I do wrong? Something is wrong with last terms.

Upvotes: 0

Views: 980

Answers (2)

Tatiana
Tatiana

Reputation: 113

The easiest way to model Fisher's equations is to linearize the nonlinear part so that the computational method stays stable. In our case it means that in discrete formulations we replace the term u_i(1 - u_i) with u_{i-1}(1 - u_i) (where i is time counter) and choose attentively the space and time steps. Here I provide an example of resulting code:

verbosity=0.;
real Dx=.1,Dy=.1; 
mesh Th=square(floor(10./Dx),floor(10./Dy), [-5 + 10*x, -5 + 10*y]);
fespace Vh(Th,P1);
Vh uh, vh, uh0 = ((x)^2+(y)^2)<=1; 

real mu = 0.1, dt=0.01, Tf=10., k = 3.0;
macro Grad(u)[dx(u),dy(u)]//

problem KFisher(uh,vh) = int2d(Th)(uh*vh/dt + Grad(uh)'*Grad(vh)*mu) - int2d(Th)(uh0*vh/dt) + int2d(Th)(k*uh0*uh*vh) - int2d(Th)(k*vh*uh0);

for (real t=0.;t<Tf;t+=dt)  
{
  KFisher;
  uh0 = uh;
  plot(uh0, cmm="t="+t+"[sec]", dim=2, fill=true, value=true, wait=0); 
}

Upvotes: 0

duffymo
duffymo

Reputation: 308938

This is a 2D transient diffusion/conduction equation with a temperature-dependent, non-linear generation term.

If you leave off the non-linear generation term, the equations should look exactly like the weak form for the 2D transient diffusion/conduction equation.

How does freefem++ linearize that non-linear term? How did you plan to handle it?

You realize, of course, that the last term makes the solution a very different animal. You have to use iteration within time steps to solve it (e.g. a Newton-Raphson solver).

The algorithm becomes an iterative, non-linear one. You won't solve for u anymore; you'll solve for an increment du and iterate until convergence.

You linearize the last term like this:

d(k*u(1-u)) = k*du(1-u) - k*u*du = k*(1-2*u)*du ~ k*du

You still have a product u*du that's non-linear. What to do? Throw it away.

Now you're solving a non-linear transient equation for du.

Upvotes: 0

Related Questions