Simultaneously solving a PDE and ODE

Hello,

I am a new user to Mathematica and I am trying to use the NDSolve function to solve two differential equations. One of the differential equations is an ODE(only time derivative) while the other one is a PDE(both space(1D) and time time derivative).

The solution of the PDE is used at a particular point in space in the ODE. The ODE then updates the value for that point in the next time step and the solution progresses. This is the expected result.

My implementation is attached in the PDF file and presented here in the code block as per the reply below. I apologise if this is not the correct way to write the code block but if you copy-paste the entire block in Mathematica, it will allow you to read it as a notebook expression.

Notebook[{ Cell[“CONSTANT PARAMETERS”, “Text”,
CellChangeTimes->{{3.651500891704664*^9, 3.651500917904028*^9}, {
3.651500950742855*^9, 3.651501004003824*^9}}],

Cell[BoxData[{ RowBox[{“rhol”, “:=”, “1000”}], “[IndentingNewLine]”,
RowBox[{“rhov”, " “, “:=”, “1.2”}], “[IndentingNewLine]”,
RowBox[{“To”, “:=”, “373”}], “[IndentingNewLine]”, RowBox[{“Tinf”,
“:=”, “374”}], “[IndentingNewLine]”, RowBox[{“L”, “:=”,
RowBox[{“2.26”, “", RowBox[{“10”, “^”, “6”}]}]}],
“[IndentingNewLine]”, RowBox[{“nul”, " ", “:=”, " ",
RowBox[{“8.9”, "
”, RowBox[{“10”, “^”,
RowBox[{”(“,
RowBox[{”-", “7”}], “)”}]}]}]}], “[IndentingNewLine]”, RowBox[{“sigma”, “:=”, “0.0072”}], “[IndentingNewLine]”,
RowBox[{“Ro”, “:=”, RowBox[{“50”, ““, RowBox[{“10”, “^”,
RowBox[{”(“,
RowBox[{”-“, “6”}], “)”}]}]}]}], “[IndentingNewLine]”, RowBox[{“Po”, “:=”, “101288”}], “[IndentingNewLine]”, RowBox[{“kl”,
“:=”, “0.6”}], “[IndentingNewLine]”, RowBox[{“Cpl”, “:=”, “4200”}],
“[IndentingNewLine]”, RowBox[{“alphal”, “:=”, RowBox[{“rhol”,
“/”, RowBox[{”(",
RowBox[{“kl”, "
”, “Cpl”}], “)”}]}]}]}], “Input”, CellChangeTimes->{{3.651502506577457*^9, 3.6515025088750887`^9}, {
3.651837948770302
^9, 3.651838037448888*^9}, {3.651838725281185*^9,
3.651838725976025*^9}, {3.651838933482456*^9,
3.651838949873065*^9}, {3.651839139699873*^9,
3.651839194624555*^9}}],

Cell[“FAR FIELD PRESSURE”, “Text”,
CellChangeTimes->{{3.6515010197053623`^9, 3.651501041770692^9},
3.65150110659192*^9}],

Cell[BoxData[ RowBox[{ RowBox[{“Pinf”, “[”, “t”, “]”}], “:=”,
“101000”}]], “Input”, CellChangeTimes->{{3.651506615443799*^9,
3.651506628590733*^9}, {
3.651838048688504*^9, 3.651838059832117*^9}}],

Cell[“HEAT SOURCE TERM”, “Text”,
CellChangeTimes->{{3.651838065865035*^9, 3.651838072204588*^9}}],

Cell[BoxData[ RowBox[{“Q”, “:=”, “0”}]], “Input”,
CellChangeTimes->{{3.651838076448584*^9, 3.651838101893079*^9}}],

Cell[“DIFFERENTIAL EQUATIONS”, “Text”,
CellChangeTimes->{{3.651840036942363*^9, 3.6518400468922157`*^9}}],

Cell[BoxData[{ RowBox[{ RowBox[{“eq1R”, “=”, RowBox[{
RowBox[{
RowBox[{
RowBox[{“(”,
RowBox[{
RowBox[{“Po”, “*”,
RowBox[{
RowBox[{“(”,
RowBox[{“Ro”, “/”,
RowBox[{“R”, “[”,
RowBox[{“r”, “,”, “t”}], “]”}]}], “)”}], “^”, “3”}]}],
“-”,
RowBox[{“Pinf”, “[”, “t”, “]”}]}], “)”}], “/”, “rhol”}], “+”,

 RowBox[{
  RowBox[{"(", 
   RowBox[{
    RowBox[{"(", 
     RowBox[{
      RowBox[{"T", "[", 
       RowBox[{"r", ",", "t"}], "]"}], "/.", 
      RowBox[{"r", "\[Rule]", 
       RowBox[{"R", "[", 
        RowBox[{"r", ",", "t"}], "]"}]}]}], ")"}], "-", "Tinf"}], 
   ")"}], "*", "rhov", "*", 
  RowBox[{"L", "/", 
   RowBox[{"(", 
    RowBox[{"rhol", "*", "Tinf"}], ")"}]}]}]}], "\[Equal]", 
RowBox[{
 RowBox[{
  RowBox[{"R", "[", 
   RowBox[{"r", ",", "t"}], "]"}], "*", 
  RowBox[{
   SubscriptBox["\[PartialD]", 
    RowBox[{"t", ",", "t"}]], 
   RowBox[{"(", 
    RowBox[{"R", "[", 
     RowBox[{"r", ",", "t"}], "]"}], ")"}]}]}], "+", 
 RowBox[{"1.5", "*", 
  RowBox[{
   RowBox[{"(", 
    RowBox[{
     SubscriptBox["\[PartialD]", "t"], 
     RowBox[{"(", 
      RowBox[{"R", "[", 
       RowBox[{"r", ",", "t"}], "]"}], ")"}]}], ")"}], "^", 
   "2"}]}], "+", 
 RowBox[{"4", "*", 
  RowBox[{"nul", "/", 
   RowBox[{"R", "[", 
    RowBox[{"r", ",", "t"}], "]"}]}], "*", 
  RowBox[{
   SubscriptBox["\[PartialD]", "t"], 
   RowBox[{"(", 
    RowBox[{"R", "[", 
     RowBox[{"r", ",", "t"}], "]"}], ")"}]}]}], "+", 
 RowBox[{"2", "*", 
  RowBox[{"sigma", "/", 
   RowBox[{"(", 
    RowBox[{
     RowBox[{"R", "[", 
      RowBox[{"r", ",", "t"}], "]"}], "*", "rhol"}], ")"}]}]}], 
 "-", 
 RowBox[{"rhov", "*", 
  RowBox[{
   RowBox[{
    RowBox[{"(", 
     RowBox[{
      SubscriptBox["\[PartialD]", "t"], 
      RowBox[{"(", 
       RowBox[{"R", "[", 
        RowBox[{"r", ",", "t"}], "]"}], ")"}]}], ")"}], "^", 
    "2"}], "/", "rhol"}]}]}]}]}], ";"}], "\[IndentingNewLine]",   RowBox[{   RowBox[{"eq2T", "=",     RowBox[{
RowBox[{
 RowBox[{
  SubscriptBox["\[PartialD]", "t"], 
  RowBox[{"(", 
   RowBox[{"T", "[", 
    RowBox[{"r", ",", "t"}], "]"}], ")"}]}], "+", 
 RowBox[{
  RowBox[{
   SubscriptBox["\[PartialD]", "t"], 
   RowBox[{"(", 
    RowBox[{"R", "[", 
     RowBox[{"r", ",", "t"}], "]"}], ")"}]}], "*", 
  RowBox[{
   RowBox[{"(", 
    RowBox[{
     RowBox[{"R", "[", 
      RowBox[{"r", ",", "t"}], "]"}], "/", "r"}], ")"}], "^", 
   "2"}], "*", 
  RowBox[{
   SubscriptBox["\[PartialD]", "r"], 
   RowBox[{"(", 
    RowBox[{"T", "[", 
     RowBox[{"r", ",", "t"}], "]"}], ")"}]}]}]}], "\[Equal]", 
RowBox[{
 RowBox[{"alphal", "*", 
  RowBox[{"(", 
   RowBox[{
    RowBox[{"1", "/", 
     RowBox[{"r", "^", "2"}]}], "*", 
    RowBox[{
     SubscriptBox["\[PartialD]", "r"], 
     RowBox[{"(", 
      RowBox[{
       RowBox[{"r", "^", "2"}], "*", 
       RowBox[{
        SubscriptBox["\[PartialD]", "r"], 
        RowBox[{"(", 
         RowBox[{"T", "[", 
          RowBox[{"r", ",", "t"}], "]"}], ")"}]}]}], ")"}]}]}], 
   ")"}]}], "+", 
 RowBox[{"Q", "/", 
  RowBox[{"(", 
   RowBox[{"rhol", "*", "Cpl"}], ")"}]}]}]}]}],    ";"}], "\[IndentingNewLine]",   RowBox[{   RowBox[{"ic", "=",    

RowBox[{“{”,
RowBox[{
RowBox[{
RowBox[{“R”, “[”,
RowBox[{“r”, “,”, “0”}], “]”}], “[Equal]”, “Ro”}], “,”,
RowBox[{
RowBox[{“T”, “[”,
RowBox[{“r”, “,”, “0”}], “]”}], “[Equal]”, “Tinf”}]}],
“}”}]}], “;”}], “[IndentingNewLine]”, RowBox[{“bc”, “=”, RowBox[{“{”, RowBox[{
RowBox[{
RowBox[{“T”, “[”,
RowBox[{“Infinity”, “,”, “t”}], “]”}], “[Equal]”, “Tinf”}],
“,”,
RowBox[{
RowBox[{
RowBox[{
RowBox[{
RowBox[{“Derivative”, “[”,
RowBox[{“1”, “,”, “0”}], “]”}], “[”, “T”, “]”}], “[”,
RowBox[{
RowBox[{“R”, “[”,
RowBox[{“r”, “,”, “t”}], “]”}], “,”, “t”}], “]”}], “+”,
RowBox[{“Q”, “/”,
RowBox[{“(”,
RowBox[{“kl”, “", “4”, "”, “Pi”, “",
RowBox[{
RowBox[{“R”, “[”,
RowBox[{“r”, “,”, “t”}], “]”}], “^”, “2”}]}], “)”}]}]}],
“[Equal]”,
RowBox[{“rhov”, "
”,
RowBox[{“L”, “/”, “kl”}], "“,
RowBox[{
SubscriptBox[”[PartialD]“, “t”],
RowBox[{”(",
RowBox[{“R”, “[”,
RowBox[{“r”, “,”, “t”}], “]”}], “)”}]}]}]}]}], “}”}]}]}], “Input”, CellChangeTimes->{{3.6518400526858797*^9, 3.65184015171353*^9}, { 3.651842640413406*^9, 3.651842722275096*^9}, {3.651842824369041*^9, 3.651842831119175*^9}, {3.651842981476259*^9, 3.6518430029304028
^9}, {3.651843172572712*^9,
3.651843290897798*^9}, {3.651843433949147*^9,
3.6518434590426273*^9}, {3.6518435493915586^9,
3.651843743755981
^9}, {3.6518440310657167*^9, 3.651844255466658*^9}, {3.651844328321423*^9, 3.6518443641748447^9}, {3.651853000982347^9,
3.6518530318198853*^9}, {3.6518533398685703^9,
3.651853350644042
^9}, {3.6518538800039587*^9, 3.65185400795338*^9}, {3.651854258584584*^9, 3.65185425995962*^9}, {3.6518543490521717^9,
3.651854409354924
^9}, {3.6518544638369703*^9, 3.651854464812687*^9}, {3.651854923228691*^9, 3.651854952067369*^9}, 3.651855569241837*^9, { 3.6518614338703403^9, 3.651861474682918^9}, {
3.651861635048164*^9, 3.65186164413422*^9}, {3.651861915011001*^9,
3.651861916079472*^9}, {3.6518622061203527*^9, 3.651862207023395*^9}, {3.651862655991164*^9, 3.6518626933295794^9}, 3.651864115146604^9,
3.6519276365953074`*^9}],

Cell[“COUPLED R[t] AND T[r,t] EQUATIONS”, “Text”,
CellChangeTimes->{{3.651502313980473*^9, 3.6515023243324738`^9}, {
3.651839997975006
^9, 3.651840027732823*^9}}],

Cell[BoxData[ RowBox[{“s”, “=”, RowBox[{“NDSolve”, “[”,
RowBox[{
RowBox[{“Join”, “[”,
RowBox[{
RowBox[{“{”,
RowBox[{“eq1R”, “,”, “eq2T”}], “}”}], “,”, “ic”, “,”, “bc”}],
“]”}], “,”,
RowBox[{“{”,
RowBox[{“R”, “,”, “T”}], “}”}], “,”,
RowBox[{“{”,
RowBox[{“r”, “,”, “Ro”, “,”,
RowBox[{“10”, ““, “Ro”}]}], “}”}], “,”,
RowBox[{”{",
RowBox[{“t”, “,”, “0”, “,”,
RowBox[{“60”, "
”,
RowBox[{“10”, “^”,
RowBox[{“(”,
RowBox[{“-”, “6”}], “)”}]}]}]}], “}”}]}], “]”}]}]], “Input”, CellChangeTimes->{{3.651838753176497*^9, 3.651838759767405*^9}, {
3.651838910122202*^9, 3.651839016182797*^9}, {3.651839063198436*^9,
3.651839120379561*^9}, {3.651839209984556*^9,
3.651839212827221*^9}, {3.651839338237527*^9,
3.651839470962743*^9}, {3.651839511815838*^9,
3.651839686385157*^9}, {3.651839733135844*^9,
3.651839754047151*^9}, 3.651852608588047*^9, {3.651852807434716*^9,
3.65185282340909*^9}, {3.651853359562621*^9,
3.651853372363184*^9}, {3.6518540576300173`^9,
3.651854095307445
^9}, {3.651854216209278*^9,
3.651854228063437*^9}, {3.651861487589489*^9,
3.651861516881337*^9}, {3.65186236635828*^9, 3.651862372060459*^9},
3.651862409180901*^9, 3.65186256609332*^9}] }, WindowSize->{808, 911}, WindowMargins->{{Automatic, 535}, {Automatic, 125}},
PrintingCopies->1, PrintingPageRange->{1, Automatic},
FrontEndVersion->“10.1 for Mac OS X x86 (32-bit, 64-bit Kernel)
(March 23, 2015)”, StyleDefinitions->“Default.nb” ]

On solving this I am getting the following error
"NDSolve::overdet: “There are fewer dependent variables, {R[r,t],T[r,t]}, than equations, so the system is overdetermined.”

I do not understand how I am overdetermining this model.

Please help!

Thank you.

P.S. - While looking for such implementations I came across SAMPLE where they have solved a PDE and an ODE simultaneously but I am unable to solve their equations either.

Hi Raunak,

I suggest you post your code in a code block, so we can copy it into Mathematica. You can find out how to do that here: How to post

Regards, David

Anyone there to help?

You never included cut-and-pastable code: the tangle above has syntax problems. If you put it in a notebook (not a pdf file) and attach that, then maybe somebody will try it out.