I would like to solve this following equation with d
, the order of the factional derivative (in the sense of Caputo) :
So I tried the following code :
R1 = 0.001;
R2 = 1;
K = 1;
d = 0.9;
eq = 1/K CaputoD[T[t, r, θ], {t, d}] -
1/ (r^2)*Derivative[0, 0, 2][T][t, r, θ] -
1/r*Derivative[0, 1, 0][T][t, r, θ] -
Derivative[0, 2, 0][T][t, r, θ];
(*Initial and boundary conditions*)
ic = T[0, r, θ ] == 0;
ic1 = Derivative[1, 0, 0][T][0, r, θ] == 0;
bc = DirichletCondition[T[t, r, θ] == 1,
0 <= θ <= 2 Pi && r==R1];
pbc1 = PeriodicBoundaryCondition[
T[t, r, θ], θ == 2 Pi + 0.01 && R1 < r < R2,
TranslationTransform[{0, -2 Pi}]];
pbc2 = PeriodicBoundaryCondition[
T[t, r, θ], θ == -0.01 && R1 < r < R2,
TranslationTransform[{0, 2 Pi}]];
(*solution w/ NDSolveValue*)
sol = NDSolveValue[{eq == 0, ic, bc, pbc1, pbc2},
T, {r, R1, R2}, {θ, -0.01, 2 *Pi + 0.01}, {t, 0, 10}]
It naturally works for d = 1
but fails for other fractional values. A quick search for previous questions asked such as this one here led me to realize that NDSolve
cannot handle Caputo yet and that you have to rely on DSolve
with some Laplace transforms to get solutions to such equations. A numerical solution would alternatively require a manual discretization using tools like pdetoode
.
However, from my humble understanding of the answers presented in this post, the numerical resolution with pdetoode
relies on a n-th order polynomial approximation and I have no idea how to adapt this to my 2D cylindrical coordinates problem. Other posts showcase different methods like the Haar wavelet method here but again, I can't see how to adapt this one to solving my problem.
Surprisingly, when i try to compute this equation instead :
using this modified code :
R1 = 0.001;
R2 = 1;
K = 1;
d = 0.9;
eq = 1/K (Derivative[2, 0, 0][T][t, r, θ] +
CaputoD[T[t, r, θ], {t, d}]) -
1/ (r^2)*Derivative[0, 0, 2][T][t, r, θ] -
1/r*Derivative[0, 1, 0][T][t, r, θ] -
Derivative[0, 2, 0][T][t, r, θ];
(*Initial and boundary conditions*)
ic = T[0, r, θ ] == 0;
ic1 = Derivative[1, 0, 0][T][0, r, θ] == 0;
bc = DirichletCondition[T[t, r, θ] == 1,
0 <= θ <= 2 Pi && R1 <= r <= R1 + 0.001];
pbc1 = PeriodicBoundaryCondition[
T[t, r, θ], θ == 2 Pi + 0.01 && R1 < r < R2,
TranslationTransform[{0, -2 Pi}]];
pbc2 = PeriodicBoundaryCondition[
T[t, r, θ], θ == -0.01 && R1 < r < R2,
TranslationTransform[{0, 2 Pi}]];
(*solution w/ NDSolveValue*)
sol = NDSolveValue[{eq == 0, ic, ic1, bc, pbc1, pbc2},
T, {r, R1, R2}, {θ, -0.01, 2 *Pi + 0.01}, {t, 0, 10, 1}]
I do get an interpolating function, which I can then visualise with
frames =
Table[DensityPlot[
sol1[t, Sqrt[x^2 + y^2],
Mod[ArcTan[x, y], 2 Pi]], {x, y} ∈ reg2D,
Axes -> {True, True, False}, AxesLabel -> {x, y},
PlotRange -> All, AxesStyle -> Directive[Purple, 12],
ColorFunction -> "Rainbow", ColorFunctionScaling -> False,
PlotLegends -> BarLegend[{"Rainbow", {0, 1}}],
PlotLabel -> Row[{"t=", t}]], {t, 0, 10, 1}];
Export["test.mp4", frames]
So here are my two questions :
1 - How can I solve numerically the first equation (without the 2nd order derivative wrt time)
2 - I have read that NDSolve
cannot handle Caputo but if I add a second order derivative w.r.t. time, it solves the equation. I'd like to know if the solution I get truly is the solution to my second equation or if NDSolve
somehow disregards Caputo to compute the whole thing. The reason why I ask this is I have tested several values of fractional order d
and there doesn't seem to be much change, hence the question.
I apologize for the long post. I am more interested in solving the first equation but if you have any idea about my second question, I would also appreciate your insight on the matter.
Have a great day.
r==R1
? (The definition ofbc
looks a bit suspicious. ) 2. You're aware that zero Nemann condition will be set atr==R2
, right? 3. In this toy sample the solution is actually axisymmetric, is the $θ$ dependence necessary for you in real case? 4. You wrote{t, 0, 10, 1}
, do you really know what it means?: mathematica.stackexchange.com/a/240406/1871 $\endgroup$NDSolve
doesn't parse theCaputoD
correctly, just add a meaningless coefficient to theCaputoD
term and try, or useNDSolve`FEM`GetInactivePDE
. A much simpler example showing the issue:NDSolveValue[{y'[x] + aaadvddd CaputoD[y[x], {x, 0.5}] == Sin[x], y[0] == 1}, y, {x, 0, 30}]
$\endgroup$cb = NeumannValue[0, r == R1] + NeumannValue[0, r == R2]
which I ended up removing since whether it was there or not it was there didn't seem to change the solution. I guess I now know why. 3 - I do have a Theta dependence in my real case. 4- I wasn't aware of this either and made this mistake probably because of my habits in python. I'll correct this right now. 5 - Thanks for confirming it. I now know that results for my second equation are not reliable. $\endgroup$