0
$\begingroup$

For some reason I can't see the actual drop on the website, I can only see the axes. Same thing happened when I downloaded the source code and tried it on my installed mathematica. So I wanted to know if this was just me or there is a problem in the code. And if there is a problem, how can i change it to show me the drop?

http://demonstrations.wolfram.com/ConfigurationOfASessileDrop/

and the source code is

Manipulate[
 Module[
  {RHS1, RHS2, sol, sol2, smax = 4, ODEs1, ODEs2, myfunc, myfunc2, 
   myfunc3, s, svalue, svalue2, svalue3, x, z, \[Theta], V, A, tics, 
   data},
  RHS1[U__?NumberQ, s_] := Module[{v},
    v = {U};
    If[s > 
      0, (2 R0value + ( 9.8065^3/gammavalue) v[[2]] - Sin[v[[3]]]/
       v[[1]]), R0value]
    ];
  RHS2[U__?NumberQ, s_, R0_] := Module[{v},
    v = {U};
    If[s > 0,
     (2 R0 + ( 9.8065^3/gammavalue) v[[2]] - Sin[v[[3]]]/v[[1]]), R0]
    ];
  ODEs1 = {\[Theta]'[s] == RHS1[x[s], z[s], \[Theta][s], s], 
    z'[s] == Sin[\[Theta][s]], x'[s] == Cos[\[Theta][s]], 
    V'[s] == -\[Pi] x[s]^2 Sin[\[Theta][s]], 
    A'[s] == 2 \[Pi] x[s], \[Theta][0] == 0, z[0] == 0, x[0] == 0, 
    V[0] == 0, A[0] == 0};
  ODEs2[R0_] := {\[Theta]'[s] == RHS2[x[s], z[s], \[Theta][s], s, R0],
     z'[s] == Sin[\[Theta][s]], x'[s] == Cos[\[Theta][s]], 
    V'[s] == -\[Pi] x[s]^2 Sin[\[Theta][s]], 
    A'[s] == 2 \[Pi] x[s], \[Theta][0] == 0, z[0] == 0, x[0] == 0, 
    V[0] == 0, A[0] == 0};
  sol = NDSolve[ODEs1, {\[Theta], z, x, V, A}, {s, 0, smax}];
  sol2[R00_?NumericQ] := 
   NDSolve[ODEs2[R00], {\[Theta], z, x, V, A}, {s, 0, smax}];
  myfunc[s_?NumericQ] := 
   First[\[Theta][s] /. sol] + \[Theta]end (\[Pi]/180);
  myfunc2[s_?NumericQ] := First[\[Theta][s] /. sol] + 90 (\[Pi]/180);
  myfunc3[s_?NumericQ, R00_?NumericQ] := 
   First[\[Theta][s] /. sol2[R00]] + \[Theta]end (\[Pi]/180);
  svalue = s /. FindRoot[myfunc[s] == 0, {s, 0, smax}];
  data = Grid[{{Style["\nDrop Shape Parameters", 
       14]}, {Grid[{{"Volume (\!\(\*SuperscriptBox[\(cm\), \(3\)]\))",
          First[V[svalue] /. 
           sol]}, {"Area (\!\(\*SuperscriptBox[\(cm\), \(2\)]\))", 
         First[A[svalue] /. sol]}, {"Height (cm)", 
         Abs[First[z[svalue] /. sol]]}, {"Contact radius (cm)", 
         Abs[First[x[svalue] /. sol]]}}, Frame -> All, 
       Spacings -> {1, 1}]}}, Spacings -> {1, 1}];
  svalue2 = smax/2;
  Which[Abs[First[z[svalue] /. sol]] <= 0.01, 
   tics = {{{0, Round[First[z[svalue] /. sol] 10000]/10000.}, 
      None}, {Automatic, None}}, 
   0.01 < Abs[First[z[svalue] /. sol]] < 0.30, 
   tics = {{{0, Round[First[z[svalue] /. sol] 1000]/1000.}, 
      None}, {Automatic, None}}, True, 
   tics = {{{0, Round[First[z[svalue] /. sol] 100]/200., 
       Round[First[z[svalue] /. sol] 100]/100.}, None}, {Automatic, 
      None}}];
  Pane[
   Switch[ctr,
    1, RevolutionPlot3D[
     Evaluate[{{-x[s], z[s]}, {x[s], z[s]}} /. sol], {s, 0, svalue}, 
     AxesLabel -> {Text@
        Row[{Style["x", Italic, 16], Style[" (cm)", 16]}], 
       Text@Row[{Style["z", Italic, 16], Style[" (cm)", 16]}]}, 
     ImageSize -> {550, 350}, AspectRatio -> Automatic, Boxed -> True,
      FaceGrids -> All, FaceGridsStyle -> Directive[Orange], 
     ColorFunction -> 
      Function[{x, y, z, s, r}, Blend[{Blue, LightBlue}, z]], 
     BoundaryStyle -> None, Mesh -> False, 
     Ticks -> {Automatic, Automatic, tics[[1, 1]]}],
    2, Text@
     Grid[{{ParametricPlot[
         Evaluate[{{-x[s], z[s]}, {x[s], z[s]}} /. sol], {s, 0, 
          svalue}, PlotStyle -> Thick, Frame -> True, 
         FrameTicks -> tics, AspectRatio -> Automatic,
         FrameLabel -> {Text@
            Row[{Style["x", Italic, 16], Style[" (cm)", 16]}], 
           Text@Row[{Style["z", Italic, 16], Style[" (cm)", 16]}]}, 
         ImageSize -> {550, 180}]}, {data}}, 
      Alignment -> {Center, Center}],
    3, ParametricPlot[
     Evaluate[{{-x[s], z[s]}, {x[s], z[s]}} /. sol], {s, 0, smax}, 
     PlotStyle -> Thick, 
     ColorFunction -> 
      Function[{x, y, s}, If[s <= svalue , Blue, Red]], Frame -> True,
      ColorFunctionScaling -> False, Axes -> False, 
     Epilog -> {{Thick, 
        Arrow[{{0, -(0.9 First[z[svalue2] /. sol] - 
              First[z[svalue2] /. sol])}, {0, 
           First[z[svalue2] /. sol]}}]}, {Text[
         Style["gravity", 14], {0.00, 
          1.17 First[z[svalue2] /. sol]}, {0, -1}]}},
     AspectRatio -> 0.5,
     FrameLabel -> {Text@
        Row[{Style["x", Italic, 16], Style[" (cm)", 16]}], 
       Text@Row[{Style["z", Italic, 16], Style[" (cm)", 16]}]}, 
     ImageSize -> {550, 350}], 4, VPlot ],
   ImageSize -> {550, 360}]],
 {{ctr, 2, ""}, {1 -> "3D view", 2 -> "drop profile", 
   3 -> "nodoid family"}},
 {{R0value, -0.8, 
   " 1/\!\(\*SubscriptBox[\(R\), \(0\)]\) \
(\!\(\*SuperscriptBox[\(cm\), \(-1\)]\))"}, -0.2, -10, 0.05, 
  Appearance -> "Labeled"},
 {{gammavalue, 72, 
   " \[Gamma] (dyne/\!\(\*SuperscriptBox[\(cm\), \(2\)]\))"}, 30, 75, 
  2, Appearance -> "Labeled"},
 {{\[Theta]end, 90, 
   " \!\(\*SubscriptBox[\(\[Theta]\), \(c\)]\)\[Degree]"}, 10, 180, 
  10, Appearance -> "Labeled"}, ControlPlacement -> Top,
 TrackedSymbols :> {R0value, \[Theta]end, gammavalue, ctr}]

