SAWT - Canal ouvert à droite-3.sce.txt
Transcription
SAWT - Canal ouvert à droite-3.sce.txt
0001 // Linear small amplitude wave theory - deep water 0002 // Canal ouvert à droite 0003 clf() 0004 LONG=10; // longueur du canal 0005 a=0.1;// amplitide de 'londe 0006 0007 b=get("current_axes"); 0008 b.data_bounds=[0,-1;10,0.6]; 0009 c=b.children 0010 // fixer la couleur du champ de vecteur à "blanc" 0011 f=gcf() 0012 f.color_map=wintercolormap(32) 0013 0014 title('Linear small amplitude wave theory - deep water','position',[0.5 0.5],'fontsize',3) 0015 0016 g=9;81 // gravite 0017 T=1; // période de l'onde 0018 d=0.5; //profondeur d'eau 0019 0020 C=sqrt(g*d);// célérité de l'onde 0021 L=T*C;//longueur d'onde 0022 k=2*%pi/L ;// nombre d'onde 0023 x=0:0.1:LONG //discrétisation suivant x 0024 sigma=2*%pi/T // fréquence 0025 agksursigma=a*g*k/sigma 0026 //couleurs des aires des courbes 0027 id1=color('white') 0028 id2=color(0,191,255) 0029 0030 //============================================================================== 0031 i=0 0032 //boucle en temps 0033 for t=0:0.1:1 0034 i=i+1 0035 if i<>1 then yprec=y; end 0036 y=a*cos(k*x-sigma*t) 0037 if i==1 then yprec=y; end 0038 xfpolys([x';LONG;0],[yprec';-1;-1],[id1]) 0039 plot(x',yprec',"w") 0040 xfpolys([x';LONG;0],[y';-1;-1],[id2]) 0041 deltay=max(y,yprec) 0042 num=string(i) 0043 xs2gif(0,'SAWT'+num+'.gif'); 0044 xpause(100000); 0045 0046 title('Linear small amplitude wave theory - deep water : '+num+ ' sec','position',[0.5 0.5],'fontsize',3) 0047 0048 plot2d(x',y') 0049 0050 // dessin des vecteurs vitesse 0051 0052 0053 yvect=[-0.9:0.2:0];xvect=[1 2 3 4 5 6 7 8 9] 0054 fvarx=agksursigma*cos(k*xvect-sigma*t) 0055 fvary=agksursigma*sin(k*xvect-sigma*t) 0056 fprof=exp(k*yvect) 0057 fx=fvarx'*fprof 0058 fy=fvary'*fprof 0059 champ(xvect',yvect',fx,fy,arfact=1) 0060 0061 //GIF export 0062 xs2gif(0,'SAWT'+string(i)+'.gif'); 0063 0064 0065 // longueur des vecteurs vitesse 0066 lv=sqrt(fx.*fx+fy.*fy) 0067 delete() 0068 end