Droplet Profile in Matlab- ODE stability

  • Context: MATLAB 
  • Thread starter Thread starter Kudaros
  • Start date Start date
  • Tags Tags
    Matlab Ode Stability
Click For Summary
SUMMARY

The discussion focuses on modeling the profile of a sessile droplet using MATLAB's ODE solvers, specifically the ode23 function. The user encounters a continuous spiral in their results and seeks a stable solution without limiting the time span. The differential equations governing the droplet's behavior include parameters for curvature and capillarity. The user also addresses a NaN issue related to initialization and considers modifying the first ODE to avoid this problem.

PREREQUISITES
  • Familiarity with MATLAB programming
  • Understanding of ordinary differential equations (ODEs)
  • Knowledge of numerical methods for solving ODEs, specifically ode23
  • Concepts of droplet dynamics and capillarity
NEXT STEPS
  • Explore MATLAB's boundary value problem solvers for ODEs
  • Research techniques for stabilizing ODE solutions in MATLAB
  • Learn about parameter sensitivity analysis in ODE modeling
  • Investigate the effects of initial conditions on ODE solutions
USEFUL FOR

Researchers and engineers working in fluid dynamics, MATLAB users modeling droplet behavior, and anyone interested in solving ordinary differential equations in a computational environment.

Kudaros
Messages
18
Reaction score
0
Hello,

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:
<br /> \frac{dx}{ds}=cos(\theta)<br />
<br /> \frac{dz}{ds}=sin(\theta)<br />
<br /> \frac{d\theta}{ds}=2b+cz-\frac{sin(\theta)}{x}.<br />

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:
[s,x]=ode23(@(s,x)drpivp(s,x,p),sspan,x0);

where p contains two parameters and x0 contains initial angle theta, x, z values.
droplet ODE function:
function drpivp = drpivp(s,x,p);
%x(1)=theta
%x(2)=x
%x(3)=z
%r0 is curvature at apex
%c is capillarity constant
r0=p(1);
c=p(2);
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?

Thanks!
 

Attachments

  • spiral.jpg
    spiral.jpg
    32.3 KB · Views: 585
Last edited:
Physics news on Phys.org
Thinking about this further, I realized I initialized with [\theta x z]=[1 1 1] 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 s=0 ,x=z=\theta=0.

To avoid this NaN issue, I need to change \frac{d\theta}{ds}=b, as this is the condition at s=0. It isn't clear to me how to have the first ODE be something different for a particular value of s, though.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 1 ·
Replies
1
Views
6K