0
$\begingroup$

So I have a quite complicated ParametricNDSolve :

taustart=5;
epsilon=0.0001;
v=600;
L=1000;
D0=9*10^4;
nR=1;


sol = ParametricNDSolve[
{R'[
     t] ==  (D0 E^(-((L - t v)^2/(4 D0 t))) (L + t v))/(
      4 Sqrt[\[Pi]] (D0 t)^(
       3/2))*(phi0*R0^3*4*Pi/3)/phi0/(4 Pi*R[t]^2) + ((-16 R[t]^3 + (
       32 alpha E^(-((3 Vphi[t])/(4 phil \[Pi] R[t]^3)))
         l0 nR R[
         t]^4 (-2 l0 \[Pi] + (
          Sqrt[3 \[Pi]]
            Coth[(Sqrt[3/\[Pi]] R[t])/(
            2 l0 Sqrt[(
             E^(-((3 Vphi[t])/(4 phil \[Pi] R[t]^3))) R[t]^3)/
             Vphi[t]])] R[t])/Sqrt[(
          E^(-((3 Vphi[t])/(4 phil \[Pi] R[t]^3))) R[t]^3)/Vphi[t]]))/
       Vphi[t] - (6 beta Vphi[t])/\[Pi] + (
       3 beta Vphi[
         t] (-2 interface^2 \[Pi]^2 R[t] + 
          24 interface Log[2] R[t]^2 - 8 R[t]^3 + 
          3 interface^3 (4 PolyLog[3, -E^(-((2 R[t])/interface))] + 
             3 Zeta[3])))/(4 \[Pi] R[t]^3))/(48 taug R[t]^2)) + 
     Rcomp[R[t], R0]*If[t < taustartc, 0.001, 1], 
   R[epsilon] == epsilon, 

   Vphi'[t] == (D0 E^(-((L - t v)^2/(4 D0 t))) (L + t v))/(
      4 Sqrt[\[Pi]] (D0 t)^(
       3/2))*(phi0*R0^3*4*Pi/3) + ((-16 R[t]^3 + (
        32 alpha E^(-((3 Vphi[t])/(4 phil \[Pi] R[t]^3)))
          l0 nR R[t]^4 (-2 l0 \[Pi] + (
           Sqrt[3 \[Pi]]
             Coth[(Sqrt[3/\[Pi]] R[t])/(
             2 l0 Sqrt[(
              E^(-((3 Vphi[t])/(4 phil \[Pi] R[t]^3))) R[t]^3)/
              Vphi[t]])] R[t])/Sqrt[(
           E^(-((3 Vphi[t])/(4 phil \[Pi] R[t]^3))) R[t]^3)/
           Vphi[t]]))/Vphi[t] - (6 beta Vphi[t])/\[Pi] + (
        3 beta Vphi[
          t] (-2 interface^2 \[Pi]^2 R[t] + 
           24 interface Log[2] R[t]^2 - 8 R[t]^3 + 
           3 interface^3 (4 PolyLog[3, -E^(-((2 R[t])/interface))] + 
              3 Zeta[3])))/(4 \[Pi] R[t]^3))/(
       48 taug R[t]^2))*1/((4 \[Pi] R[t]^3)/(3*Vphi[t]))*4*Pi*R[t]^2, 
   Vphi[epsilon] == 4*Pi/3*epsilon^3*phi0}, 

{R, Vphi}, {t, epsilon, 
   200}, {R0, alpha, beta, tauc, taug, l0, phil, interface}]

I want to fit it to :

rad={{0., 117.705}, {3., 148.255}, {6., 176.81}, {9., 183.561}, {12., 
  197.419}, {15., 210.672}, {18., 211.152}, {21., 209.889}, {24., 
  207.741}, {27., 204.352}, {30., 201.79}, {33., 199.976}, {36., 
  199.04}, {39., 197.151}, {42., 197.584}, {45., 196.198}, {48., 
  195.153}, {51., 195.711}, {54., 194.088}, {57., 193.304}, {60., 
  192.474}, {63., 192.13}, {66., 192.877}, {69., 192.371}, {72., 
  192.657}, {75., 190.984}, {78., 190.685}, {81., 190.449}, {84., 
  189.83}, {87., 189.625}, {90., 194.855}, {93., 186.581}, {96., 
  184.735}, {99., 184.586}, {102., 183.505}, {105., 181.531}, {108., 
  179.925}, {111., 178.428}, {114., 176.164}, {117., 175.375}, {120., 
  174.782}, {123., 172.649}, {126., 170.454}, {129., 168.357}, {132., 
  168.04}, {135., 167.26}, {138., 165.657}, {141., 164.797}, {144., 
  163.705}, {147., 161.214}, {150., 160.5}, {153., 159.353}, {156., 
  157.873}, {159., 157.225}}

So I'm writting :

Manipulate[
 Show[{Plot[(Evaluate@({(R[160, alpha, beta, tauc, 
            taug, l0, phil, 4] /. sol)[t]})), {t, epsilon, 160}, 
    PlotRange -> All, ImageSize -> Large], 
   ListPlot[rad[[1]], PlotRange -> {0, 250}, 
    ImageSize -> Large]}],  {{alpha, 10}, 4, 15, 
  Appearance -> "Labeled"}, {{beta, 0.6}, 0.1, 3, 
  Appearance -> "Labeled"}, {{tauc, 16}, 2, 30, 
  Appearance -> "Labeled"}, {{taug, 130}, 50, 200, 
  Appearance -> "Labeled"}, {{l0, 230}, 100, 300, 
  Appearance -> "Labeled"}, {{phil, 0.046}, 0.03, 0.06, 
  Appearance -> "Labeled"}]

enter image description here which is a not so far to start manipulate.

But if I change the parameters a little bit it starts to be very weird : ![enter image description here][2]][2

I checked my equation and it seems to be right. But it is possible that sometimes parametricNDSolve gives strange results like that ?

$\endgroup$
  • $\begingroup$ I think the function Rcomp is missing from your question as well as the numerical value of phi0. $\endgroup$ – Jack LaVigne Jul 26 at 15:14

Your Answer

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

Browse other questions tagged or ask your own question.