next up previous
Next: References Up: "SURFACE EVOLVER" AS Previous: Appendix 1: boundary_phase.fe

Appendix 2: three_spheres.fe

 

/* Evolver file for three spheres,
modeled fluid volume sitting in
interstice.
Bottom one with center at origin,
is fixed, the other rotate around
the center amounts +- theta/2
W. Craig Carter, 1996
*/

SYMMETRIC_CONTENT

PARAMETER phi = 30 // liquid wetting angle
PARAMETER theta = 0 // sphere opening angle
PARAMETER vol = 1.5 // liquid volume
// !!! NEED volconst = -2*pi

#define Rs 1 // sets units

#define gamsl (-cos(phi*pi/180)) // effective energy

/* a bunch of functions below, used for vector integrands */

#define ct2 cos( 60*pi/180 - theta*pi/360 )
#define st2 sin( 60*pi/180 - theta*pi/360 )
#define ct3 cos( 120*pi/180 + theta*pi/360 )
#define st3 sin( 120*pi/180 + theta*pi/360 )

/*radius tex2html_wrap_inline541 2 of bottom sphere*/
#define r1sq (x) tex2html_wrap_inline541 2 + (y) tex2html_wrap_inline541 2 + z tex2html_wrap_inline541 2

/*upper right sphere */
#define r2sq (x - 2*Rs*ct2) tex2html_wrap_inline541 2 + (y - 2*Rs*st2) tex2html_wrap_inline541 2 + z tex2html_wrap_inline541 2

/*upper left sphere */
#define r3sq (x - 2*Rs*ct3) tex2html_wrap_inline541 2 + (y - 2*Rs*st3) tex2html_wrap_inline541 2 + z tex2html_wrap_inline541 2

#define w1num y
#define w1den (x tex2html_wrap_inline541 2 + z tex2html_wrap_inline541 2)*sqrt(r1sq)
#define w1 w1num/d1den

#define w2num x*ct2 + y*st2 - 2*Rs
#define w2den ((st2*x - ct2*y) tex2html_wrap_inline541 2 + z tex2html_wrap_inline541 2)*sqrt(r2sq)
#define w2 w2num/d2den

#define w3num x*ct3 + y*st3 - 2*Rs
#define w3den ((st3*x - ct3*y) tex2html_wrap_inline541 2 + z tex2html_wrap_inline541 2)*sqrt(r3sq)
#define w3 w3num/d3den

constraint 1 //bottom sphere
formula: r1sq = Rs tex2html_wrap_inline541 2
energy:
e1: gamsl*(Rs tex2html_wrap_inline541 2)*w1*z
e2: 0
e3: -gamsl*(Rs tex2html_wrap_inline541 2)*w1*x
content:
c1: ((Rs tex2html_wrap_inline541 3)/3)*w1*z
c2: 0
c3: -((Rs tex2html_wrap_inline541 3)/3)*w1*x


constraint 2 //northeast sphere theta = Pi/6
formula: r2sq = Rs tex2html_wrap_inline541 2
energy:
e1: (gamsl*(Rs tex2html_wrap_inline541 2)*w2*(z*st2))
e2: -(gamsl*(Rs tex2html_wrap_inline541 2)*w2*(z*ct2))
e3: -(gamsl*(Rs tex2html_wrap_inline541 2)*w2*(x*st2 - y*ct2))
content:
c1: -(-(((Rs tex2html_wrap_inline541 3)/3)*w2*(z*st2)) + z*(2*Rs)*st2/3)
c2: -((((Rs tex2html_wrap_inline541 3)/3)*w2*(z*ct2)) - z*(2*Rs)*ct2/3)
c3: -(((Rs tex2html_wrap_inline541 3)/3)*w2*(x*st2 - y*ct2))

constraint 3
formula: r3sq = Rs tex2html_wrap_inline541 2
energy:
e1: (gamsl*(Rs tex2html_wrap_inline541 2)*w3*(z*st3))
e2: -(gamsl*(Rs tex2html_wrap_inline541 2)*w3*(z*ct3))
e3: -(gamsl*(Rs tex2html_wrap_inline541 2)*w3*(x*st3 - y*ct3))
content:
c1: -(-(((Rs tex2html_wrap_inline541 3)/3)*w3*(z*st3)) + z*(2*Rs)*st3/3)
c2: -((((Rs tex2html_wrap_inline541 3)/3)*w3*(z*ct3)) - z*(2*Rs)*ct3/3)
c3: -(((Rs tex2html_wrap_inline541 3)/3)*w3*(x*st3 - y*ct3))

vertices
//:
//:
edges
//:
//:
faces
//:
//:
bodies
//:
//: volconst -2*pi

read
checksmall := {delete edges where length < 0.0001; tex2html_wrap_inline537
delete facets where area < 0.005; u; tex2html_wrap_inline537
delete edges where length < 0.0001; u;g3}

edgemax := 0.4
echeck := {while max(edges,length) > edgemax do tex2html_wrap_inline537
{ refine edges where length > edgemax } ; tex2html_wrap_inline537
checksmall }

grind := { ig:= 1 ; change := 1.; olde := total_energy ; tex2html_wrap_inline537
while (ig < 10000 && abs(change) > .00001) tex2html_wrap_inline537
do {ig := ig+1; tex2html_wrap_inline537
if ig%10 == 1 then checksmall ; tex2html_wrap_inline537
g | "cat > null" ; tex2html_wrap_inline537
if ig%3 == 1 then tex2html_wrap_inline537
{ change := total_energy - olde ; tex2html_wrap_inline537
olde := total_energy; tex2html_wrap_inline537
printf "sum of 3 dE: %12.10f tex2html_wrap_inline537 n", change}}}

goprint := tex2html_wrap_inline537
{ printf "%f %f %20.12f %f " tex2html_wrap_inline537
,phi, theta, total_energy, change | "cat >> results"; tex2html_wrap_inline537
foreach body do { printf "%f ", volume | "cat >> results" } ; tex2html_wrap_inline537
printf "%f ", total_area | "cat >> results" ; tex2html_wrap_inline537
printf "%g ", facet_count | "cat >> results" ; tex2html_wrap_inline537
printf "%f tex2html_wrap_inline537 n", max(edges,length) | "cat >> results" }

dump_to_file := tex2html_wrap_inline537
{filename := sprintf "dump.v_%f_p_%f_t_%f",vol,phi,theta; tex2html_wrap_inline537
dump filename}

inc := {echeck; D; D ; O ; o ;u; theta := theta + 1 ; tex2html_wrap_inline537
printf "%f", theta ;u;g5; biggrind ; tex2html_wrap_inline537
if theta%10 = 0 then dump_to_file; goprint }

run_this := {dump_to_file ; while (theta < 120) do {inc}}


next up previous
Next: References Up: "SURFACE EVOLVER" AS Previous: Appendix 1: boundary_phase.fe

W. Craig Carter
Wed Feb 28 11:27:46 EST 1996