Plot solutions functions of (x,y,t)

Hi!

I have this example in 1D and my question is what are the changes we have to do in 2D when mesh Th = square(N,N,[Lx,Hy]);? Please

meshL Th=segment(Nbx,[x*L,0.]);
int it,itsave;
int Thnv = Th.nv;
fespace Vh(Th,P1);
Vh Vs=x,Is=x,Us=x;
real[int,int] Usave(Thnv,1);
Vsave(:,itsave)=Vs[];
for (real t=0;t<T;t+=dt)1{
 if(!(it%max(1.,1./dt))){
      Vs=V;
      itsave++;
      Usave(:,itsave)=Vs[];
      Usave.resize(Thnv,itsave+1);
   }
   if(!(it%(max(1.,1./dt/2.)))){
      real Vmax,Vmin;
      Vs=V;
      Vmax=Vs[].max; Vmin=Vs[].min;
      Vs[]=Vs[]/Vmax;
      meshL ThmvV=movemesh(Th,[x/L,y+Vs]);/
      plot(ThmvV,dim=2,wait=0,cmm="time: "+t+",V min = "+Vmin+", V max = "+Vmax+");
  }
ofstream foutV("v.txt");
for(int m=0;m<Th.nv;m++) {
   for(int n=0;n<itsave;n++) {
      foutV << Vsave(m,n) << " ";
   }
   foutV<<endl;
}
1 Like