You are on page 1of 1

border C(t=0,2*pi){x=5*cos(t)+1; y=5*sin(t)+2;}

mesh Th = buildmesh(C(100));
plot(Th);
fespace Vh(Th,P2);
Vh u,uold,v;
func f=1;
real m=(5*10^-3), T=0.5, dt=T/30 ;
problem ConvectionDiff(u,v)
= int2d(Th)((u/dt)*v) -int2d(Th)(uold/dt*v)+int2d(Th)((dx(u)*dx(v)+dy(u)*dy(v)))
+
int2d(Th) ((dx(u)+dy(u))*v) +int2d (Th) (m*u*v)
- int2d(Th)( f*v)+ on(C,v=0) ;
for( real t=0;t<T;t=t+dt){ConvectionDiff; plot(u); uold=u;}
**************************************
int n=20, M=4*n;
real x0=0.25, y0=x0, mu=0.05, dt=2*pi/M;
mesh Th=square(n,n,[x*2.-1., y*2.-1.]);
fespace Vh(Th,P2);
Vh u, uu, uold;
problem A(u,uu)=int2d(Th)(u*uu/dt+mu*(dx(u)*dx(uu)+dy(u)*dy(uu)))-int2d(Th)conve
ct([y, -x], -dt,uold)*uu/dt+on(1,2,3,4,u=0);
uold=exp(-50*((x-=x0)^2+(y-y0)^2));
for(int m=0; m<M;m++){
A
plot(u,dim=3d,value=1);
uold=u;
}

You might also like