0
$\begingroup$

I have solved the following pde numerically using NDSolveValue.

L = 5; del = 0.6; g = -0.1; a = 4; s = 0.1; tmax = 3;
ux = s (1 + 0.1   Exp[-(2.5)^2] - m[x, t]);
eqs = {2 s  k[x, t]  m[x, t] -  D[D[k[x, t], {x, 2}], t] + 
    2  s  del D[m[x, t], {x, 2}] == 
   0, -D[m[x, t], t] +  D[m[x, t], {x, 2}] + g  m[x, t]^3 + 
    m[x, t]  (a - ux + del  D[k[x, t], t]) == 0}; bc = {k[0, t] == 0, 
  k[L, t] == 0, m[0, t] == 1 + 0.1  Exp[-(2.5)^2], 
  m[L, t] == 1 + 0.1  Exp[-(2.5)^2]}; ic = {m[x, 0] == 
   1 + 0.1  Exp[-(x - 2.5)^2]};

solb = NDSolveValue[{eqs, ic, bc, k[x, 0] == 0}, {m, k}, {x, 0, 
    L}, {t, 0, tmax}, 
   Method -> {"MethodOfLines", 
     "SpatialDiscretization" -> {"TensorProductGrid", 
       "MaxPoints" -> 401, "MinPoints" -> 401, 
       "DifferenceOrder" -> 2}}];
Animate[Plot[solb[[2]][x, t], {x, 0, L}, PlotRange -> All, 
  ImagePadding -> 20, PerformanceGoal -> "Quality"], {t, 0, tmax}]

I am then trying to use the solution to solve another PDE, but I get an error. Could anyone help me with this? I think I do not need an initial condition, which is why I used {}. Boundary conditions are just an example, and can be changed to something else.

solH = NDSolveValue[{{D[H[x, t], {x, 2}] == 
      solb[[2]][x, t]}, {}, {H[0, t] == 1, H[L, t] == 1}}, {H}, {x, 0,
     L}, {t, 0, tmax}, 
   Method -> {"MethodOfLines", 
     "SpatialDiscretization" -> {"TensorProductGrid", 
       "MaxPoints" -> 401, "MinPoints" -> 401, 
       "DifferenceOrder" -> 2}}];
Animate[Plot[solH[[1]][x, t], {x, 0, L}, PlotRange -> All, 
  ImagePadding -> 20, PerformanceGoal -> "Quality"], {t, 0, tmax}]

I also tried to solve this directly for $H$ but still I get an empty graph!

L = 5; del = 0.6; g = -0.1; a = 4; s = 0.1; tmax = 3;

ux = s (1 + 0.1   Exp[-(2.5)^2] - m[x, t]);
eqs = {2 s   D[H[x, t], {x, 2}]   m[x, t] -  
    D[D[H[x, t], {x, 4}], t] + 2  s  del D[m[x, t], {x, 2}] == 
   0, -D[m[x, t], t] +  D[m[x, t], {x, 2}] + g  m[x, t]^3 + 
    m[x, t]  (a - ux + del   D[D[H[x, t], {x, 2}], t]) == 
   0}; bc = {H[0, t] == 0, H[L, t] == 0, 
  Derivative[1, 0][H][0, t] == 0, Derivative[1, 0][H][L, t] == 0, 
  m[0, t] == 1 + 0.1  Exp[-(2.5)^2], 
  m[L, t] == 1 + 0.1  Exp[-(2.5)^2]}; ic = {m[x, 0] == 
   1 + 0.1  Exp[-(x - 2.5)^2]};

solb = NDSolveValue[{eqs, ic, bc, H[x, 0] == 0}, {m, k}, {x, 0, 
    L}, {t, 0, tmax}, 
   Method -> {"MethodOfLines", 
     "SpatialDiscretization" -> {"TensorProductGrid", 
       "MaxPoints" -> 401, "MinPoints" -> 401, 
       "DifferenceOrder" -> 2}}];
Animate[Plot[solb[[2]][x, t], {x, 0, L}, PlotRange -> All, 
  ImagePadding -> 20, PerformanceGoal -> "Quality"], {t, 0, tmax}]
$\endgroup$
2
  • $\begingroup$ Related: mathematica.stackexchange.com/questions/303244/… $\endgroup$
    – Michael E2
    Commented May 18 at 0:12
  • $\begingroup$ To solve ${\partial^2 H \over \partial x^2} = f(x,t)$, don't you just need to integrate twice with respect to $x$ (like @goofy did in the related question)? $\endgroup$
    – Michael E2
    Commented May 18 at 0:25

0

Your Answer

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