Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'NDsolve out of memory' topicStudent Support Forum > General > Archives > "NDsolve out of memory"

Help | Reply To Topic
Author Comment/Response
Giorgio
05/29/02 3:29pm

Hi,
I am trying to evaluate the solutions of a system of differential equations using NDSolve. The system is composed by 7 equations. The amount of memory needed to solve it is tremendous, and for I would need to make different simulations starting from different initial conditions, I should run the NDSolve several times, but I run out of memory sometimes on the very first run. I can't even save the results to recall it later, for the same memory problem. I allocated 290 Mb of memory to the Mathkernel, so it seems to me that it should be enough. I just start the kernel and run the NDSolve command, not to have the memory used by storing different variables...
Does anybody have any suggestion? I'm going crazy...

Here below there is the definition of the problem. It seems huge, but if you copy the text and paste it into a notebook it is quite easy.
Thanks in advance
Giorgio

\!\(\*
RowBox[{"sys3", "=",
RowBox[{"{",
RowBox[{
RowBox[{

RowBox[{\(18000\ \[Pi]\^2\ \((rCAy[t] - rCCy[t])\)\),
"-", \(10659.172753176506`\ \((\[Theta]xA[t] - \[Theta]xC[t])\)\),
"+",
RowBox[{"5", " ",
RowBox[{"(",
RowBox[{
RowBox[{\(-0.0000729`\), " ",
RowBox[{"(",
RowBox[{\(0.0000729`\ rCAy[t]\), "+",
RowBox[{"2", " ", \(Cos[40\ ]\), " ",
RowBox[{
SuperscriptBox["rDCz", "\[Prime]",
MultilineFunction->None], "[", "t", "]"}]}]}],
")"}]}], "+",
RowBox[{
SuperscriptBox["rCAy", "\[Prime]\[Prime]",
MultilineFunction->None], "[", "t", "]"}]}], ")"}]}]}],
"==", "0"}], ",",
RowBox[{

RowBox[{\(40500\ \[Pi]\^2\ \((rCBy[t] - rCCy[t])\)\),
"-", \(23983.13869464714`\ \((\[Theta]xB[t] - \[Theta]xC[t])\)\),
"+",
RowBox[{"5", " ",
RowBox[{"(",
RowBox[{
RowBox[{\(-0.0000729`\), " ",
RowBox[{"(",
RowBox[{\(0.0000729`\ rCBy[t]\), "+",
RowBox[{"2", " ", \(Cos[40\ ]\), " ",
RowBox[{
SuperscriptBox["rDCz", "\[Prime]",
MultilineFunction->None], "[", "t", "]"}]}]}],
")"}]}], "+",
RowBox[{
SuperscriptBox["rCBy", "\[Prime]\[Prime]",
MultilineFunction->None], "[", "t", "]"}]}], ")"}]}]}],
"==", "0"}], ",",
RowBox[{

RowBox[{\(18000\ \[Pi]\^2\ \((\(-rCAy[t]\) + rCCy[t])\)\),
"+", \(40500\ \[Pi]\^2\ \((\(-rCBy[t]\) + rCCy[t])\)\),
"-", \(10659.172753176506`\ \((\(-\[Theta]xA[t]\) + \[Theta]xC[
t])\)\),
"-", \(23983.13869464714`\ \((\(-\[Theta]xB[t]\) + \[Theta]xC[
t])\)\), "+",
RowBox[{"30", " ",
RowBox[{"(",
RowBox[{
RowBox[{\(-0.0000729`\), " ",
RowBox[{"(",
RowBox[{\(0.0000729`\ rCCy[t]\), "+",
RowBox[{"2", " ", \(Cos[40\ ]\), " ",
RowBox[{
SuperscriptBox["rDCz", "\[Prime]",
MultilineFunction->None], "[", "t", "]"}]}]}],
")"}]}], "+",
RowBox[{
SuperscriptBox["rCCy", "\[Prime]\[Prime]",
MultilineFunction->None], "[", "t", "]"}]}], ")"}]}]}],
"==", "0"}], ",",
RowBox[{
RowBox[{\(\(294.3`\)\(\[InvisibleSpace]\)\), "+",
RowBox[{"30", " ",
RowBox[{"(",

RowBox[{\(-0.018711742835624733`\),
"-", \(3.1186238059374554`*^-9\ rDCz[t]\), "+",
RowBox[{"0.000111689279806747`", " ",
RowBox[{
SuperscriptBox["rCCy", "\[Prime]",
MultilineFunction->None], "[", "t", "]"}]}], "+",
RowBox[{
SuperscriptBox["rDCz", "\[Prime]\[Prime]",
MultilineFunction->None], "[", "t", "]"}]}], ")"}]}]}],
"==", "0"}], ",",
RowBox[{

RowBox[{\(10659.172753176506`\ \((\(-rCAy[t]\) + rCCy[t] +
0.06`\ \((\[Theta]xA[t] - \[Theta]xC[t])\))\)\),
"+", \(9.593255477858854`\ \((\[Theta]xA[t] - \[Theta]xC[t])\)\),
"+",
RowBox[{"0.009`", " ",
RowBox[{
SuperscriptBox["\[Theta]xA", "\[Prime]\[Prime]",
MultilineFunction->None], "[", "t", "]"}]}]}], "==", "0"}],
",",
RowBox[{
RowBox[{\(23983.13869464714`\ \((\(-rCBy[t]\) + rCCy[t] +
0.06`\ \((\[Theta]xB[t] - \[Theta]xC[t])\))\)\),
"+", \(9.593255477858854`\ \((\[Theta]xB[t] - \[Theta]xC[t])\)\),
"+",
RowBox[{"0.009`", " ",
RowBox[{
SuperscriptBox["\[Theta]xB", "\[Prime]\[Prime]",
MultilineFunction->None], "[", "t", "]"}]}]}], "==", "0"}],
",",
RowBox[{

RowBox[{\(10659.172753176506`\ \((rCAy[t] - rCCy[t])\)\),
"+", \(23983.13869464714`\ \((rCBy[t] - rCCy[t])\)\),
"-", \(649.1436206684492`\ \[Theta]xA[t]\),
"-", \(1448.581577156687`\ \[Theta]xB[t]\),
"+", \(2097.725197825136`\ \[Theta]xC[t]\), "+",
RowBox[{
SuperscriptBox["\[Theta]xC", "\[Prime]\[Prime]",
MultilineFunction->None], "[", "t", "]"}]}], "==", "0"}]}],
"}"}]}]\)


time = 100

sol = NDSolve[{sys3,
rCAy[0] == 0, rCAy'[0] == 0.001,
rCBy[0] == 0, rCBy'[0] == -0.004,
rCCy[0] == 0, rCCy'[0] == 0,
rDCz[0] == 4000, rDCz'[0] == 0,
\[Theta]xA[0] == 0, \[Theta]xA'[0] == 0.001,
\[Theta]xB[0] == 0, \[Theta]xB'[0] == -0.002,
\[Theta]xC[0] == 0, \[Theta]xC'[0] == 0.01}, {rCAy[t], rCBy[t], rCCy[t],
rDCz[t], \[Theta]xA[t], \[Theta]xB[t], \[Theta]xC[t]}, {t, 0, time},
MaxSteps -> 250000, AccuracyGoal -> Automatic]


URL: ,
Help | Reply To Topic