2
$\begingroup$

I am trying to solve following coupled PDEs: enter image description here I am not sure about suitable BCs.

 ClearAll[V, Rho, T]
gamma = 5/3; ep = 0.05; d = 0.01; L = 1; H = 1.1; gpara = 0.38;
System = {D[V[x, t],t] == -1/gamma/exp[-x/H]*{D[Rho[x, t], x] + D[T[x, 
t],x]} + Rho[x, t]/exp[-x/H]*gpara + 1.3*ep*D[V[x, t], {x, 2}], 
D[Rho[x, t], t] == - D[{exp[-x/H]*V[x, t]}, x],
D[T[x, t], t] == D[{exp[-x/H]*V[x, t]}, x] - V[x, t]*Rho[x, t]*gpara - 
gamma*exp[-x/H]*D[V[x, t], x] + gamma*d*D[T[x, t], {x, 2}],
V[x, t] == 0 /. x -> 0,
V[x, t] == 0 /. x -> 1,
Rho[x, t] == 0 /. x -> 0,
Rho[x, t] == 0 /. x -> 1,
T[x, t]   == 0 /. x -> 0,
T[x, t]   == 0 /. x -> 1,
D[T[x, t], x] == 0 /. x -> 1,
V[x, 0] == Sin[Pi*x/L],
Rho[x, 0] == 0,
T[x, 0] == 0};
{V, Rho, T} = NDSolveValue[System, {V, Rho, T}, {x, 0, 1}, {t, 0, 5}]
Plot3D[{V[x, t], Rho[x, t], T[x, t]}, {x, 0, 1}, {t, 0, 5}] 

General::ivar: 3 is not a valid variable. ........ Also, how i can import variable gpara in .txt format to this code?

$\endgroup$
5
$\begingroup$

Here is a version that fixes the syntax errors but there is a warning message indicating instability you should look into:

ClearAll[V, Rho, T]
gamma = 5/3; ep = 0.05; d = 0.01; L = 1; H = 1.1; gpara = 0.38;
System = {
   D[V[x, t], 
     t] == -1/gamma/Exp[-x/H]*(D[Rho[x, t], x] + D[T[x, t], x]) + 
     Rho[x, t]/Exp[-x/H]*gpara + 1.3*ep*D[V[x, t], {x, 2}], 
   D[Rho[x, t], t] == -D[Exp[-x/H]*V[x, t], x], 
   D[T[x, t], t] == 
    D[Exp[-x/H]*V[x, t], x] - V[x, t]*Rho[x, t]*gpara - 
     gamma*Exp[-x/H]*D[V[x, t], x] + gamma*d*D[T[x, t], {x, 2}],
   V[0, t] == 0, V[1, t] == 0, V[x, 0] == Sin[Pi*x/L],
   Rho[0, t] == 0, Rho[1, t] == 0, Rho[x, 0] == 0,
   T[0, t] == 0, T[1, t] == 0, Derivative[1, 0][T][1, t] == 0, 
   T[x, 0] == 0};
{V, Rho, T} = NDSolveValue[System, {V, Rho, T}, {x, 0, 1}, {t, 0, 5}]

enter image description here

Plot3D[{V[x, t], Rho[x, t], T[x, t]}, {x, 0, 1}, {t, 0, 5}]

enter image description here

$\endgroup$
  • $\begingroup$ Thank you very much. I am using mathematica 11.3, when i use this code in my .nb, its showing errors: General::ivar: 3 is not a valid variable. I need to install different version of mathematica to avoid errors? $\endgroup$ – Danial Apr 24 at 6:44
  • $\begingroup$ @Danial, works for me in V11.3. Try quiting your kernel, perhaps? $\endgroup$ – user21 Apr 24 at 6:45
  • $\begingroup$ Thanks @user21, its works after quiting kernel. $\endgroup$ – Danial Apr 25 at 6:32
  • $\begingroup$ Can you please suggest me how to get eigen values of this system of equations if i change d/dt =i lambda ? $\endgroup$ – Danial Apr 25 at 6:35
  • $\begingroup$ @Danial, I am not sure I understand your question, do you mean via NDEigensystem? If so, that is a different question and you should ask a new one. $\endgroup$ – user21 Apr 25 at 7:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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