0

I am trying to solve a PDE in two variables z and t. This PDE is from "Universality of Capillary Rise" by Zhou and Doi (2020). There is additonally a parameter n that can take positive integer values. The initial condition is defined as a piecewise function with a linear component and a zero component. However, when I attempt to use NDSolve on this problem and examine the output at t=0 the output is not close to the linear profile I specified. Further, while my code performs ok for n=1 it does not come close to evaluating correctly for n=2. Rather, for that case it appears that the code gets stuck and never advances the solution in time. Any help would be appreciated!

geqn[n_] := 
  Simplify[
   1/((3 n + 1 ) G[z, t]^n)* 
    D[G[z, t]^(3 n + 1) (1 + 1/G[z, t]^(n + 1) D[G[z, t], z]), z]];
equilBottom[n_] := (.1*n)^(-1/n);
initialEqn[z_, Z0_, n_] := 
  Piecewise[{{equilBottom[n] (1 - (z - .1)/(Z0 - .1)), 
     0.1 <= z <= Z0}, {0, Z0 < z}}];
eqnList[n_] := {D[G[z, t], t] == geqn[n], G[0.1, t] == equilBottom[n],
   G[20, t] == 0, G[z, 0] == initialEqn[z, 1, n]}

sol1 = NDSolve[eqnList[1], G[z, t], {z, .1, 20}, {t, 0, 1000}] // First; sol2 = NDSolve[eqnList[2], G[z, t], {z, .1, 20}, {t, 0, 50000}] // First; sol11 = sol1[[1, 2]]; sol21 = sol2[[1, 2]];

The output of these two solutions at various values of t is shown below. The output is along the x-axis and the y-axis is z. Note that the black line is the equilibrium solution of the PDE.

enter image description here enter image description here

Further, the initial condition in the case of n=1 is shown below. Note the similarity to the output of the second plot while not obeying the initial condition as specificed in the equaiton.

enter image description here

Here is the code for the graphics:

Import["https://pastebin.com/raw/uUJ4rmc1", "Package"]
colors = Table[parulaNew[i], {i, 0, 1, 1/(5 - 1)}];
plots = MapThread[
   ParametricPlot[{sol11 /. {z -> z0, t -> #1}, z0}, {z0, .1, 20}, 
     PlotRange -> {{0, 1}, {0, 20}}, AspectRatio -> 9/16, 
     PlotStyle -> #2] &, {{200, 400, 600, 800, 1000}, colors}];
equiPlot = ParametricPlot[{1/z, z}, {z, .1, 20}, PlotStyle -> Black];
plots = Join[plots, {equiPlot}];
p1 = Show[plots]

plots2 = MapThread[ ParametricPlot[{sol21 /. {z -> z0, t -> #1}, z0}, {z0, .1, 20}, PlotRange -> {{0, 1}, {0, 20}}, AspectRatio -> 9/16, PlotStyle -> #2] &, {{1000, 2000, 3000, 4000, 50000}, colors}]; equiPlot2 = ParametricPlot[{(2 z)^(-1/2), z}, {z, .1, 20}, PlotStyle -> Black]; plots2 = Join[plots2, {equiPlot2}]; p2 = Show[plots2]

p3 = ParametricPlot[{sol11 /. {z -> z0, t -> 0}, z0}, {z0, .1, 20}, PlotRange -> {{-.1, 1}, {0, 5}}, AspectRatio -> 9/16]

xzczd
  • 65,995
  • 9
  • 163
  • 468
JamesVR
  • 335
  • 1
  • 6
  • 1
    "when I attempt to use NDSolve on this problem and examine the output at t=0 the output is not close to the linear profile I specified." Can't reproduce what you've claimed. Plot[{initialEqn[z, 1, 1], sol11 /. t -> 0}, {z, 0.1, 20}] gives https://i.stack.imgur.com/aVgi4.png Also, please include the code for the attached graphics. – xzczd Jan 27 '23 at 03:15
  • I have edited the post to include the code for the graphics. Due to the physics presented in the original paper we switch the axes, which was not clear from the post. I apologize. However, even in yours you can see some overshoot on the x-axis. – JamesVR Jan 27 '23 at 17:58
  • To be more specific, add e.g. Method -> {"MethodOfLines", "SpatialDiscretization" -> {"TensorProductGrid", "MaxPoints" -> 100, "MinPoints" -> 100, "DifferenceOrder" -> 4}} to NDSolve should resolve the problem, you may use more grid points to achieve better result if you like. Notice the small non-physical peak will always be there because of Gibbs phenomenon. – xzczd Jan 28 '23 at 02:16
  • As to the “gets stuck" part, 1. I don't think it's a Mathematica problem, please double check your model. 2. Please don't ask multiple distinctly different question in one post. – xzczd Jan 28 '23 at 02:31

0 Answers0