// plates_column.fe
// Evolver data for drop of prescribed volume between two horizontal plates.
// Contact angle with plates can be varied.

parameter top_angle = 70    // interior angle between plane and surface, degrees
parameter bottom_angle = 70 // interior angle between plane and surface, degrees
parameter height = 1    // separation of plates

gravity_constant 0  // start with gravity off

// Contact surface tensions
#define UPPERT  (-cos(top_angle*pi/180))  // virtual tension of facet on plane
#define LOWERT (-cos(bottom_angle*pi/180))
 
constraint 1   /* the lower plate */
formula: z = 0
energy:  // for contact angle
e1: -(LOWERT*y)
e2: 0
e3: 0 

constraint 2   /* the upper plate */
formula: z = height
energy:  // for contact angle and gravitational energy under missing facets
e1: -(UPPERT*y) + G*z^2/2*y
e2: 0
e3: 0 
content:
c1: z*y
c2: 0
c3: 0

vertices
1   0.0  0.0 0.0  constraint 1  /* 4 vertices on lower plate */
2   1.0  0.0 0.0  constraint 1
3   1.0  1.0 0.0  constraint 1
4   0.0  1.0 0.0  constraint 1
5   0.0  0.0 1.0  constraint 2  /* upper plate */
6   1.0  0.0 1.0  constraint 2
7   1.0  1.0 1.0  constraint 2
8   0.0  1.0 1.0  constraint 2
9   2.0  2.0 0.0 fixed   /* for lower plane */
10  2.0 -1.0 0.0 fixed
11 -1.0 -1.0 0.0 fixed
12 -1.0  2.0 0.0 fixed
13  2.0  2.0 height fixed   /* for lower plane */
14  2.0 -1.0 height fixed
15 -1.0 -1.0 height fixed
16 -1.0  2.0 height fixed

edges  /* given by endpoints and attribute */
1   1 2    constraint 1 /* 4 edges on lower plate */
2   2 3    constraint 1
3   3 4    constraint 1
4   4 1    constraint 1
5   5 6    constraint 2 /* upper plate */
6   6 7    constraint 2
7   7 8    constraint 2
8   8 5    constraint 2
9   1 5   
10  2 6  
11  3 7 
12  4 8
13  9 10 no_refine  fixed  /* for lower plate */
14 10 11 no_refine  fixed
15 11 12 no_refine  fixed
16 12  9 no_refine  fixed
17 13 14 no_refine  fixed  /* for upper plate */
18 14 15 no_refine  fixed
19 15 16 no_refine  fixed
20 16 13 no_refine  fixed

faces  /* given by oriented edge loop */
1   1 10 -5  -9
2   2 11 -6 -10
3   3 12 -7 -11
4   4  9 -8 -12
5  13 14 15  16  no_refine density 0 fixed /* lower plate for display */
6  17 18 19  20  no_refine density 0 fixed /* upper plate for display */

bodies  /* one body, defined by its oriented faces */
1   1 2 3 4    volume 1  density 1

read
re := {refine edges where on_constraint 1 }

// Typical evolution
gogo := { re; g 5; r; g 5; r; g 5; hessian; hessian; }


// Evolution with 45 degree contact angle
gogo2 := { angle := 45; re; g 5; V;V; r; g 5; V;V; r; g 5; hessian; hessian; }

// Evolution with  90 contact and high gravity
gogo3 := { angle := 90; G 5; re; g 5; r; g 5; r; g 5; hessian; hessian; }

// Evolution with  90 contact and negative gravity, i.e. pendant drop
gogo4 := { angle := 90; G -2; re; g 5; r; g 5; r; g 5; hessian; hessian; }

// Pendant drop falling off ceiling
gogo5 := { angle := 90; G -5; re; g 10; t .1; unset vertex constraint 1; g 3; }