0
$\begingroup$

I'm trying to solve for 2 first order coupled ODEs. I've got two initial conditions, and I can't get a solution. I've double checked my equation input and my initial conditions, and my NDSolve function looks similar to the example posted in the documentation so I'm stumped. Here's what I've got going:

gamma := 0;
Ra := 2.32 * 10^9;
Ja :=  0.315;
C1 :=  .5;
C2 := .6666;
qdotc := 1;
C3 := .75;


sol = NDSolve[
   {delta'[t] == 
     C1 * Ja * (1 + gamma * delta[t]) / (delta[t]^3 * Ra * Sin[t]) - 
      C2 * (delta[t]) * Cot[t],
    q'[t] == 1/ delta[t] * Sin[t],
    delta[0] == 0.00317666163538945,
    q[0] == 0
    },
   {delta, q},
   {t, 0, 1},
   Method -> {"StiffnessSwitching", 
     Method -> {"ExplicitRungeKutta", Automatic}}, 
   WorkingPrecision -> 100][[1, 1]]

Plot[Evaluate[delta[t] /. sol], {t, 0, 1}, PlotRange -> All]

And then I get the following error messages:

enter image description here

$\endgroup$
  • $\begingroup$ Your ode -system is of order 1 , though your initial condition q'[0]== 0 isn't allowed! $\endgroup$ – Ulrich Neumann Nov 13 '18 at 8:09
  • $\begingroup$ The precision issue is because you are using approximate numbers, and then trying to specify WorkingPrecision to be 100. The second error is because $cot(0)$ is a divide by zero error. $\endgroup$ – KraZug Nov 13 '18 at 8:36
2
$\begingroup$
gamma = 0;
Ra = 232*10^7;
Ja = 315/1000;
C1 = 1/2;
C2 = 6666/10000;
qdotc = 1;
C3 = 75/100;
t0 = 10^-5;
q0 = Rationalize[0.00317666163538945];
sol = NDSolve[{delta'[t] == 
    C1*Ja*(1 + gamma*delta[t])/(delta[t]^3*Ra*Sin[t]) - 
     C2*(delta[t])*Cot[t], q'[t] == 1/delta[t]*Sin[t], 
   delta[t0] == q0, q[t0] == 0}, {delta, q}, {t, t0, 1}]

Plot[Evaluate[delta[t] /. First[sol]], {t, t0, 1}, PlotRange -> All]

fig1

$\endgroup$
  • $\begingroup$ Thank you! Works perfectly now. $\endgroup$ – Drew Lilley Nov 13 '18 at 18:39
  • $\begingroup$ You're welcome! $\endgroup$ – Alex Trounev Nov 13 '18 at 19:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.