# Droplet Profile in Matlab- ODE stability

1. Apr 11, 2013

### Kudaros

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

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!

#### Attached Files:

• ###### spiral.jpg
File size:
32.9 KB
Views:
113
Last edited: Apr 11, 2013
2. Apr 11, 2013

### Kudaros

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 Discussions: Droplet Profile in Matlab- ODE stability
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.8190159797668457, "perplexity": 1951.7132729514772}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2018-09/segments/1518891812788.42/warc/CC-MAIN-20180219191343-20180219211343-00119.warc.gz"}