// P.-Y. LAGREE & O. DEVAUCHELLE // FEBRUARY 2007 // PASSAGE A GMRES int AspectRatioH=6,n=0; real W=1,L=W*AspectRatioH; real slope=.05,R=120; real beta=5,gamma=1; real epsilon=.1,kx=2*pi/L,ky=pi/W; real dt=.001,t=0,theta=.5; real etam; int npty=10,nptx=npty*AspectRatioH; mesh Th=square(nptx,npty,[-L/2+L*x,-W/2+W*y]); plot(Th,wait=0); //fespace Vh(Th,P1,periodic=[[2,y],[4,y],[1,x],[3,x]]); fespace Vh(Th,P2,periodic=[[2,y],[4,y]]); Vh eta,etatest,hs,hstest; Vh h,h2,h3; Vh taux,tauy,normtau,charru; Vh dxeta,dyeta; Vh dxh,dyh; Vh f,dxf,dyf,dxftest,dyftest,pyl,c; real dhm; real cpu=clock(); real epsg=1e-15; real seed=0.123; //h=-1+epsilon*sin(ky*y); h=-1-epsilon*sin(kx*x)*sin(ky*y); h=-1+epsilon/2-epsilon*exp(-(y-0.05*sin(kx*x))^2*20); h=-1; { for(int i=1;i<10;i++) {int is; seed = (seed+pi)^3; is=seed; seed = (seed - is)*((-1)^is); cout << i<< " " << seed << " " << is << endl; h = h + 0.1*epsilon*seed*sin(2*pi*seed+i*pi/L*x); h = h + 0.1*epsilon*seed *sin(2*pi*seed+i*pi/W*y); } } plot(h,wait=1); //h=-1+epsilon*sin(kx*x); //h=-1+epsilon*exp(-(2*x/L)^2-(2*y/W)^2); problem fluid(eta,etatest,solver=GMRES,eps=epsg) = - int2d(Th)(h3*dx(eta)*dx(etatest) + h3*dy(eta)*dy(etatest)) + int2d(Th)(R*3*h2*slope*etatest*dx(eta)) + int2d(Th)((R*h3)*dx(etatest)) ; problem derivation(dxf,dyf,dxftest,dyftest,solver=GMRES,eps=epsg) = int2d(Th)(dxf*dxftest + dyf*dyftest) + int2d(Th)(f*dx(dxftest) + f*dy(dyftest)) + int1d(Th,1,3)(-f*dxftest*N.x-f*dyftest*N.y) ; problem sediment(hs,hstest,solver=GMRES,eps=epsg) = - int2d(Th)(h*hstest/dt) + int2d(Th)(hs*hstest/dt) - int2d(Th)(charru*(taux*dx(hstest)+tauy*dy(hstest))) + int2d(Th)(normtau*charru*(1-theta)*gamma/R*(dxh*dx(hstest)+dyh*dy(hstest))) + int2d(Th)(normtau*charru*theta*gamma/R*(dx(hs)*dx(hstest)+dy(hs)*dy(hstest))) + int1d(Th,1,3)(charru*hstest*N.y*tauy) - int1d(Th,1,3)(charru*hstest*gamma/R*normtau*(1-theta)*N.y*dyh) ; while(t<100) { if(n%20==0) { plot(h,value=1,cmm="h at t = "+t+" dhm= "+dhm,fill=1,wait=0,ps="storage/t_"+t+"_R_"+R+"_slope_"+slope+".eps"); ofstream file("storage/t_"+t+"_R_"+R+"_slope_"+slope+".dat"); for(int i=0;i>>>>>>>>>>>>>>>>>>>> dhm =" << dhm << endl; h=hs; t=t+dt; } cout << " CPU time = " << clock()-cpu << endl; /* -- Olivier Devauchelle Laboratoire de Modélisation en Mécanique UPMC, 4 place Jussieu, case 162 75252 PARIS Cedex 05 FRANCE TÃA ©l: +33 1 44 27 87 16 */