1
$\begingroup$
ClearAll["Global`*"];
pdeset = {Derivative[1, 0][U][t, x] == Derivative[0, 2][U][t, x], 
Derivative[1, 0][T][t, x] == Derivative[0, 2][T][t, x] + E Derivative[0, 1][U][t, x]^2}
ics = {U[0, x] == 0, T[0, x] == 0};
bcs = {U[t, 0] == cos[t], T[t, 0] == 1, U[t, 10] == 0, T[t, 10] == 0 };
bcAll = Flatten[{ics, bcs}, 1];
  • For E=0.1, when I try to solve

    sol = NDSolve[{pdeset, bcAll}, {U, T}, {t, 0, 5}, {x, 0, 4 Pi}]

I get this error NDSolve::bcedge: "Boundary condition U[t,10]==0 is not specified on a single edge of the boundary of the computational domain"

  • How to plot Derivative[0, 1][T][t, x] as x->0 vs t (0...Pi) for E=0.1,0.2,0.3?
$\endgroup$
1
  • 2
    $\begingroup$ You asked a question, accepted an answer, then modified the question and unaccepted the answer. How many times do you plan to do that? $\endgroup$ Commented Mar 10, 2015 at 19:59

2 Answers 2

2
+50
$\begingroup$

fixing the Cos typo and making a bold decision that the xrange ends at 4 Pi not 10

 ClearAll["Global`*"];
 pdeset = {Derivative[1, 0][U][t, x] == Derivative[0, 2][U][t, x], 
 Derivative[1, 0][T][t, x] == 
 Derivative[0, 2][T][t, x] + E Derivative[0, 1][U][t, x]^2}
 ics = {U[0, x] == 0, T[0, x] == 0};
 bcs = {U[t, 0] == Cos[t], U[t, 4 Pi] == 0,T[t, 0] == 1, T[t, 4 Pi] == 0};
 bcAll = Flatten[{ics, bcs}, 1];
 sol = NDSolve[{pdeset, bcAll}, {U, T}, {t, 0, 5}, {x, 0, 4 Pi}];

(* NDSolve::ibcinc: Warning: boundary and initial conditions are inconsistent. *)

The warning is because you have specified both U and T to be simultaneously 0 and 1 at the origin. You get a solution but it obviously doesn't satisfy both conditions.

 Plot3D[ (T /. First@sol)[t, x] , {x, 0, 4 Pi}, {t, 0, 5}, 
      PlotRange -> All]

this figure shows but U and T with red lines indicating the prescribed boundary conditions.

enter image description here

here is your plot:

 Plot[Evaluate[  (D[(T /. First@sol)[t, x], x]) /. x -> 0 ], {t, 0, 5}]

enter image description here

$\endgroup$
2
$\begingroup$

After correcting some syntax errors and setting consistent boundary conditions:

ClearAll["Global`*"];
e = 0.1;
pdeset =
 {Derivative[1, 0][U][t, x] == Derivative[0, 2][U][t, x], 
  Derivative[1, 0][T][t, x] == Derivative[0, 2][T][t, x] + e Derivative[0, 1][U][t, x]^2}
ics =
  {U[0, x] == 0,
   T[0, x] == 0};
bcs =
  {U[t, 0] == Sin[t],
   T[t, 0] == 0,
   U[t, 10] == 0,
   T[t, 10] == 0};
bcAll = Flatten[{ics, bcs}, 1];

sol = NDSolve[{pdeset, bcAll}, {U, T}, {t, 0, 5}, {x, 0, 10}]

VectorPlot[{U[t, x], T[t, x]} /. sol[[1]], {t, 0, 5}, {x, 0, 10}, 
 VectorScale -> {Small, Scaled[.5], None}]

Mathematica graphics

$\endgroup$
4
  • $\begingroup$ Thx dear but why change bc T[t,0]=1 and how plot Derivative[0, 1][T][t, x] as x->0 vs t (0...Pi) for e=0.1,0.2,0.3? $\endgroup$
    – zhk
    Commented Nov 27, 2013 at 3:14
  • $\begingroup$ @MMM The ics and the bcs should be coherent $\endgroup$ Commented Nov 27, 2013 at 3:20
  • $\begingroup$ Dear @belisarius, I am still hoping to learn how to plot Derivative[0, 1][T][t, x] as x->0 vs t (0...Pi) for e=0.1,0.2,0.3? $\endgroup$
    – zhk
    Commented Nov 28, 2013 at 4:45
  • $\begingroup$ i am still waiting for your @belisarius response? $\endgroup$
    – zhk
    Commented Dec 2, 2013 at 5:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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