Hello all, I'm trying to find a nice and neat way to numerically solve the convective diffusion equation da/dt = D (d^2/dx^2 + d^2/dy^2) a - v da/dx where a is the concentration of my solute, D is the diffusion constant, and v is the surrounding fluid velocity in the x direction. I thought that there was a small chance that maybe someone else here has attempted something similar. Is it even possible to solve this equation? As always, any suggestions would be much appreciated. Cheers, Dan
dantimatter wrote: > Hello all, > > I'm trying to find a nice and neat way to numerically solve the > convective diffusion equation > > da/dt = D (d^2/dx^2 + d^2/dy^2) a - v da/dx > > where a is the concentration of my solute, D is the diffusion > constant, and v is the surrounding fluid velocity in the x direction. > I thought that there was a small chance that maybe someone else here > has attempted something similar. > Is it even possible to solve this equation? As always, any suggestions > would be much appreciated. > > Cheers, > Dan Oliver Rübenkönig's "Finite Elements for Convection-Diffusion equations" might be worth reading: http://www.imtek.uni-freiburg.de/simulation/mathematica/IMSweb/imsTOC/Application%20Examples/Finite%20Element%20Method/AnemometerAnalysisDocu.html Also, you should have a look at the _IMTEK Mathematica Supplement_ (IMS) http://www.imtek.uni-freiburg.de/simulation/mathematica/IMSweb/ HTH, Jean-Marc
Hi, With[{\[ScriptCapitalD] = 1/8, v = 1/4}, sol = NDSolve[{ D[u[x, y, t], t] == \[ScriptCapitalD] (D[u[x, y, t], {x, 2}] + D[u[x, y, t], {y, 2}]) - v*D[u[x, y, t], x], u[-1, y, t] == 0, u[1, y, t] == 0, u[x, -1, t] == 0, u[x, 1, t] == 0, u[x, y, 0] == Piecewise[{{1, Sqrt[x^2 + y^2] <= 0.5}}, 0]}, u[x, y, t], {x, -1, 1}, {y, -1, 1}, {t, 0, 2} ] ] may do that .. Ignore the warnings you get with the statement above, the reason are the initial conditions and you may have other. Regards Jens dantimatter wrote: > Hello all, > > I'm trying to find a nice and neat way to numerically solve the > convective diffusion equation > > da/dt = D (d^2/dx^2 + d^2/dy^2) a - v da/dx > > where a is the concentration of my solute, D is the diffusion > constant, and v is the surrounding fluid velocity in the x direction. > I thought that there was a small chance that maybe someone else here > has attempted something similar. > Is it even possible to solve this equation? As always, any suggestions > would be much appreciated. > > Cheers, > Dan > >
> With[{\[ScriptCapitalD] = 1/8, v = 1/4}, > sol = NDSolve[{ > D[u[x, y, t], > t] == \[ScriptCapitalD] (D[u[x, y, t], {x, 2}] + > D[u[x, y, t], {y, 2}]) - v*D[u[x, y, t], x], > u[-1, y, t] == 0, u[1, y, t] == 0, > u[x, -1, t] == 0, u[x, 1, t] == 0, > u[x, y, 0] == Piecewise[{{1, Sqrt[x^2 + y^2] <= 0.5}}, 0]}, > u[x, y, t], {x, -1, 1}, {y, -1, 1}, {t, 0, 2} > ] > ] > > may do that .. Ignore the warnings you get with the > statement above, the reason are the initial conditions > and you may have other. Hi Jens, I wasn't able to plot the result. Have you tried this and successfully plotted it? Cheers, Dan
> With[{\[ScriptCapitalD] = 1/8, v = 1/4}, > sol = NDSolve[{ > D[u[x, y, t], > t] == \[ScriptCapitalD] (D[u[x, y, t], {x, 2}] + > D[u[x, y, t], {y, 2}]) - v*D[u[x, y, t], x], > u[-1, y, t] == 0, u[1, y, t] == 0, > u[x, -1, t] == 0, u[x, 1, t] == 0, > u[x, y, 0] == Piecewise[{{1, Sqrt[x^2 + y^2] <= 0.5}}, 0]}, > u[x, y, t], {x, -1, 1}, {y, -1, 1}, {t, 0, 2} > ] > ] ok, so i got the above to work when i ran it on a more powerful machine. thanks for the advice. the problem i'm having now is in defining the boundary conditions. what i'd like is to have a circular 'source' at which the concentration is always constant, but i don't know about any of the other boundaries. i guess i could say that the concentration is zero at infinity. any advice on how to implement these boundary conditions?? many thanks, dan
Sorry for interfering, but I had a similar question before. Using the procedure of Jens in the form s = First[With[{\[ScriptCapitalD] = 1/8, v = 1/4}, sol = NDSolve[{D[u[x, y, t], t] == \[ScriptCapitalD]*(D[u[x, y, t], {x, 2}] + D[u[x, y, t], {y, 2}]) - v*D[u[x, y, t], x], u[-1, y, t] == 0, u[1, y, t] == 0, u[x, -1, t] == 0, u[x, 1, t] == 0, u[x, y, 0] == Piecewise[ {{1, Sqrt[x^2 + y^2] <= 0.5}}, 0]}, u[x, y, t], {x, -1, 1}, {y, -1, 1}, {t, 0, 2}]]] {u[x, y, t] -> InterpolatingFunction[][x, y, t]} extractiing the solution into a function h h[x_, y_, t_] = u[x, y, t] /. s InterpolatingFunction[][x, y, t] and finally plotting the result using t = 1; Plot3D[h[x, y, t], {x, -1, 1}, {y, -1, 1}] or the sequence For[t = 1, t <= 2, t = t + 0.1, Plot3D[h[x, y, t], {x, -1, 1}, {y, -1, 1}, PlotRange -> {0, 0.45}]] looks very nice. Best regards, Wolfgang "dantimatter" <dantimatter@gmail.com> schrieb im Newsbeitrag news:f943hn$m56$1@smc.vnet.net... > >> With[{\[ScriptCapitalD] = 1/8, v = 1/4}, >> sol = NDSolve[{ >> D[u[x, y, t], >> t] == \[ScriptCapitalD] (D[u[x, y, t], {x, 2}] + >> D[u[x, y, t], {y, 2}]) - v*D[u[x, y, t], x], >> u[-1, y, t] == 0, u[1, y, t] == 0, >> u[x, -1, t] == 0, u[x, 1, t] == 0, >> u[x, y, 0] == Piecewise[{{1, Sqrt[x^2 + y^2] <= 0.5}}, 0]}, >> u[x, y, t], {x, -1, 1}, {y, -1, 1}, {t, 0, 2} >> ] >> ] >> >> may do that .. Ignore the warnings you get with the >> statement above, the reason are the initial conditions >> and you may have other. > > Hi Jens, > > I wasn't able to plot the result. Have you tried this and > successfully plotted it? > > Cheers, > Dan > >