Skip to main content Skip to footer site map
Reza Malek-Madani

The Rayleigh-Benard Flow

eps=0.1;omega=6;
psi[x_, z_,t_] = Sin[Pi*x]*Sin[Pi*z]+eps*Cos[omega*t]*Cos[Pi*x]*Sin[Pi*z];
f[x_,z_,t_]=D[psi[x,z,t],z]; g[x_,z_,t_]=-D[psi[x,z,t],x];

sol1[a_, b_,tfinal_]:=NDSolve[{x'[t]==f[x[t],z[t],t],z'[t]==g[x[t],z[t],t],
x[0]==a, z[0]==b}, {x,z}, {t,0,tfinal}, MaxSteps->5000];
rightexit={};leftexit={};
Do[a=0.01+i/20; b=0.01;solution=sol1[a,b, 40];
aa=ToString[a]; bb=ToString[b];
llabel=StringJoin["(",aa,",",bb,")"];
Clear[c,average,x1, domain,range,tpositive,tnegative];
x1[t_]=First[x[t]-1.000001/. solution];
domain=Table[t,{t,0,40, 0.1}];
range=x1[domain];
testrange=Table[range[[i]]*range[[i+1]], {i, Length[range]-1}];
Catch[Do[index=i;
If[testrange[[i]]<0, Throw[i]]; , {i, Length[testrange]}]];
If[range[[index]]<0,tnegative=domain[[index]],tnegative=domain[[index+1]]];
If[range[[index]]<0,tpositive=domain[[index+1]],tpositive=domain[[index]]];
Do[average=(tpositive+tnegative)/2;c=x1[average];
If[c < 0, tnegative=average, tpositive=average],{i, 50}];
ExitToRight=average; 
rightexit=Append[rightexit, {a, b, ExitToRight}];
x2[t_]=First[x[t]-0.00001/. solution];
Plot[x2[t], {t, 0, 40}, PlotPoints->500,
PlotLabel->StringJoin["x(t) with x(0) = ", aa]];
domain=Table[t,{t,0,40, 0.1}];
range=x2[domain]; 
testrange=Table[range[[i]]*range[[i+1]], {i, Length[range]-1}];Catch[Do[index=i;
If[testrange[[i]]<0, Throw[i]]; , {i, Length[testrange]}]];
If[range[[index]]<0,tnegative=domain[[index]],tnegative=domain[[index+1]]];
If[range[[index]]<0,tpositive=domain[[index+1]],tpositive=domain[[index]]];
Do[average=(tpositive+tnegative)/2;c=x2[average];
If[c < 0, tnegative=average, tpositive=average],{i, 50}];
ExitToLeft=average;
Print[llabel," exits to the cell on the right at t = ", ExitToRight];
Print[llabel," exits to the cell on the left at t = ", ExitToLeft];
leftexit=Append[leftexit, {a, b, ExitToLeft}],
{i, 1, 19}];
ExitTime=Table[Min[rightexit[[i,3]],leftexit[[i,3]]], {i,Length[leftexit]}];
graph1=ListPlot[ExitTime, PlotJoined->True, PlotRange->All, AxesOrigin->{0,0},
PlotLabel-> StringJoin["Exit time of particles located at z = ", bb]]

[Graphics:rayleigh-benardgr2.gif][Graphics:rayleigh-benardgr1.gif]

[Graphics:rayleigh-benardgr3.gif]

[Graphics:rayleigh-benardgr4.gif][Graphics:rayleigh-benardgr2.gif]

[Graphics:rayleigh-benardgr5.gif][Graphics:rayleigh-benardgr2.gif]

[Graphics:rayleigh-benardgr6.gif][Graphics:rayleigh-benardgr2.gif]

[Graphics:rayleigh-benardgr7.gif][Graphics:rayleigh-benardgr2.gif]

[Graphics:rayleigh-benardgr8.gif][Graphics:rayleigh-benardgr2.gif]

