# NDSolveValue in NDSolveValue

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 ?

• 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. – Henrik Schumacher Jun 13 '18 at 14:27
• 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. – J.A Jun 13 '18 at 14:45

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}]