Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. diffusionC = 1;
  2. charge = 1;
  3. mobility = 1;
  4.  
  5. equation =
  6. D[u[t, x], t] == -D[-diffusionC*D[u[t, x], x] -
  7. charge*mobility*u[t, x]*D[[CapitalPhi][t, x], x], x];
  8.  
  9. potential = [CapitalPhi][t, x] == -2.5*x + 5;
  10.  
  11. ic = {(D[[CapitalPhi][t, x], t] /. t -> 0) == 0, [CapitalPhi][0, x] == 5 - 2.5 x}
  12.  
  13. bc = {u[t, 0] == 8, u[t, 2] == 0}
  14.  
  15. sol = NDSolve[{equation, potential, ic, bc}, {u, [CapitalPhi]}, {t, 0, 10}, {x, 0, 2}]
  16.  
  17. Plot3D[u[t, x] /. sol, {x, 0, 2}, {t, 0, 10}, PlotRange -> All, AxesLabel -> {x, t, u}]
  18.  
  19. Plot3D[[CapitalPhi][t, x] /. sol, {x, 0, 2}, {t, 0, 10},
  20. PlotRange -> All, AxesLabel -> {x, t, [CapitalPhi]}]
  21.  
  22. NDSolve::ibcinc: Warning: boundary and initial conditions are inconsistent. >>
  23.  
  24. NDSolve::bcart: Warning: an insufficient number of boundary conditions have
  25. been specified for the direction of independent variable x. Artificial
  26. boundary effects may be present in the solution. >>
  27.  
  28. bc = {u[t, 0] == 8-7*Exp[-1000t], u[t, 2] == 0}
  29.  
  30. NDSolve::ibcinc: Warning: boundary and initial conditions are inconsistent. >>
  31.  
  32. NDSolve::bcart: Warning: an insufficient number of boundary conditions have
  33. been specified for the direction of independent variable x. Artificial
  34. boundary effects may be present in the solution. >>
  35.  
  36. NDSolve::mconly: For the method IDA, only machine real code is available.
  37. Unable to continue with complex values or beyond floating-point exceptions. >>
  38.  
  39. NDSolve::eerr: Warning: scaled local spatial error estimate of
  40. 652895.9781327343` at t = 0.14272838549715564` in the direction of
  41. independent variable x is much greater than the prescribed error tolerance.
  42. Grid spacing with 25 points may be too large to achieve the desired accuracy
  43. or precision. A singularity may have formed or a smaller grid spacing can be
  44. specified using the MaxStepSize or MinPoints method options. >>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement