0

I am trying to solve a set of PDE equations with parameters of v[z],q[z],T[z,t,r]. Below is my test code where I tried the method of parametricNDSolve but to no avail.

ClearAll["Global`*"] ;
equ = With[{v = v@z, q = q@z, T = T @@ {z, t, r}, p = 1/(1 + T@@ {z, t, r}^(-3/2)), 
A = NIntegrate[p*Exp[-q*r^2] r, {r, 0, \[Infinity]}],  B = NIntegrate[p*Exp[-2 q*r^2] r, {r, 0, \[Infinity]}]},
{-v D[q, z] + q*D[v, z] == -q^2*v*A,
-v*D[q, z] + 2 q*D[v, z] == -4*q^2*v*B,
D[T + (p + 1) v^2 Exp[-2 q r^2], t] + 1/r D[r*p*v^2 Exp[-2 q r^2], r] + D[p*v^2 Exp[-2 q r^2],z] == p*v^2 Exp[-2 q r^2]}]

ic = {v[0] == 1, q[0] == 1, T[0, 0, 0] == 1} {vsol,qsol,Tsol}=ParametricNDSolveValue[{equ, ic}, {v, q, T}, {z, 0, 10}, {t, r}]

Can anyone help me out? Thanks.

codebpr
  • 2,233
  • 1
  • 7
  • 26
sixpenny
  • 103
  • 7

1 Answers1

0

Here is my attempt, based on the code you provided. I first replaced the formula you had for p directly in the set of equations, as it depended on T[z,t,r].

As pointed out by @Daniel Huber, you should use Integrate in A and B, with the assumption that $q>0$ for convergence.

Following the answer in this question, you should be able to solve your set of equations assuming q and v also depend on (z,t,r), not just on z.

Since you don't have any parameter, I use NDSolveValue instead of ParameterNDSolveValue. You will have some warning messages, but NDSolve will go through and give you some interpolating function, that you can visualise with SliceContourPlot3D.

Please, tell me if this can help you. Cheers

ClearAll["Global`*"];
equ = With[{v = v @@ {z, t, r}, q = q @@ {z, t, r}, T = T @@ {z, t, r}, 
   A = Integrate[r*Exp[-q[z, t, r]*r^2]/(1 + T[z, t, r]^(-3/2)), {r, 0, Infinity},
      Assumptions -> q[z, t, r] > 0], B = Integrate[r*Exp[-2 q[z, t, r]*r^2]/(1 + T[z, t, r]^(-3/2)), {r, 0, Infinity}, Assumptions -> q[z, t, r] > 0]}, {-v D[q, z] + 
     q*D[v, z] == -q^2*v*A, -v*D[q, z] + 2 q*D[v, z] == -4*q^2*v*B, 
   D[T + (1/(1 + T^(-3/2)) + 1) v^2 Exp[-2 q r^2], t] + 
     1/r D[r*(1/(1 + T^(-3/2)))*v^2 Exp[-2 q r^2], r] + 
     D[(1/(1 + T^(-3/2)))*v^2 Exp[-2 q r^2], z] == (1/(1 + T^(-3/2)))*
     v^2 Exp[-2 q r^2]}]
ic = {v[0, t, r] == 1, q[0, t, r] == 1, T[0, t, r] == 1}
{vsol, qsol, Tsol} =  NDSolveValue[{equ, ic}, {v, q, T}, {z, 0, 10}, {t, 0, 10}, {r, 0.1,10}]
SliceContourPlot3D[vsol[z, t, r], "ZStackedPlanes", {z, 0, 10}, {t, 0, 10}, {r, 0.1,10}]
Free_ion
  • 58
  • 7
  • Thanks a lot @Free_ion, I will try your code in the more complex and real physical equations. By the way, it might be (?) v=v[z,t] and q=q[z,t], although T=T[z,t,r] – sixpenny Apr 20 '21 at 13:05
  • There is a message NDSolveValue::ndcf: Repeated convergence test failure at z == 0.; unable to continue.. It means that this solution defined only in domain{{0,0},{0,10}, {0.1,10}}. Also integralsA, Bignored byNDSolve`, therefore with this code we solve system of PDE, and not integrodifferential equations. – Alex Trounev Apr 20 '21 at 17:04