[Graphics:rayleigh-benardgr9.gif]

[Graphics:rayleigh-benardgr10.gif]

[Graphics:rayleigh-benardgr11.gif][Graphics:rayleigh-benardgr2.gif]

[Graphics:rayleigh-benardgr12.gif][Graphics:rayleigh-benardgr2.gif]

[Graphics:rayleigh-benardgr13.gif]

[Graphics:rayleigh-benardgr14.gif][Graphics:rayleigh-benardgr2.gif]

[Graphics:rayleigh-benardgr15.gif]

[Graphics:rayleigh-benardgr16.gif]

[Graphics:rayleigh-benardgr17.gif][Graphics:rayleigh-benardgr2.gif]

[Graphics:rayleigh-benardgr18.gif][Graphics:rayleigh-benardgr2.gif]

[Graphics:rayleigh-benardgr19.gif]

[Graphics:rayleigh-benardgr20.gif]

[Graphics:rayleigh-benardgr2.gif][Graphics:rayleigh-benardgr21.gif][Graphics:rayleigh-benardgr2.gif]

[Graphics:rayleigh-benardgr22.gif]

[Graphics:rayleigh-benardgr23.gif][Graphics:rayleigh-benardgr2.gif]

[Graphics:rayleigh-benardgr24.gif][Graphics:rayleigh-benardgr2.gif]

[Graphics:rayleigh-benardgr25.gif]

[Graphics:rayleigh-benardgr26.gif][Graphics:rayleigh-benardgr2.gif]

[Graphics:rayleigh-benardgr27.gif][Graphics:rayleigh-benardgr2.gif]

[Graphics:rayleigh-benardgr28.gif]

[Graphics:rayleigh-benardgr29.gif][Graphics:rayleigh-benardgr2.gif]

[Graphics:rayleigh-benardgr30.gif][Graphics:rayleigh-benardgr2.gif]

[Graphics:rayleigh-benardgr31.gif]

[Graphics:rayleigh-benardgr32.gif]

[Graphics:rayleigh-benardgr33.gif][Graphics:rayleigh-benardgr2.gif]

[Graphics:rayleigh-benardgr34.gif]

[Graphics:rayleigh-benardgr35.gif]

[Graphics:rayleigh-benardgr36.gif][Graphics:rayleigh-benardgr2.gif]

[Graphics:rayleigh-benardgr37.gif]

[Graphics:rayleigh-benardgr38.gif]

[Graphics:rayleigh-benardgr39.gif][Graphics:rayleigh-benardgr2.gif]

[Graphics:rayleigh-benardgr40.gif]

[Graphics:rayleigh-benardgr41.gif]

[Graphics:rayleigh-benardgr42.gif]

[Graphics:rayleigh-benardgr43.gif]

[Graphics:rayleigh-benardgr44.gif]

[Graphics:rayleigh-benardgr45.gif][Graphics:rayleigh-benardgr2.gif]

[Graphics:rayleigh-benardgr46.gif]

[Graphics:rayleigh-benardgr47.gif]

[Graphics:rayleigh-benardgr48.gif]

[Graphics:rayleigh-benardgr49.gif]

[Graphics:rayleigh-benardgr50.gif]

[Graphics:rayleigh-benardgr51.gif][Graphics:rayleigh-benardgr2.gif]

[Graphics:rayleigh-benardgr52.gif]

[Graphics:rayleigh-benardgr53.gif]

[Graphics:rayleigh-benardgr54.gif]

[Graphics:rayleigh-benardgr55.gif]

[Graphics:rayleigh-benardgr56.gif]

[Graphics:rayleigh-benardgr57.gif]

[Graphics:rayleigh-benardgr58.gif]

[Graphics:rayleigh-benardgr59.gif][Graphics:rayleigh-benardgr2.gif]

[Graphics:rayleigh-benardgr60.gif][Graphics:rayleigh-benardgr2.gif][Graphics:rayleigh-benardgr61.gif]

go to Top