I am trying to solve the given coupled differential equation using NDsolve
.
$$ \begin{array}{c} n''(r)+\frac{n'(r) T'(r)}{T(r)}+\frac{n'(r)}{r}+\frac{n(r) T''(r)}{T(r)}-\frac{n(r) T'(r)^2}{T(r)^2}+\frac{n(r) T'(r)}{r T(r)}-n(r)+e^{-r^2}=0\\ T(r) n''(r)+2 n'(r) T'(r)+\frac{T(r) n'(r)}{r}+n(r) T''(r)+\frac{n(r) T'(r)}{r}-n(r)+e^{-r^2}=0 \end{array} $$
eq1 = Div[Grad[n[r] , {r, h, z}, "Cylindrical"], {r, h, z}, "Cylindrical"] + Div[(n[r]/T[r])*Grad[T[r], {r, h, z}, "Cylindrical"], {r, h, z}, "Cylindrical"] - n[r] + Exp[-(r^2)] == 0 ;
eq2 = Div[T[r]*Grad[n[r], {r, h, z}, "Cylindrical"], {r, h, z}, "Cylindrical"] + Div[n[r]*Grad[T[r] , {r, h, z}, "Cylindrical"], {r, h, z}, "Cylindrical"] - n[r] + Exp[-(r^2)] == 0 ;
initialConditions = {n'[50] == 0, n'[0] == 0, T'[50] == 0, T'[0] == 0};
solution = NDSolve[{eq1, eq2, initialConditions}, {n, T}, {r, 0, 50}];
Plot[Evaluate[{n[r], T[r]} /. %], {r, 0, 50}, PlotLegends -> {"n[r]", "T[r]"}]
Mathematica returns an error - NDSolve::bvdae: Differential-algebraic equations must be given as initial value problems
I have two questions regarding it,
Q1: Can we solve such equations accurately with NDSolve
?
Q2: How do I get initial values for the two quantities, n
and T
?
Solve[{eq1, eq2}, {n''[r], T''[r]}]
. It suggests there's an error in your ODEs. And if no error, then the ODEs are inconsistent and there's no solution at all. (The first error is the source of the second in my trial, which is why you should address the first error first.) $\endgroup$