No more memory available... when using ExplicitEuler method for Diffusion equations in Mathematica NDSolve
- To: mathgroup at smc.vnet.net
- Subject: [mg47430] No more memory available... when using ExplicitEuler method for Diffusion equations in Mathematica NDSolve
- From: Dharmesh <dharmesh at cc.usu.edu>
- Date: Sun, 11 Apr 2004 04:44:07 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
This is my first message to the math group, and I am really new to Mathematica
as well. I would really appreciate if someone could help me with this, as I
did not find much help in the documentation or the forum regarding my problem.
Here are the details:
I have these three diffusion equations that I need to solve using the NDSolve
function.
solution = {r, a, s} /. First[NDSolve[{D[r[x,t], t] == -r[x,t] + ó[(s[x,t] -
a[x,t] + g[x,t] - Subscript[c, r])/Subscript[b, r]],
Subscript[ô,a]*D[a[x,t],t] == D[a[x,t], x, x] - a[x,t] + ë*ó[(s[x, t] - a[x,
t] + g[x,t] - Subscript[c, a])/Subscript[b, a]],
Subscript[ô,s]*D[s[x,t],t] == ep^2*D[s[x, t],x,x] - s[x,t] + r[x,t],
r[-5,t] == 0, r[x,0] == 0, r[5,t] == 0, a[-5,t] == 0, a[x,0] == 0, a[5,t] ==
0, s[-5,t] == 0, s[x,0] == 0, s[5,t] == 0},
{r,a,s}, {x,-5,5}, {t,0,150}, MaxStepSize -> {0.025,0.05}, PrecisionGoal ->
5]];
The above line works in Mathematica and I am able to generate plots (within
seconds). However, I want to solve the above equations using the ExplicitEuler
technique (Method->"ExplicitEuler"). The moment I add this to my NDSolve, it
starts giving me "No more memory available ...". My PC configuration is
Pentium 4, 3 GHz processor, 1 GB RAM. In a desperate attempt, I even tried to
reduce the time range to 0-5, with no results. Is there a way I can solve this
problem?
The initializations required for the above equations are:
ó[(i_)?Negative] := 0;
ó[(i_)?Positive] := i^2/(1 + i^2);
g[x_, t_] := Evaluate[(Subscript[g, 0]*(1 - E^(-(t/Subscript[ô,
g]))))/E^(x^2/Subscript[x, 0]^2)];
Subscript[c, a] = 0.5;
Subscript[c, r] = 0.4;
Subscript[b, r] = 0.2;
Subscript[b, a] = 0.05;
ë = 1.6;
Subscript[ô, s] = 0.1;
Subscript[ô, a] = 1;
ep = 0.1;
Subscript[g, 0] = 1;
Subscript[x, 0] = 3;
Subscript[ô, g] = 40;
The code to display the plots is:
ContourPlot[solution[[1]] [x, t], {x, -5, 5}, {t, 0, 150}, PlotLabel ->
"Rhomboid"];
Plot3D[solution[[2]] [x, t], {x, -5, 5}, {t, 0, 150}, PlotLabel -> "Argos"];
Plot3D[solution[[3]] [x, t], {x, -5, 5}, {t, 0, 150}, PlotLabel -> "Spitz"];
Also, Is there a way I can use different techniques to solve different
differential equations in the same NDSolve? You might want to convert the
above code into Standard or Traditional form for an easier view.
Thanking you in anticipation.
Dharmesh.