// cat.fe

// Evolver data for catenoid.

PARAMETER  RMAX = 1.5088795   // minimum radius for height
PARAMETER  ZMAX = 1.0

boundary 1 parameters 1     //  upper ring
x1:  RMAX * cos(p1)
x2:  RMAX * sin(p1)
x3:  ZMAX

boundary 2 parameters 1    //   lower ring
x1:  RMAX * cos(p1)
x2:  RMAX * sin(p1)
x3:  -ZMAX

vertices   // given in terms of boundary parameter
1    0.00  boundary 1   fixed
2    pi/3  boundary 1   fixed
3  2*pi/3  boundary 1   fixed
4    pi    boundary 1   fixed
5  4*pi/3  boundary 1   fixed
6  5*pi/3  boundary 1   fixed
7    0.00  boundary 2   fixed
8    pi/3  boundary 2   fixed
9  2*pi/3  boundary 2   fixed
10   pi    boundary 2   fixed
11 4*pi/3  boundary 2   fixed
12 5*pi/3  boundary 2   fixed

edges
1    1  2  boundary 1   fixed
2    2  3  boundary 1   fixed
3    3  4  boundary 1   fixed
4    4  5  boundary 1   fixed
5    5  6  boundary 1   fixed
6    6  1  boundary 1   fixed
7    7  8  boundary 2   fixed
8    8  9  boundary 2   fixed
9    9  10 boundary 2   fixed
10   10 11 boundary 2   fixed
11   11 12 boundary 2   fixed
12   12 7  boundary 2   fixed
13   1  7
14   2  8
15   3  9
16   4  10
17   5  11
18   6  12

faces
1   1 14 -7 -13
2   2 15 -8 -14
3   3 16 -9 -15
4   4 17 -10 -16
5   5 18 -11 -17
6   6 13 -12 -18

read

// Evolution to collapse and pop neck, as in Manual tutorial
gogo := { r; u; g 120; t .05; o; g 5; }

// Demonstrating saddle point due to triangulation arrangement.
// First setting parameters to stable values.
gogo2 := { rmax := 1; zmax := 0.55; recalc;
           g; u; r; g 50;  // at this point have nearly a saddle point
           g 200;   // triangulation twists around to lower energy
         }

// Faster version of the above using conjugate gradient
gogo3 := { rmax := 1; zmax := 0.55; recalc;
           g; u; r; U; g 25;  // at this point have nearly a saddle point
           g 35;
         }

// High accuracy evolution, using higher-order Lagrange elements.
gogo4 := { u; zmax := 0.55; rmax := cosh(zmax); recalc;
           r; g 5; hessian;
           r; g 5; hessian;
           lagrange 2; g 5; hessian;
           lagrange 4; g 5; hessian;
           lagrange 6; g 5; hessian;
           lagrange 8; g 5; hessian; 
           true_area := 2*pi*(zmax + 0.5*sinh(2*zmax));
           printf"Difference from true area: %g\n",total_area - true_area;
}
           
           

