Professional Documents
Culture Documents
Numerical
Analysis Project
Surface Tension
&
The Meniscus Equation
Fahd Shariff
BSc Maths & Comp. Sci.
1. The Problem
The problem involves finding the shape of an axi-symmetric dew drop given its
volume (V) and contact angle (θ) with the horizontal plane it sits on.
The shape of a dew drop is given by the balance of surface tension and the internal
pressure due to gravity (which must be greater than the external pressure otherwise
the drop will collapse). This balance is represented by the equation
dφ 1
= p0 + z − sin φ ,
ds r
where p0 represents the pressure excess (over the external pressure) at the highest
point O and φ is the angle formed by the tangent to the meridian and the horizontal
axis, as shown in the Figure 2.
dr dz
= cosφ , = sin φ
ds ds
dV dV dz
= × = πr 2 sin φ
ds dz ds
These equations can be integrated step-by-step away from O provided one starts with
a truncated series expansion. This is necessary because…. This is given by
1 1
φ= p 0 s 1 + s 2
2 8
1 2 2
r = s 1 − p0 s
24
1 s 2 1
z= p0 s 2 1 + 1 − p02
4 16 3
π
V=
8
p0 s 4 1 +
s2
12
(
1 − p02 )
Given values of V and θ, our aim is to obtain p0 (correct to 4 significant figures) using
numerical methods and also to find r(s), z(s). This information can then be used to
obtain accurate plots of the dew drop’s cross-section.
Figure 1. Dew Drop on Horizontal Surface
The numerical procedure is based on guessing a value for p0 and then integrating
along the curve until φ = θ. The total volume is unlikely to be the required value, so
we have to adjust p0, using the secant method, and repeat until it is.
Secant Method: This method requires two initial guesses, x1 and x2. The Runge-
Kutta method computes the volumes y1 and y2, using these two guesses for p0. The
secant formula,
x3 = x 2 +
(requiredVolume − y 2)( x 2 − x1) ,
( y 2 − y1)
is used to find the third guess, x3. The volume, y3, is also found. This process is
repeated again, this time using x2 and x3 as initial guesses and so on, until
y3 − requiredVolume ≤ ε , for a specified tolerance ε. Then x3 is the value for p0 that
we are looking for.
Choosing Initial Conditions: At the top of the drop where r(0) = 0, the right hand
dφ 1
side of the equation, = p0 + z − sin φ , becomes indefinite. To remove this
ds r
difficulty we start integrating from the first step instead i.e. our initial conditions are:
1 1
φ1 = p0 h1 + h 2
2 8
1 2 2
r1 = h1 − p0 h
24
1 2 h 2 1 2
z1 = p0 h 1 + 1 − p0
4 16 3
π
V1 =
8
p0 h 4 1 +
h2
12
(
1 − p02 )
Two points, say (φ1,V1), (φ2,V2) are connected by a straight line. Then the volume V3
at φ3 = θ is given by,
(V2 − V1 )
V3 = V1 + (φ 3 − φ1 )
(φ 2 − φ1 )
3. Testing
h steps Runge-Kutta
----------------------------------------------------
0.2 13 9.91376865384744
0.1 26 9.992762997819423
0.05 53 9.996732808349625
0.025 107 9.998730142934706
0.0125 215 9.999728935159231
0.00625 430 9.999915406553772
0.003125 861 9.999993596744698
0.0015625 1722 9.999997367331659
7.8125E-4 3444 9.999999252813307
3.90625E-4 6888 10.00000019559804
1.953125E-4 13777 10.000000393973494
The table shows that the RK4 method converges as the step size is halved. This means
that it is independent of step size. We can obtain a result within our desired accuracy
by choosing a suitable step size.
Testing the Secant Method: The secant method is run a few times using two different
initial guesses each time. The following output table lists these guesses and the values
returned by the secant method (required volume = 10.0 and ε = 0.00001).
Five arbitrary pairs of initial guesses were chosen and the secant method always
returns nearly the same result. Moreover, accuracy can be improved by decreasing
tolerance.
Testing the Linear Interpolation Routine: This routine is run a few times using
different points and comparing results. For example, given two points (1,1) and (3,3)
we know that the y-coordinate at x=2 must be 2, because the equation of the line
joining the points is given by y(x)=x. The results of running the tests are below.
From graphical insight we can tell that the interpolated results returned by the routine
are correct.
4. Results
The program is supplied with the above values. It is also given the step size, h, which
I have taken to be 0.0001. As discussed previously, the RK method is independent of
step size. We must also provide two initial guesses, say 0.1 and 0.2. (All calculations
are done in radians but are printed out in degrees.)
The program proceeds by using the RK4 scheme followed by linear interpolation to
find the volume at both guesses. The secant method then provides the next best guess
based on these results. This process is repeated until the volume returned by a guess is
very close to the required volume. This guess is the required value for p0.
p0 Volume
-------------------------------------------
0.1 73.70023975122307
0.2 45.618628933895884
0.35532808718715636 27.59488119157107
0.5759039626435924 16.27314144428895
0.8539805427330928 9.60979366228202
1.1715544509280496 5.83081651117016
1.4934847834975746 3.769029945933324
1.7697036746388821 2.69955321145784
1.950380641359428 2.2059059596391113
2.025743087073881 2.034536066370253
2.040930833167272 2.002098654299844
2.0419134586792778 2.0000230243380166
2.0419243586481297 2.0000000170553993
p0 Volume
---------------------------------
0.1 73.70023975122307
0.2 45.618628933895884
0.29122920013580006 33.2796152567376
0.3894127916027599 25.17702749674146
0.452145731721328 21.50577518106988
0.47787583582309495 20.230945564051712
0.4825370496241916 20.012128741727192
0.48279541485282507 20.000103258463916
0.48279763334135095 20.000000041754294
1
1 1 1
3
2 5 3 − −
p 0 = 2π + 2 V 3 ≈ 3.1603V 3
3 12
I will now test my program to verify that the value of p0 found for small V, say
V=0.0001 matches that obtained from the equation above.
Running with θ = 135o , V = 0.0001, h = 0.000001, initial guesses = 0.1 and 0.2 gives:
p0 Volume
---------------------------------------------
0.1 73.70023975122307
0.2 45.618628933895884
0.36244982964349004 27.06034243861775
0.5993214705346611 15.49539735655687
0.9166940550908678 8.646751902192074
1.3173879266370423 4.750533974449305
1.8059308716281424 2.5899426632206244
2.391534153089956 1.4084358871701292
3.089563257657711 0.7661293058826033
3.9220485007421675 0.4173836109240588
4.91813950142554 0.22782259990811923
6.114759160737361 0.12458272377948562
7.5575977237516945 0.06823780288700135
9.302419582531668 0.037429654067252495
11.416587388533841 0.020559330609896845
13.980525075747497 0.011310815167363368
17.088465121973503 0.006236498995721983
20.84697569311532 0.0034508250638369694
25.36800426014362 0.0019210262813263291
30.749700162446636 0.0010808458442037056
37.0324149547831 6.196319299271864E-4
44.11090741059947 3.669709011299251E-4
51.59030191226215 2.2951746385137082E-4
58.637868173090595 1.563650451117599E-4
64.06812457559852 1.1990403590183754E-4
67.03249722281222 1.0469875578799488E-4
67.94855158219154 1.0052363219093636E-4
p0 by equation: 68.0865995090776
Difference in p0: 0.1380479268860597
Hence p0 = 67.95 correct to four significant figures. The equation gives 68.09. The
difference in the two values is only 0.1380. Quite accurate!
Using RK4 to compute values for s, r, z and V using p0 = 67.95 and h=0.000001 and
then plotting a graph as before gives:
/**
* Class: DewDrop
* Description: This program uses secant, RK4 and linear interpolation to find the shape of a dew drop
* @author Fahd Shariff
* @version 1.4.1
* @date 3/12/02
*/
//This method sets initial conditions and is run before the RK4 method
//It requires p0 and the step size
public void setInitialConditions(double p0, double h)
{
this.p0 = p0 ;
this.h = h ;
//RK4 method
//returns the volume of the drop
public double doRK4()
{
//must keep track of the prev values (for linear interpolation)
double prev_phi, prev_v ;
do
{
//the ks represent phi (angle)
//the ls represent r (distance from vertical)
//the ms represent z (drop height)
//the ns represent v (volume)
prev_phi = initial_phi;
prev_v = initial_v ;
System.out.println(Math.toDegrees(initial_phi)+"\t\t"+initial_s+"\t\t"+initial_r+"\t\t"+initial_z+"\t\t"+initial_v);
return volume ;
}
//y-y1 = m(x-x1)
double y3 = (xfind - x1)*(y2-y1)/(x2-x1)+y1 ;
return y3 ;
}
//This method simply finds the volume of a drop given p0 using RK4
public double getVolume(double p)
{
setInitialConditions(p,h) ;
return doRK4() ;
}
//This is the secant method.
//Requires 2 initial guesses and desired tolerance.
public void doSecant(double x1, double x2, double tolerance)
{
System.out.println("\np0\t\tVolume") ;
System.out.println("---------------------------------") ;
double y1 = getVolume(x1) ;
System.out.println(x1+"\t\t"+y1) ;
double y2 = getVolume(x2) ;
System.out.println(x2+"\t\t"+y2) ;
double x3, y3 ;
do
{
//secant formula
x3 = x2 + (reqVolume - y2)*(x2 - x1)/(y2 - y1) ;
y3 = getVolume(x3) ;
System.out.println(x3+"\t\t"+y3) ;
//swap
x1 = x2 ;
x2 = x3 ;
y1 = y2 ;
y2 = y3 ;
}
while(Math.abs(y3-reqVolume) > tolerance) ;
//This method tests the secant method by using different pairs of initial guesses
public void testSecant()
{
System.out.println("Guess 1\t\tGuess 2\t\tSecant Result") ;
System.out.println("------------------------------------------------------------------") ;
doSecant(1.0,2.0,0.00001) ;
doSecant(0.1,0.2,0.00001) ;
doSecant(0.1,0.11,0.00001) ;
doSecant(0.2,0.3,0.00001) ;
doSecant(0.01,0.02,0.00001) ;
}
Fahd Shariff
BSc Mathematics and Computer Science Year 3
C315 Numerical Analysis Project