When a drop of liquid with interfacial tension is placed on a non-wetting solid surface, the drop assumes a shape that is determined by the contact angle that the liquid makes at the three-phase contact line, in accordance with the Young–Dupré equation. Under static conditions, the drop shape must also satisfy the Young–Laplace equation of capillarity, which describes the mechanical equilibrium for two homogeneous fluids separated by an interface

$\endgroup$
2
  • $\begingroup$ I see the same problem in version 11.0.1. But not in versions 9.0.1 or 10.4, where the demonstration appears to work as expected. $\endgroup$
    – hmilton
    Jan 6, 2017 at 17:50
  • $\begingroup$ Thank you for replying. Do you have any suggestions on how to make it work on version 11.0.1? $\endgroup$
    – Jun
    Jan 7, 2017 at 0:50

1 Answer 1

2
$\begingroup$

These tweaks seems to make the demo work with version 11:

  • In the 3D plot, RevolutionPlot3D has two curves as arguments. Remove one.
  • In the other two plots, ParametricPlot has Evaluate applied to the curves. Remove Evaluate.

Before tweaks: enter image description here

After: enter image description here

The complete code. I have made some simplifications, removing whats redundant:

Manipulate[
 Module[
  {RHS1, sol, smax = 4, ODEs1, myfunc, s, svalue, svalue2, x, 
   z, \[Theta], V, A, tics, data},
  RHS1[U__?NumberQ, s_] := Module[{v},
    v = {U};
    If[s > 
      0, (2 R0value + ( 9.8065^3/gammavalue) v[[2]] - Sin[v[[3]]]/
       v[[1]]), R0value]
    ];
  ODEs1 = {\[Theta]'[s] == RHS1[x[s], z[s], \[Theta][s], s], 
    z'[s] == Sin[\[Theta][s]], x'[s] == Cos[\[Theta][s]], 
    V'[s] == -\[Pi] x[s]^2 Sin[\[Theta][s]], 
    A'[s] == 2 \[Pi] x[s], \[Theta][0] == 0, z[0] == 0, x[0] == 0, 
    V[0] == 0, A[0] == 0};
  sol = NDSolve[ODEs1, {\[Theta], z, x, V, A}, {s, 0, smax}];
  myfunc[s_?NumericQ] := 
   First[\[Theta][s] /. sol] + \[Theta]end (\[Pi]/180);
  svalue = s /. FindRoot[myfunc[s] == 0, {s, 0, smax}];
  data = Grid[{{Style["\nDrop Shape Parameters", 
       14]}, {Grid[{{"Volume (\!\(\*SuperscriptBox[\(cm\), \(3\)]\))",
          First[V[svalue] /. 
           sol]}, {"Area (\!\(\*SuperscriptBox[\(cm\), \(2\)]\))", 
         First[A[svalue] /. sol]}, {"Height (cm)", 
         Abs[First[z[svalue] /. sol]]}, {"Contact radius (cm)", 
         Abs[First[x[svalue] /. sol]]}}, Frame -> All, 
       Spacings -> {1, 1}]}}, Spacings -> {1, 1}];
  svalue2 = smax/2;
  Which[Abs[First[z[svalue] /. sol]] <= 0.01, 
   tics = {{{0, Round[First[z[svalue] /. sol] 10000]/10000.}, 
      None}, {Automatic, None}}, 
   0.01 < Abs[First[z[svalue] /. sol]] < 0.30, 
   tics = {{{0, Round[First[z[svalue] /. sol] 1000]/1000.}, 
      None}, {Automatic, None}}, True, 
   tics = {{{0, Round[First[z[svalue] /. sol] 100]/200., 
       Round[First[z[svalue] /. sol] 100]/100.}, None}, {Automatic, 
      None}}];
  Pane[
   Switch[ctr,
    1,
                RevolutionPlot3D[Evaluate[{x[s], z[s]} /. sol], {s, 0, svalue},
                AxesLabel -> {Text@
        Row[{Style["x", Italic, 16], Style[" (cm)", 16]}], 
       Text@Row[{Style["z", Italic, 16], Style[" (cm)", 16]}]},
                ImageSize -> {550, 350}, AspectRatio -> Automatic, 
     Boxed -> True, FaceGrids -> All, 
     FaceGridsStyle -> Directive[Orange],
                ColorFunction -> 
      Function[{x, y, z, s, r}, Blend[{Blue, LightBlue}, z]], 
     BoundaryStyle -> None,
                Mesh -> False, Ticks -> {Automatic, Automatic, tics[[1, 1]]}],
            2, Text@Grid[{
                {

        ParametricPlot[{{-x[s], z[s]}, {x[s], z[s]}} /. sol, {s, 0, 
          svalue},
                        PlotStyle -> Thick, Frame -> True, FrameTicks -> tics, 
         AspectRatio -> Automatic,

         FrameLabel -> {Text@
            Row[{Style["x", Italic, 16], Style[" (cm)", 16]}], 
           Text@Row[{Style["z", Italic, 16], Style[" (cm)", 16]}]},
                        ImageSize -> {550, 180}]
                    },
                    {data}
            }, Alignment -> {Center, Center}
            ],
    3,
                ParametricPlot[{{-x[s], z[s]}, {x[s], z[s]}} /. sol, {s, 0, 
      smax},
                PlotStyle -> Thick, 
     ColorFunction -> 
      Function[{x, y, s}, If[s <= svalue , Blue, Red]], Frame -> True,
                ColorFunctionScaling -> False, Axes -> False,
                Epilog -> {
                    {Thick, 
        Arrow[{{0, -(0.9 First[z[svalue2] /. sol] - 
              First[z[svalue2] /. sol])}, {0, 
           First[z[svalue2] /. sol]}}]},
                    {Text[
         Style["gravity", 14], {0.00, 
          1.17 First[z[svalue2] /. sol]}, {0, -1}]}
                },
                AspectRatio -> 0.5,
                FrameLabel -> {Text@
        Row[{Style["x", Italic, 16], Style[" (cm)", 16]}], 
       Text@Row[{Style["z", Italic, 16], Style[" (cm)", 16]}]},
                ImageSize -> {550, 350}]
            ],
   ImageSize -> {550, 360}]
    ],
 {{ctr, 2, ""}, {1 -> "3D view", 2 -> "drop profile", 
   3 -> "nodoid family"}},
 {{R0value, -0.8, 
   " 1/\!\(\*SubscriptBox[\(R\), \(0\)]\) \
(\!\(\*SuperscriptBox[\(cm\), \(-1\)]\))"}, -0.2, -10, 0.05, 
  Appearance -> "Labeled"},
 {{gammavalue, 72, 
   " \[Gamma] (dyne/\!\(\*SuperscriptBox[\(cm\), \(2\)]\))"}, 30, 75, 
  2, Appearance -> "Labeled"},
 {{\[Theta]end, 90, 
   " \!\(\*SubscriptBox[\(\[Theta]\), \(c\)]\)\[Degree]"}, 10, 180, 
  10, Appearance -> "Labeled"}, ControlPlacement -> Top,
 TrackedSymbols :> {R0value, \[Theta]end, gammavalue, ctr}]
$\endgroup$
1
  • $\begingroup$ Wow that really helps thank you so much! $\endgroup$
    – Jun
    Jan 8, 2017 at 11:00

Your Answer

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

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