1
$\begingroup$

I would like to implement a sort of Euler explicit manually. I have this code

alpha=1
a = 9/4
SOL[R_] = NDSolveValue[{-alpha * (-2 + 12*a*f[x]^2)*Laplacian[f[x], {x, y, z}, 
  "Spherical"] == 
  (Max[1 + (R - l)/l*(1 - R/x), 0] - 0.5), f[R] == 2/3, 
   f'[0.00001] == 0.000001}, f, {x, 0.0001, R}] 


v[x_]=-(1-SOL[R][x])(-2+12*9/4*SOL[R][x]^2)SOL[R]'[x]

Now, I would like to take a $R(t=0)=R_0$, and write $R(t+\Delta t)=R(t)+v(R)\Delta t$, in order to have a numerical function $R(t)$.

What I tried is to write an equation on $R$, and to enter the NDSolveValue in another NDSolveValue :

  alpha = 1
  a = 9/4

  SOL[R_] := NDSolveValue[{-alpha * (-2 + 12*a*f[x]^2)*Laplacian[f[x], 
{x, y, z}, "Spherical"] == (Min[Max[1 + (R - l)/l*(1 - R/x), 0], 1] - 0.5),
f[R] == 2/3, f'[0.00001] == 0.000001}, f, {x, 0.0001, R}]

    radius = NDSolveValue[{g'[t] == - SOL[g[t]][g[t] - 0.001] (1 - 
SOL[g[t]][g[t] - 0.001]) (-2 +  12*a*SOL[g[t]][g[t] - 0.001]^2) SOL[g[t]]'[g[t] - 0.0001], 
g[0] == 0.5}, g, {t, 0, 2}, MaxSteps -> 10^2]

But I get the message *NDSolveValue::derarg: The derivative operator Derivative[1] in (NDSolveValue[{-(-2+27 Power[<<2>>]) (2 Power[<<2>>] (<<1>>^(<<1>>))[<<1>>]+(f^[Prime][Prime])[x])==-0.5+Min[1,Max[0,Plus[<<2>>]]],f[g[t]]==2/3,(f^[Prime])[0.00001]==1.10^-6},f,{x,0.0001,g[t]}]^[Prime])[-0.0001+g[t]] should act on the pure function.

Do you have an idea how to proceed ?

$\endgroup$
2
  • $\begingroup$ What is the differential equation that you want to solve? It's not clear because you use Laplacian[f[x], {x, y, z}, "Spherical"] which confuses me because f has only a single scalar argument. $\endgroup$ Jun 13, 2018 at 14:27
  • $\begingroup$ Since I choose a spherical symmetry, ' f ' has only one argument, r the radius, which is in the code ' x ' . I have two differential equations : one that gives me f in function of x, and one that gives me R in function of t. the first one is esay to solve with NDSolveValue, and the second one is connected to the first one of f which is v, and through a "boundary condition" : ' f(R)=2/3 '. And eventually I want to solve the second one. $\endgroup$
    – J.A
    Jun 13, 2018 at 14:45

1 Answer 1

1
$\begingroup$
alpha = 1; a = 9/4; l = .001;

SOL = ParametricNDSolveValue[{-alpha*(-2 + 12*a*f[x]^2)*
     Laplacian[f[x], {x, y, z}, "Spherical"]/
      R^2 == (Min[Max[1 + (R - l)/l*(1 - 1/x), 0], 1] - 0.5), 
   f[1] == 2/3, f'[0.00001] == 0.000001}, f, {x, 0.0001, 1}, {R}]
    SOL1 = ParametricNDSolveValue[{-alpha*(-2 + 12*a*f[x]^2)*
     Laplacian[f[x], {x, y, z}, "Spherical"]/
      R^2 == (Min[Max[1 + (R - l)/l*(1 - 1/x), 0], 1] - 0.5), 
   f[1] == 2/3, f'[0.00001] == 0.000001}, f', {x, 0.0001, 1}, {R}]
radius = NDSolveValue[{g'[
     t] == -SOL[g[t]][(g[t] - 0.001)/g[t]] (1 - 
       SOL[g[t]][(g[t] - 0.001)/g[t]]) (-2 + 
       12*a*SOL[g[t]][(g[t] - 0.001)/g[t]]^2) SOL1[
        g[t]][(g[t] - 0.001)/g[t]]/g[t], g[0] == 0.5}, g, {t, 0, 2}]
Plot[radius[t], {t, 0, 2}, AxesLabel -> {"t", "R"}]

fig 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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