Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Droplet Profile in Matlab- ODE stability

  1. Apr 11, 2013 #1

    I'm currently modeling the profile of a droplet (sessile drop, axisymmetric) in matlab. I've coded differential equations, applied the solver, and I get a reasonable result, except that it spirals continuously.

    The ODE's in question are:

    ode23/45, etc produce similar results. I could limit my tspan so that the spiral doesn't continue, but I would like it to hit on a stable solution. I have yet to try a boundary value approach, but, while I am familiar with matlab in other areas, I have never used it to solve ODEs, so I would like to try this initial value approach first.

    For solutions I use:

    where p contains two parameters and x0 contains initial angle theta, x, z values.
    droplet ODE function:
    function drpivp = drpivp(s,x,p);
    %r0 is curvature at apex
    %c is capillarity constant
    drpivp=[2/p(1)+p(2)*x(3)-sin(x(1))/x(2); cos(x(1)); sin(x(1))];
    %if you put an 'end' it reduces the required number of arguments - why?


    Attached Files:

    Last edited: Apr 11, 2013
  2. jcsd
  3. Apr 11, 2013 #2
    Thinking about this further, I realized I initialized with [itex] [\theta x z]=[1 1 1] [/itex] just to avoid the NaN issue that rises when using the proper initialization of [0 0 0]. The set of equations is parametrized with respect to the arc length. At [itex] s=0 ,x=z=\theta=0.[/itex]

    To avoid this NaN issue, I need to change [itex] \frac{d\theta}{ds}=b,[/itex] as this is the condition at [itex]s=0[/itex]. It isn't clear to me how to have the first ODE be something different for a particular value of s, though.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook