A Surface Energy Minimization

advertisement
A Finite Element Surface Tension Model with Forces Based on
Surface Energy Minimization
by
Kipp Whittaker
B.S. Mechanical Engineering
Massachusetts Institute of Technology, 2002
Submitted to the Department of Mechanical Engineering
in Partial Fulfillment of the Requirements for the Degree of
Master of Science in Mechanical Engineering
at the
Massachusetts Institute of Technology
MASSACHUSETTS INSTITUTE
OF TECHNOLOGY
September 2003
OCT 0 6 2003
D 2003 Massachusetts Institute of Technology
All rights reserved
Signature of Author
LIBRARIES
................................
Department of Mechanical Engineering
August 9, 2003
.
C ertified by....................................
...........
.................
Nicolas Hadjiconstantinou
Associate Profe sor of Mechanical Engineering
Thesis Supervisor
Accepted by..............................
Ain A. Sonin
Chairman, Department Committee on Graduate Students
BARKER
A Finite Element Surface Tension Model with Forces Based on Surface Energy
Minimization
by
Kipp Whittaker
Submitted to the Department of Mechanical Engineering
on August 9, 2003 in partial fulfillment of the
requirements for the Degree of Master of Science in
Mechanical Engineering
Abstract
This thesis presents the work performed in the period from June 2002 to
December 2002 at the Lawrence Livermore National Laboratory (LLNL) as part of the
Engineering Internship Program (EIP). During this time, a surface tension model which
uses an energy minimization technique, but which is capable of running entirely in both
Lagrangian and Eulerian modes was developed. The work describes the theory on which
the model is based as well as the algorithmic developments which allow the use of both
Lagrangian and Eularian formulations.
This model has been developed to replace an already existing surface tension
model used by ALE3D code developed at the Lawrence Livermore National Laboratory.
The previous model also used energy minimization rather than curvature to determine
surface tension forces in fluid flow, but the surface could only be used in Lagrangian
formulations because the model was incapable of handling mixed elements.
This thesis also contains verification tests to check the accuracy of the code and
goes on to suggest further improvements. These tests simulate simple spheres as well as
oscillating droplets of water and show error that ranges from 8% to 30%. Part of this
error, however, is due to other approximations within the preexisting LLNL code. The
new model has significant potential if some of the error is reduced.
Thesis Supervisor: Nicolas Hadjiconstantinou
Title: Associate Professor of Mechanical Engineering
2
Acknowledgements
First, I would like to thank my mentor, Rich Becker, and my supervisor, Rich
Couch, who gave me an amazing amount of support and assistance. Second, I would like
to thank my thesis advisor, Nicolas Hadjiconstantinou, whose questions and suggestions
helped me greatly in the writing process. Finally, I would like to thank my parents,
without whose support, none of this would have been possible.
This work was performed under the auspices of the U.S. Department of Energy by
University of California, Lawrence Livermore National Laboratory under Contract W7405-Eng-48.
3
Table of Contents
1. Introduction ....................................................................................................................
6
2 . Th eory ............................................................................................................................
2.1 Surface Tension ............................................................................................
2.2 Energy M inimization and Force Calculation ...............................................
2.3 Finite Element Surface Tension.................................................................
2.3.1 Defining the Surface ...................................................................
2.3.2 The Level Set M ethod .....................................................
2.3.3 Distributing the Forces .................................................................
8
8
8
10
11
13
17
3. Procedures .....................................................................................................................
3.1 Program Outline ..........................................................................................
3.2 ALE3D Description ...............................................................
3.3 Verification Tests ........................................................................................
19
19
21
22
4. Results and Discussion ............................................................................................
26
5. Conclusion ....................................................................................................................
33
6. Appendices ....................................................................................................................
A. The Volume of Fluids M ethod ......................................................................
B. Defining a Planar Approximation ...............................................................
C. M ixed Element Surface Tension Code ........................................................
D. LLNL Memo on ALE3D ............................................................................
34
34
36
39
58
7. References .....................................................................................
63
4
List of Figures
1. Introduction .......................................................................................
6
2 . Th eory ..............................................................................................
2.1 Origins of Surface Tension ........................................................
2.2 Surface Tension in a Plane ..........................................................
2.3 Determining the Surface Tension Forces from Energy Conservation ......
2.4 Surface Tension in the Previous LLNL Code ............................................
2.5 Example of the Level Set Method ..................................................
2.6 Finding the Intersections with the Level Set Method .................................
2.7 Comparison of an Actual Surface and a Surface Defined with Level Set
.
M eth od .................................................................................................
2.8 Approximating a Planar Three Dimensional Surface .................................
2.9 Calculating the Surface Tension Forces of a Triangle (Part I) ...................
2.10 Calculating the Surface Tension Forces of a Triangle (Part II) ................
2.11 Distribution of Forces Based on Intersection Location .............................
. 14
15
15
17
18
3 . Pro ced ures .....................................................................................................................
3.1 Example of Defining a Surface ...................................................................
3.2 Planar Cross Sections of Two and Three Node Droplets ..........................
3.3 Three Dimensional View of a Three Node Droplet ...................................
19
20
24
24
4. R esults and D iscussion ............................................................................................
4.1 Planar Cross Section of the Pressure in a Spherical Droplet ......................
4.2 Comparison of Analytical and ALE3D Solutions to Second Mode of
O scillating Droplet ...............................................................................
4.3 Comparison of Analytical and ALE3D Solutions to Third Mode of
O scillating Droplet ...............................................................................
4.4 Example of Hourglassing ..........................................................
26
26
5 . C on clu sion ....................................................................................................................
33
6. Appendices
A. 1 Comparison of an Actual Surface and a Surface Defined with the Volume
Fluid M ethod ........................................................................................
A.2 Plane Intersections with a Cubic Element .................................................
B.1 An Example of a Non-Planar Surface Being Defined ........................
B.2 Incorrect Surface Defined ..........................................................................
B.3 Ambiguous Surface Defined .....................................................................
8
8
9
10
11
12
13
27
29
32
of
34
35
36
37
38
5
1. Introduction
This thesis details the work performed between June and December of 2002 at the
Lawrence Livermore National Laboratory (LLNL) as part of the Engineering Internship
Program (EIP). As explained below, the task was to assist in the development of a new
method for calculating surface tension forces using energy minimization methods. This
method will be used in the numerical investigation of the stability of droplets falling in
air [1], which is part of a collaborative project between LLNL and the University of
California at Santa Barbara (UCSB). LLNL is creating a computer model using code
developed at the laboratory, ALE3D, while UCSB is running the physical experiments to
verify the model. In the experiments, falling droplets can display a variety of motions
depending on the initial conditions and material properties, ranging from a stable
raindrop to bag formation and breakup. So far, the code developed at the laboratory has
only been able to accurately model certain aspects of these experiments, namely the
conditions under which the droplet remains intact. This limitation is a result of the
inability of the surface tension model to run in an Eularian mode.
Most surface tension models rely on calculating the curvature of the surface in
order to determine the resulting forces. The LLNL implementation, however, has taken a
different approach, attempting to minimize the energy stored in the surface between the
two materials. A potential benefit of this method is that it should not break down at the
cusps which form when surfaces come together or break apart [2]. These singularities
can cause problems in curvature calculations. The limitation is that the LLNL code only
works if the surface lies on an element face, which is why the surface has been limited to
a Lagrangian mode.
The goal of this work is to create a surface tension model based on the same
surface energy minimization principles, but which is capable of operating when the
surface lies within an element. This thesis will first describe the theory behind surface
energy minimization. It will then describe the method used to define a surface and
distribute the forces within an element leading to an outline of the entire program. The
method will be verified by comparing our results with the analytical solutions to
problems for which the latter exist.
6
The final objective is to expand LLNL's capabilities of modeling falling droplets.
Thus, it is necessary for the code to allow for mixed element surface tension calculations
without a large increase in error as compared with the original LLNL implementation.
7
2. Theory
2.1 Surface Tension
Surface tension has the units of energy per unit area and is a result of the
imbalance in intermolecular forces at the boundary of two materials. Typically, a system
has a lower energy when the molecules of the same species neighbor each other than
when they are mixed with the other species, as can be seen in Figure 2.1. This figure
gives a simplified schematic demonstration of the origin of surface tension; for more
details, the reader is referred to [3]. If each arrow in the figure represents a molecular
interaction that lowers the energy associated with molecule, then the molecules at the
interface of Species A and B have more energy associated with them when compared
with the molecules in the bulk of the fluid. The energy associated with the surface
tension is the extra amount of energy due to the above disparity in attraction for each unit
of area [4].
*
0
0
0*+.*Q
Species B
Species A
Figure 2.1 Species A has high intermolecularforces, while the intermolecularforces between Species A
and B are low. This leads to an unequal distribution offorces on the molecules of Species A near the
boundary between the two, and the phenomenon known as surface tension.
2.2 Energy Minimization and Force Calculation
While surface tension is a direct result of forces at the molecular level, many of
the areas of interest are at the macroscopic level. At this level, surface tension can be
described as a force applied along the surface in order to minimize the surface energy for
the system in reaction to forces applied to that system. Thus, the actions of the system
can be modeled by the simpler model of a force along a "mathematical interface" so long
8
as the surface energy per unit area associated with the two species and the external forces
are both known.
To begin, we will take a look at the simple case of a plane between Species A and
Species B, as seen in Figure 2.2. On the left, the force from the surface tension lies
entirely within the plane because there is no deformation. However, assuming the edges
of the plane remain fixed, if an applied force, Fapplied, causes a slight deformation, the
force from the surface tension will return the system to a planar state upon removal at the
external applied force.
Side View
Species A
Species B
Fapplied
Top View
Figure2.2 A planar surface with no externalforces is shown on the left. On the right, a force normal to
the plane causes a deformation, which results in reactionaryforces attempting to restore the surface to
planar.
The underlying principle is that the surface tension forces are applied along the
surface in such a way as to minimize the surface area and surface energy in the system.
With the energy of the surface being directly proportional to the area, the surface energy
is given by
E= A
(1)
with E being the energy, cT being the energy per unit surface area, and A being the surface
area in the element. Looking at a single point on a surface, the deformation of that point
affects the magnitude and direction of the surface tension forces by affecting the surface
area. Assuming a finite planar surface, it is possible to derive the magnitude of the force
as a function of the change in surface area with respect to change in position. Looking at
9
Figure 2.3, an energy balance between the original and deformed surface yields the
equation
(2)
F~dx + EOriginal
Defor,ed =
where E is the energy stored in the surface, F, is the external force on the upper left point
in the x direction, and dx is the change in position of that point in the x direction.
Deformed Surface
Original Surface
~dx
Figure2.3 Taking an energy balance between the originaland deformed surfaces, it is possible to
determine the magnitude of the surface tension forces.
Substituting Equation 1 for the initial and final surface energies, Equation 2
becomes
OADeformed=JFJdx+ OAoriginai.
(3)
It should be noted that by convention in the finite element code, the surface
tension forces on the nodes are considered external forces. Thus, the sign for the surface
tension force on a node in the x direction, F, would be the opposite of Fx for the
purposes of energy conservation because it is work being done by the element rather than
on the element. Substituting the surface tension force in the element for the external
force and assuming that the change in position is differential to divide both sides by that
change in position, Equation 3 becomes
F
dA
dx
This is the magnitude of the surface tension force in the x direction. Repeating
this for all three directions, we find
F,, = -J
FA
(5)
10
with Fi being the force on a point in the i direction and xi being the position in the i
direction. This is the energy minimization equation desired.
2.3 Finite Element Surface Tension
In finite element programs surface tension forces must be discretized and applied
to the nodes of the elements containing the surface. This discretization can be the source
of significant error and is based on element size, element type, and the particular method
of calculation chosen.
In previous implementations, discretization issues were very limited because the
surface was required to lie on the face of an element. This meant that error was limited to
that introduced by the fact that curved surfaces were being represented by planar faces of
elements. Additionally, the previous implementation made the surface definition and
force calculation very simple, as seen in Figure 2.4 [1]. The drawback was that the code
was limited to running the surface in a Lagrangian mode in order to keep the surface on
the face of elements. This prevented the code from allowing fluids to break apart or
coalesce as well as negating the advantage of the energy minimization technique of being
able to handle cusps that other surface tension models could not.
al~
Ael
Figure 2.4 Using Equation 5 with the surface on an elementface, the surface tensionforce on the nodes of
can be found by taking the derivative of the face's area with respect to position. This force will attempt to
minimize the areaand, therefore, the energy associated with the surface.
In order to use the energy minimization technique within elements, it was
necessary to define the surface, or define the interface between two materials in an
element containing two materials, and distribute the forces between the nodes. Both of
these actions were inherent in the previous implementation.
2.3.1 Potential Methods for Defining the Surface
There were two major methods in the scientific literature for defining a surface
using volume fraction, the volume of fluids method [5], [6], [7] and the level set method
11
[2], [8], [9]. Defining a surface, however, requires access to a variety of solution
variables. Unfortunately, our definition had to be made within the constraints of the
variables available by the already existing LLNL code. For defining a surface, the
volume fraction of a fluid within an element was the only relevant variable that was
already defined.
The volume of fluids method uses the volume fractions of the fluids in
neighboring elements to define a surface normal within an element [5]. It then uses that
surface normal with the volume fraction to define a planar surface in three dimensional
elements (See Appendix A). The disadvantages of this method are: first, this approach is
very computationally intensive and second, there is no continuity of the surface between
elements [4]. While the latter is aesthetically displeasing, it also creates problems with
forces balancing properly when they are distributed between the nodes.
The level set method uses a much simpler mathematical scheme, and can be
compared in many ways to a contour line on a topographic map [2]. Using the volume
fraction of one material as the altitude in the topographic analogy, the surface can be
located where the volume fraction is .5. A two dimensional example can be seen in
Figure 2.5; more details and derivations are given below. The disadvantages of this
method are: first, the intersections of the surface with the element edges do not
necessarily define a plane in three dimensions and second, the final volume fraction for
an element based on the surface does not necessarily equal the given volume fraction
[10]. The intersections not defining a plane is an issue because the force calculation from
Equation 5 is much simpler for a plane. The apparent lack of "mass conservation" is not
a problem, however, because the surface tension code does not actually redefine the
volume fraction or in any way interact with the mass conservation. The advantages of the
level set approach are that the surfaces are guaranteed to line up from element to element,
and the process requires relatively few calculations.
12
.60
.20
0
.67
1
.88
.26
.14
.58
____
___.97
1
_
_
_
_
.30
Figure 2.5 Averaging the volume fractions of the elements, the nodal volume fractions are written next to
the nodes. Using the nodal volume fractions,the intersectionpoints of the surface with the edges occurs
where a value of.5 occurs with a lineardistributionbetween the nodes.
Comparing the volume of fluid method with the level set method, the level set
method is better suited to our application mainly because of its surface continuity
properties and superior computational efficiency. For that reason, it will be developed
more fully in the next section.
2.3.2 The Level Set Method
The first step in the implementation of this method is the definition of a scalar
function, the nodal volume fraction. This nodal volume fraction is a volume weighted
volume fraction of the neighboring elements and is given by
n
E(vf x Vi)
NVF =
n=1
(V
(6)
i=1
where NVF is the nodal volume fraction, vfj is the volume fraction of element i, Vi is the
volume of element i, and n is the number of elements around the node. A two
dimensional example of the application of Equation 6 is shown in Figure 2.5.
The nodal volume fraction is then used to define the locus of the surface based on
where the volume fraction is equal to 0.5. A two dimensional example of a linear
interpolation can be seen in Figure 2.6. The location of the interface is determined by the
equation
(.5 - nvf)
/(nvf 2 -nvf 1 )
(7)
13
where x/L is the fraction of distance between node 1 and node 2 of the intersection, and
nvfi and nvf 2 are the nodal volume fractions for nodes 1 and 2 respectively.
nvfl = .3
nvf 4 = .1
x
L
1
nvf 2 = .7
nvf 3 = .3
Figure 2.6 With the nodal volume fraction written next to each node, the intersection of the surface with an
edge can be seen to occur where the value of .5 occurs assuming a lineardistribution.
For a group of elements, the right side of figure 2.7 shows how the level set
method would draw the surface given the actual surface on the left side.
As mentioned above, the level set method does not actually define the surface, but
rather defines the intersection points of the surface with the edges of the element. In
most two dimensional cases, this is not an important distinction. However, for three
dimensional cases, it is very important. This is because, in two dimensions, the line can
only intersect an element at two points, which uniquely defines a line. In three
dimensions, however,
.42
.21
.4
.90
.67
._261
.42
.01 .90
58
.07
.62
.15
.21
.04
..
27 _
.97
.58
.07
.62
.15
.01
_261
Figure 2.7 Averaging the volume fractions of the material below and to the left of the surface, the nodal
volume fractions are written next to the nodes. Using the nodal volume fractions, the intersectionpoints of
the surface with the edges occurs where a value of.5 occurs with a lineardistribution between the nodes.
14
a plane can intersect an element at up to six points. Of course, six points over-defines a
plane. For the sake of simplicity, then, the surface within each element is defined as a
series of triangles made by consecutive edge intersections and the centroid of the surface
defined by the intersections' average coordinates. This is described a little more in depth
in Appendix B, though an example can be seen clearly in Figure 2.8.
Figure 2.8 Using the edge intersectionsdefined by the level set method, a surface midpoint is defined. The
midpoint and edge intersections define the surface as a series of trianglesfor the force calculations.
Using only triangles, then, allows for a more simple calculation of forces. For a
triangle whose vertex coordinates are (al, a2, a3), (bl, b2, b3), and (ci, c2, c3) as seen in
Figure 2.9, calculating the force from surface tension requires taking the differential of
the area with respect to position according to Equation 5.
c, (cI, c2, c3)
v2
a, (al, a2, a3)
v
b, (b 1, b2, b3)
Figure 2.9 Using one of the trianglesdefining the interface in Figure 2.8, the algorithmfor calculating
forces with the level set method will be shown. The first step is calculatingtwo vectors of the triangle, seen
above as v, and v 2.
15
To differentiate the area with respect to position, two vectors in the triangle connecting
vertices a to b and b to c, vi and V2 respectively, must first be found. These vectors are
given by
vI = (b - a, )i'+(b2 - a 2 ) +(b 3 - a3)1
and v 2 = (c -bI )i+(c2 -b
2
)+(c-b)
(8), (9)
Using Equations 8 and 9, the surface normal, n, with magnitude twice the area of
the triangle can be found as
n= vxv
2
=+(v( 1 ,
v -
2
*iV/+ l±(V2*
v
v,1
V 2 k)J+(V,
+k
-V2
-
. vVg
iV2;
(10)
where vi, vj, and vk are the components of their numbered vectors in the i, j, and k
directions. The surface normal can then be used to determine the area, A, according to
the equation
A= I
2k
2
n=-+ n
(1), (12)
where ni, nj, and nk are the components of the surface normal in the i, j, and k directions
respectively.
To determine the surface tension force, the area must be differentiated with
respect to position. As an example, we will differentiate the area with respect to position
of vertex a. Taking the differential in the i direction, we get the equation
dA
dal
4
-- (n n) --W'
I n
+n
+
Tn dai
4A
da,
da,
dnk
(13)
da,
Taking this derivative through, the differential of the area with respect to the
position of a in the i direction follows the equation
dA = I
da, 4A
j
.(-k 1 ))
k
(14)
Repeating this for each vertex in each direction, the derivative of the area with
respect to position follows the equations
k
ijk
S
= det ni
ni
2i
2j
aa
,
nk
V2k
j
n
i
J
= det
ni,
Lvii
+ v2
V
+ v 2j
1
k
and
n
VIk
2k
16
Fij
k
=xdet n,
LVIi
ni
nk
Vj
Vlk
(15), (16), (17)
The forces on each point can then be found from Equation 5 as
i
Fa=-a
det ni
j
n
v2i
-det
, F,=-
n
k
ij
k
n
V
ki
i
j
k
Fe = -a -det n,
ni
nk
Vli
Vj
Vlk
2i
n
nk
V1 j + V2j
VIk + V2k
,and
(18), (19), (20)
where Fa, Fb, and F, are the forces on vertices a, b, and c respectively. In the case of
polygons, the force at the centroid is not calculated, as seen in Figure 2.10.
KFc
Fb
.......................................
Figure 2.10 Using one of the trianglesdefining the interface in Figure 2.8, the algorithmfor calculating
forces was used to find Fb and F,. These forces must then be distributedbetween the nodes of the element.
Note that defining the surface as approximately planar within each element can
result in significant error if the solution requires significant curvature within the element.
Thus, this approximation requires that the element sizes be small enough for a planar
approximation to hold. Of course, the Lagrangian approach used before was subject to
the same requirement with the surface lying on the faces of elements, but potential
approximation errors were more visible before even running the program.
2.3.3 Distributing the Forces
With the forces at the edge intersections known, the next step is to distribute the
forces between the nodes. The force distribution was taken to be linear, based on the
17
position of the edge intersection. Thus, the surface tension force at each edge intersection
is distributed between the nodes containing that edge according to the equation
F., = (I - x/L)Fe.
(21)
where Foi is the force in the i direction at the node, x is the distance between the node and
the edge intersection, L is the length of the edge, and Fei is the force in the i direction at
the edge intersection. An example of this can be seen in Figure 2.11. In this two
dimensional example, the surface intersects the edge three quarters of the way from node
1 to node 2, so three quarters of the force, Fe, is applied to node 1 and the other quarter is
applied to node 2.
Node 1
x
L
Fe
Node 2
Figure 2.11 Using a lineardistributionof the forces based on edge intersection location, one quarterof the
force, in this case, would be applied at node 1, and three quarters at node 2 because the intersection is
three times asfarfrom node I as node 2..
18
3. Procedures
We now describe the implementation of the theoretical model presented above.
The necessary modifications to the already existing LLNL code can be summarized in the
following list of five functions: 1) determine which elements contain fluid interfaces, 2)
calculate the nodal volume fractions for the nodes of those elements, 3) define the
interface, 4) calculate the surface tension forces, and 5) distribute the forces between the
element nodes. The full commented code, not including the pre-existing LLNL code, can
be found in Appendix C.
Once the program was written, it was necessary to test it with known static and
dynamic fluid problems in order to ensure that the model was working properly.
3.1 Program Outline
The final program consisted of 5 main functions. The first part of the program
determined which elements contained the two materials of interest and, therefore, needed
to have a surface defined and forces calculated. This was done by checking the volume
fractions of the two materials of interest for each element, and storing the element
numbers of those elements that had a volume fraction greater than zero for both
materials. The other four functions were then applied to each of these elements.
First, the nodal volume fractions were calculated. This was achieved by cycling
through the nodes of each element. For each node, we calculated the weighted volume
fraction described in Equation 6.
The nodal volume fractions were then used to determine the edge intersections
and the surface. Rather than determining the surface from scratch each time, though, a
table of possible surfaces was defined. This required more memory storage, but resulted
in fewer calculations and faster execution time. Each element containing a surface was
characterized by an eight digit binary number; each digit in this eight digit number
corresponded to one of the eight nodes of a three dimensional element. If that material's
nodal volume fraction at node 1 was greater than .5, the first digit was 1. If the nodal
volume fraction was less than .5, the first digit was 0. By repeating this for the other
seven nodes, an eight digit case number was defined. Looking up the case number in a
table, the program recognized the order of the intersections for the definition of the
interface as well as the number of interfaces in the element. An example can be seen in
19
Figure 3.1, with more details in Appendix B and the actual code in Appendix C. In the
case of multiple surfaces within an element, the volume fractions were not enough to
provide a unique solution for the definition of the surface. In these cases, unique
solutions were previously selected and defined in the tables.
The locations of the intersections were also calculated in the surface definition
portion of the code, with the intersection positions calculated and stored by surface
number and then by edge as read from one of the tables.
These intersections were used to calculate the forces on each edge by
differentiating the area of the triangle, for three sided polygons, or triangles made with
consecutive intersections and the centroid for four, five, and six sided polygons. These
force calculations are summarized by Equations 18, 19, and 20, and were stored as edge
forces for each edge of the element.
Finally, these forces were distributed between the nodes at the end of each edge.
This was done according to the linear distribution described in Equation 21, with x/L
having been calculated during the surface definition portion of the program.
.8
.88
.87
11
12
910
...6'
...
1
Binary case = 11000001 (193)
No. of Surfaces[193] = 2; Edges[193]= {4, 1, 9,0,6,12, 11, 8, 0, 0, 0...}
Figure 3.1 The figure on the left, with nodal volumefractionsfor nodes 1-8 marked, would have its
surfaces defined as the figure on the right based on the binary case and table entries seen. The numbers in
the figure on the right indicate the edge numbers.
An additional function accounted for the case when the surface happened to lie
exactly on an element face. This function looked at the two elements on the sides of each
20
face, and if they were each pure elements of the two materials of interest, it calculated
and applied the forces using the Lagrangian version of this model.
3.2 ALE3D Description
ALE3D (see Appendix D) is a 3D Arbitrary Lagrange-Eulerian (ALE) finite
element code that treats advection as a Lagrange step plus an advection step involving
mesh motion and remap of state variables into the new mesh. The code has many
similarities with DYNA3D [11], CALE [12], and ABAQUS [13] depending on the
problem being analyzed.
Calculations in ALE3D can be separated into two main steps, a Lagrange step and
an advection step. The Lagrange step is the only step used when the problem is not being
run in ALE or Eulerian mode, and has much in common with DYNA3D. It consists of
calculations for acceleration, strain rate, and viscosity using the same algorithms as
DYNA3D and strain and PdV work using algorithms similar to those in HEMP [14].
That is, the Lagrange step uses the lowest order finite element with a lumped mass
matrix, and the time integration is formally second order accurate. The PdV work is
integrated using a third order Runge Kutta method and treats shocks by using an artificial
viscosity. The constitutive models and their evaluation are similar to those used in
DYNA3D.
The advection step consists of remapping the mesh all or part of the way back to
the original mesh depending on whether the mode is ALE or Eulerian. This remap step
uses a second order, monotonic advection algorithm for pure elements and a first order,
upwind advection for mixed elements. The material interfaces for mixed elements are
not explicitly constructed, but are inferred from volume fractions with integrity
maintained by using a system of preferences for moving material through mixed zones.
All the elements in ALE3D are hexahedra that can be generally connected. This
general connectivity means that elements that are physically connected in the problem are
not similarly connected in the data structures. Additionally, while the elements are all
hexahedra, an individual node can be attached to any number of elements. These two
differences between ALE3D and other codes with a similar advection strategy prevent
ALE3D from using 1 D sweeps in each direction for calculations, thus requiring a
different algorithm. This algorithm does not handle material flow at the corner of an
21
element with as much accuracy as other codes, but it does allow for greater zoning
flexibility.
For fluids problems, like the verification tests described below, a history
independent, linear viscous fluid model was used. The equations simplify to the NavierStokes relations for this model, providing appropriate solutions for the verification tests.
3.3 Verification Tests
Verification began with simple tests, such as the force on the ends of a planar
surface and the pressure within a spherical droplet of water. Subsequently, the problem
of a droplet deformed to one of its natural modal shapes was run, to see if the numerical
solution matched the theoretical prediction for the oscillation amplitude and frequency.
Eventually, a comparison with the UCSB experimental results will be attempted, but
these tests will not be covered in this thesis. All of the current tests were run with only
two materials in the problem, specifically air and water.
For a spherical water droplet, the surface tension forces create a pressure
difference between the interior and exterior of a drop [4]
p=
r
(22)
where p is the pressure difference, r is the radius, and Yis the surface tension. In our test
problem, the sphere had a radius of 1 mm and a surface tension of 131.5 N/m. The rest of
the properties for the two fluids were that of water for the spherical droplet and air for the
surrounding material. This gave the droplet a bulk viscosity of .001 kg/m sec in addition
to an artificial viscosity used to damp out pressure waves. The problem was run for
50,000 cycles, with an average pressure taken within the droplet every 100 cycles.
The oscillating droplet problems, in contrast, were dynamic and closer to our goal
of modeling the UCSB experiments. The test cases consisted of a droplet with a radius of
1mm deformed to begin with either two or three lobes to model the second and third
modes of spherical harmonics [15], [16]. These can be seen in Figures 3.2 and 3.3, and
had an initial velocity of zero. Like the spherical droplet, these droplets were given the
material properties of water with the exception of bulk viscosity, which was set to zero.
It should be noted, however, that there was still an artificial viscosity inherent in ALE3D
as part of the numerical solution as well as viscosity to prevent some spurious motions.
22
This created some error since the analytical solution for the motion of the droplets is
inviscid. The competition between surface tension and inertia caused the droplets to
oscillate according to the equation [17]
r = ro + 7(t)* YM (0,q)
(23)
where r is the radius in the direction (0,(p) at time, t, ro is the radius of the sphere, q is the
time dependent amplitude, Y'"is the spatial component in spherical harmonics, n is the
number of nodes, and m is an integer denoting the azimuthal dependence. In this case,
the droplets were taken to be independent of the azimuthal angle, so m is zero. The
amplitude, q(t), is given by [17]
d2
2
.
2
+O ,-)=0 and 0g =(n - 1)(n + 2)
dt2
2
(24), (25)
3
where o, is the natural frequency, p is the density, and the other variables are the same as
defined elsewhere. The solution for q(t) is [17]
q = A, cos(on t) + A2 sin(Cat)
(26)
where A, is taken to be .634 and A2 is taken to be zero, the same initial conditions used to
verify the previous implementation of LLNL's surface tension model [16]. We
performed tests for n=2 and n=3 for which [15]
2
( =
co29
3
2x
'
-s2
2-
2
Y 0 9-
and Y(
(2
75
4
-cos
3--c
3
os
2
.
(27),(28)
In both the n = 2 and n = 3 droplet verification tests, Y was chosen to make the period of
the droplet 100pts.
The mesh was defined by first using 100 discrete points to define the curve given
by Equation 23 at time zero and 0 from zero to pi. This curve was then revolved around
the polar axis to define the volume with a square mesh laid over the top to define the
finite element mesh. The densest mesh used an eight node cubic element with each side
of length .025 mm for the ro of 1 mm. In the case of the second mode droplet, symmetry
was used to run one eighth the problem size, while in the third mode droplet, symmetry
was used to reduce the problem size to one quarter. In other words, the second mode
droplet was run only in the positive x, y, and z, while the third mode droplet was run in
the positive y and z and both positive and negative x directions. The droplet problems
23
were run through one period of oscillation to have their surface positions and periods
compared with the analytical solutions.
1.5
1.0
1.0
0.5
0.0
x
EL
-0.5
-0.5-
-1.5
-1.5
-1.0
N.
-0.5
C F
0.0
0
B (i0e-SC
-1.0
1.0
1.5
-1.5
-1.0
-
-0.5
0.0
0.
CX Rx,5 flie-3)
1.0
1.5
Figure 3.2 A planarcross section of a second mode droplet is on the left, and a third mode droplet is on the
right. In both cases, these droplets are at time zero, with no initialvelocity. This planarview is simplerfor
comparing the ALE3D solution with the analyticalsolution.
Figure3.3 This three dimensional view of the second and thirdmodes of the droplet at time zero allowsfor
better visualizationof the problem.
The final part of the verification tests was to run a mesh density study. This study
consisted of the same verification tests described above, but with less dense meshes. The
three node droplet was run with element side lengths of .05 mm and .1 mm and the two
24
node droplet was run with element side lengths of .05 mm and .125 mm, both of which
are subsets of the densest mesh.
25
4. Results and Discussion
The sphere problem, shown in Figure 4.1, was close to the analytical solution,
when averaged over the area and time, but exhibited worse local accuracy. There was a
significant amount of checkerboarding, resulting from elements storing only one
pressure. This allowed for a node to have two high pressure and two low pressure
elements around it, without experiencing a net force. It is also possible that the unusual
pressure patterns were a result of the sudden application of force. More specifically, the
surface tension was zero just before time zero, experiencing a step increase along the
surface at time zero. This resulted in a pressure wave in the droplet that bounced back
and forth between the surface and the center, being slowly damped out by both the
material and artificial viscosities. The solution was obtained by waiting until the pressure
waves were almost all damped out and averaging the droplet pressure over a few time
steps afterward. An alternate method would have been to give the droplet an initial
pressure to avoid the pressure waves.
PC
V
Pr p.
'eVer
BEI
J O31
00. 0000
37. 5000
375.0000
-312.5000
k 250. 0000
62.5000
It0.*0000
Ma,,.
1. 389e -0
-2. 03Be 06
M.
Me1me
,,r3
oz 5
Figure 4.1 This figure is a cross section of the sphericaldroplet of water and air with pressure as the
plotted variable. According to theory, the pressure should be uniformly 2.63e5 Pa. There is, however, a
checkerboardpatternfrom the finite element type used as well as the initialpressure waves from sudden
applicationofforce. The averagepressure in the figure is 2.42e5 Pa, an 8% error.
It is important to note that the pressure is on the low side because some of the
force is being applied to the air outside the droplet, while some is being applied to the
26
water inside. Because the surface does not lie directly on the nodes, some of the force is
going to be applied to material which would otherwise not experience it. The net error of
8% for the spherical droplet is within reason and stems from a combination of both the
surface tension model and the finite element code.
Figures 4.2 and 4.3 display snapshots of the oscillating droplet in the plane z = 0.
These snapshots are shown at eighth period intervals for both the analytical and ALE3D
0.00175
-
S
1.0-
0.2-fi
-1.5
0.00175
-0.00175
-1.0
-0.6
0.0
0.5
Pas (10e-3)
1.0
1.5
4.2 (a) The second mode of sphericalharmonicsfor a droplet. On the left is the analyticalsolution, on the
right is the ALE3D solution. This is at wt = 0.
0.00175 .61 .41.2Q)
1.0x
0.6-
(
0.14
0.20.0-1.6
0.00175
-0.00175
-1.0
-0.6
0.0
0.5
1.0
1 .5
0.5
1.0
3.6
Y Pxos fle3
4.2 (b) Wt = 7r/4
0.00175 1.61.4S
6
S
0.80
0.60.40.2-
-0.00175
0.00175
-1.5
-1.0
-0.5
x
0.0
SxOs
(loe-8)
4.2 (c) wt = 7r/2
27
0.00175 1.61. 1.21.00.80.60.40.2-
-0.00175
S- s
0.00175
-1.5
-1.0
-0.5
-1.0
-0.5
0.5
1.0
1.5
0.0
0 5
PAxs (toe-3)
1.0
1.6
0.0
Ax.s (toe-3)
4.2 (d) wt = 3e14
0.00175 1.6-
1.41.26
6
1.00.80.60.40.2-
-0.00175
1.5
0.00175
x
4.2 (e) tot =7r
0.00175 3.61.41.21.00.80.60.4
0.2
I!
0.0-
0.00175
-0.00175
1.5
-1.0
-0.6
x
0.
0.0
Pxs (loe-3)
1.0
1.6
1.0
1.6
4.2 (f)wt = 5e14
0.00175 .61.41.25
5
1.00.8-
7
(
0.6
0.40.2L71. L1-
-0.00175
0.00175
-1.5
-1.0
-0.6
X
0.0
0.6
Pxs (tOe-3)
4.2 (g) aft = 37r12
28
0.00175 -
1.21.06
C1
0.6-
7
0.60.4-
-0.00175
0.00175
-1.6
-1.0
-0.6
0.0
0.6
X Po'S floe-3)
1 .0
10
1.6
4.2 (h) ot = 77r1/4
0.00175 1.6-
I)
0
0.66
/
0.6-
0. 4 -
I
/
0.2-
i
-0.00175
0.00175
-1.5
-1.0
-0.6
0.0
0.6
X Ax.s HO1-Oh
-1.5
-1.0
-0.5
1.5
4.2 (i) ot = 27
0.0015
-
2In
I)
0
0. 8-
11
6
-0.00175
0.
0-
0.00175
0.0
0 Pxbs
0.6
1.0
1.5
[10e-31
4.3 (a) The third mode of sphericalharmonicsfor a droplet. On the left is the analyticalsolution, on the
right is the ALE3D solution. This is at cot = 0.
0.0015 -
1.2In
/
0
*
0
0.8-
0
1
-0.00175
6
N0.00175
0.0-
-1.5
-1.0
-0.6
X
0.0
Pxis (10e-3)
05
1 0
1.5
29
4.3 (b) ot = 7r14
0.0015 -
1.2In
&
0.8-
a
I-
0.4-
0.0-
0.00175
-0.00175
-1.0
-0.5
0.0
0.5
X PxIs [I0e-3)
-1.0
-0.5
-1.6
-1.0
-0.5
0.0
0.5
X Pxs f l0e-3)
-1.5
-1.0
-0.5
-1.5
.
1.0
.
1.5
4.3 (c) aot = 7r/2
0.0015 -
1.2In
9%
0.8II
*
0.14
0.0
0.00175
-0.00175
(
-1.5
0.0
0.5
N
1.0
1.5
1.0
1.5
1.0
1.5
X PxIS fl0e-31
4.3 (d) tot = 37r14
0.0015 -
1. 2In
II
a
0.
01
a
/
4.3 (e) cot
0. 0-
0.00175
-0.00175
0. 4-
=r
0.0015
-
1.2-
9%
0. 4-
I
0
a:
I
-0.00175
0.
0.
0.00175
0-
0.0
0.5
X Pxs IlOe-31
30
4.3 (f) cot = 5r14
0.0015
-
1. 2-
C1
0.
7
0.
0.00175
-0.00175
-1.5
-1.0
0.0
0 5
-0.5
X Pxis (10e-3)
1.0
1.5
-1.5
-1.0
-0.5
1.0
1.5
4.3 (g) cot = 37r/2
0.0015 -
1 2-
8f
0.
4'
0
0.00175
-0.00175
0 0
0.5
xPx.s (10e-3)
4.3 (h) cot = 77r14
2-~,
0.0015 -
8
w
0.:
4-~
0(
S
0..
0.00175
-0.00175
4.3 (i) cot =
-1.5
-1.0
-0.5
0.0
0.5
loe-3)
1.0
1.5
X Pxs
27r
solutions for the second and third modes. The second mode had a period of 120ps, while
the third mode had a period of 130 ps. These correspond to 20% and 30% error in the
periods respectively. Assuming the same 8% error in force distribution from the
spherical problem, this could account for 5% of error in the period. Additionally, the
figures indicate the presence of a damping effect which causes the shape at the end of one
period to be different from the starting shape.
31
Other parts of the damping, however, can be attributed to the LLNL code. In one
spurious solution, quadrilateral elements can alternate in consecutive cycles between the
zero energy modes in the shape of squares and trapezoids without changing energy states.
This causes the numerical phenomenon known as hourglassing seen in figure 4.4, and
introduces additional error to the problem. Thus, some damping must be used in the
ALE3D code in order to prevent hourglassing of the elements and other spurious
oscillations. Additionally, there is an artificial viscosity from the ALE numerics that
introduces error as the theoretical result is for an inviscid problem.
Figure 4.4 The figure above shows the result of running ALE3D without hourglass viscosity. Originallya
regularcubic mesh, a problem was allowed to run without artificialdamping. Some of the "hourglass"
shapes can be seen clearly.
Using the previous LLNL model with the same material properties as used in the
verification of the new code, there was an error of 15% for the third mode. The previous
code had an error of 2% for the third mode when run under different conditions. This
indicates that there is most likely some adjustments that can be made with the material
properties to lessen the error, though there will still be some significant effects due to the
surface definition approximations and the force distribution.
The mesh density study described in the procedures section resulted in
confirmation that, to a certain extent, increasing the mesh density increased the accuracy
of the solution. For the droplet in the third mode, the error in oscillation period decreased
from 35% at the least dense mesh to 30% in the medium and high density meshes while
there was consistently less damping in the amplitude as the mesh density increased. For
the second mode, the error in oscillation period remained constant at 20% for all three
mesh densities, though the damping in amplitude decreased significantly with increased
mesh density.
32
5. Conclusion
While the error seems high for one period of oscillation, the major goals of the
thesis have been met. A surface tension model capable of running in Eulerian mode with
mixed elements has been created, thus expanding the capability of LLNL's finite element
code, ALE3D. This new method uses the same principle as the LLNL surface tension
model, and adds less than 4% to the calculation time when used for similar problems.
The numerical error may be significantly reduced by adding a number of the
following refinements to the algorithm. First, a density weighted force distribution may
improve the dynamic response. Next, logic functions could be added to determine how to
define surfaces in ambiguous cases. By using information about the surface location at
the last step and the local velocity, the definition of the surface in ambiguous cases could
be improved. Finally, a more complex contouring method is needed to analyze problems
involving three-material lines. Currently, the code is incapable of defining surfaces
properly near triple points or in elements with more than two materials. A study on the
sensitivity of the results with respect to the material properties would be useful.
33
Appendix A. The Volume of Fluids Method
The volume of fluids method uses the volume fraction of a fluid in an element
along with that of neighboring elements to define a surface normal within that element
[6]. Then the surface normal, along with the volume fraction, is used to define the
surface. The first step is using the central difference approximation to determine the
slope of the surface within the element. For a two dimensional problem, this follows
from the equations [7]
n
Vf with
wVfIh ax
f
and
ay
-fW
2Ax
(Al, A2)
fN-fS
2Ay
where n is the unit normal for the surface, f is a scalar function of the volume fraction,
and fi is the value of the function in the compass direction of subscript i. The value of fi
can be a weighted function consisting of the elements sharing a face, edge, or node with
the element whose surface is being determined. Thus, for a two dimensional problem
with Ax = Ay, the surface slope can be found as [7]
nX-
fE
fw
n,
fN
-S
(A3)
Using the surface slope as defined above, the area on one side of the surface
defines the volume fraction for that material. Matching the area to the volume fraction,
then, determines the surface, as can be seen in Figure A. 1.
.66
1
.1
0
.6
.16
0
.8
.02
1
.86
.02
1
.24
1
.24
Figure A. I The elements around the center element are used to help define a surface normal within the
center element. This normal, with the element's volume fraction, is used to define the surface within the
34
element. An example for the given surface on the left can be seen on the right. In both cases, the numbers
are the volume fractions of the materialbelow and to the left of the surface.
For three-dimensional elements, a planar surface would be defined in a similar
manner, though the mathematics becomes more complicated. This planar surface can
intersect the edges of a cubic element shapes ranging from a point to a hexagon. The
different methods of polygonal intersection can be seen in Figure A.2.
..............
; ....................
/.................
.........
........
..........
...
....
..... ..................... ...
Figure A.2 A plane can intersect a cube in shapes rangingfrom a point to a hexagon. The one and two
point intersections are not shown, as they consist of either a vertex or edge intersection.
It is possible to determine which case it is and calculate the volume of the cube
underneath the plane by comparing the volume fraction of the element with the
magnitudes of the three slopes, but it is calculation intensive. Combined with the
inconsistency of the surfaces in neighboring elements lining up, this method for surface
definition was not appealing.
35
Appendix B. Defining a Planar Approximation
As described in Appendix A, a plane can intersect a cubic element in shapes
ranging from a point to a hexagon. If the intersection is between one and three points, the
surface is known as a point, a line, or a plane. However, with more than three points, the
intersections do not necessarily (and probably do not) lie on a single plane. The method
for calculating the forces requires a planar approximation.
In order to define a planar approximation, a table was set up for each case
number, as described in the procedures section. This case number indicates how many
planes intersect the element as well as which edges are intersected. Looking at Figure
B.1, the array of edges, {4, 1, 9, 0, 6, 12, 11, 8, 0, 0, 0...}, can be seen to define two sets
of intersections in which edges 4, 1, and 9, and 6, 12, 11, and 8, participate respectively.
Using the position of the edge intersections along with the sets of intersections, the
program can define a surface for each set of intersections. These sets of intersections are
separated by a zero to let the program know when the first set ends.
.7
.8
8.3__
_
_
_
_
11
9
2
.6
12
10
.1
.1
Binary case = 11000001 (193)
No. of Surfaces[193] = 2; Edges[193] = {4, 1, 9, 0, 6, 12, 11, 8, 0, 0, 0...}
Figure B.] The figure on the left, with nodal volume fractionsfor nodes 1-8 marked, would have its
surfaces defined as the figure on the right basedon the binary case and table entries seen. The numbers in
the figure on the right indicate the edge numbers.
The ordering of the edges in the sets of intersections is important when there are
more than three intersecting points in the plane because it allows for the triangles to be
set up properly. These triangles are determined by consecutive intersecting edges and the
36
centroid of the surface, which is defined as the average position of the surfaces'
intersections. In figure B.2, it can be seen how the wrong intersecting order could result
in an incorrect calculation of the surface tension.
................
...
..
.....................................
................. .............
Figure B.2 The figure on the left shows what could happen if the surface is not defined in the proper order.
The four triangles would be two proper triangles, and two triangles that break down to lines as the four
intersection points become planar. The figure on the right shows the proper definition of the approximate
plane.
It is also important to note that not all binary cases are uniquely solvable. One
example can be seen in Figure B.3, in which a given set of nodal volume fractions has
more than one possible set of planar surfaces. It corresponds to case number 26 in our
computer program.
Finally, some case numbers have edge intersections which cannot define
individual or multiple planar surfaces. In these cases, there is often one intersection very
close to a vertex where moving it slightly to one of the connecting edges would allow for
a planar surface. Thus, these cases are approximated as planar as described above.
However, these cases as well as any other case seen as potentially ambiguous or
otherwise questionable currently results in a warning on the screen printout so the person
running the program can check for themselves if the code is doing what it should.
37
.8
.
.3.8
.3
.3
.7
7
.6'.8
.
.6 '.8
FigureB.3 With different planar surfaces, bothfigures show "correctly" defined surfaces according to the
level set method. The figure on the left consists of a triangularsurface and a hexagonal surface, while the
figure on the right consists of three triangularsurfaces.
38
Appendix C. Mixed Element Surface Tension Code
In this appendix, we present the main parts of the computer program
implementation of the surface tension model described in this thesis. Parts pertaining
specifically to the LLNL code, ALE3D, have been commented out using this notation:
/**comment**/. Normal comments, used to help anyone understand what each function
does, use the notation: /*comment*/. Additionally, portions written by LLNL
programmer, Jeremy Meredith, which are not explicitly necessary for understanding the
definition of the surface have been removed.
Module:
Purpose:
SurfTension
Calculate Nodal Forces Resulting from Surface Tension
#include <math.h>
#include <string.h>
#include <stdio.h>
#include "SurfTension.h"
#include /**Headers containing other ALE3D
functions**/
Structures
*
*
typedef
struct
r
real8 x[8];
real8 y[8];
real8 z[8];
real8 v[8];
Hex;
typedef
int
struct
edge;
vertexO;
int
vertexl;
int
real8 alpha;
/* 1-12 edge index */
/* 0-7 vertex index */
/* 0-7 vertex index */
/* 0.0 - 1.0 interpolation parameter
*/
39
/*
real8 x,y,z;
Coord;
physical x,y,z
coordinate */
struct
typedef
npoly;
int
polycase;
int
polysize[4];
int
Coord poly[4 [6];
PolygonList;
/*
typedef int
*/
by Jeremy Meredith
supplied
and hex-wirecount
hexwirecases
edgelistl7[17];
/ **********************************************************************
Polygonal Cases
*
edgelist17
hexwirecases[]
{
{
0, 0,
0,
0,
0,
0,
9,
0,
6,
12,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
11,
8,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0 */
0}, /*
{ 4,
1,
0}, /* 193 */
0},
/*
1;
0,
{ 0,
255 *7
int hexwirecount [256]
{
o,
...
=
7/*0
...
2, ...
.,
0,
/*
/*
7*
/*
/*
/*
/*
/*
/*
/*
/*
/*
/*
/*
/*
16
32
48
64
80
96
112
128
144
160
176
192
208
224
240
*/
*/
*/
*7
*/
*/
*/
*/
*7
*/
*7
*7
*/
*/
*/
*/
};
of the
/*catalog
0 = unambiguous
ambiguous
status
of each
case
40
1 =
2 =
3 =
int
contingently ambiguous (depending on break up
definitely ambiguous
not possible as defined
*/
hexambiguouscases [256] =
of surface)
{
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
1, 0,
0, 0,
0, 3,
0, 1,
0, 0,
1, 2,
0, 0,
0, 0,
0, 3,
0, 2,
0, 0,
0,
1,
0,
0,
1,
2,
0,
0,
0,
0,
0,
3,
0,
2,
3,
0,
0,
0,
0,
0,
0,
2,
3,
0,
0,
3,
2,
0,
2,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
3,
1,
0,
2,
2,
0,
3,
0,
0,
1,
0,
2,
3,
0,
2,
2,
0,
2,
2,
2,
2,
2,
0,
2,
1,
0,
0,
0,
3,
0,
2,
0,
0,
0,
2,
2,
0,
3,
0,
0,
0,
0,
3,
0,
0,
3,
0,
0,
0,
2,
0,
2,
1,
0,
0,
1,
0,
0,
1,
0,
0,
1,
2,
0,
2,
0,
0,
0,
3,
0,
0,
3,
0,
0,
0,
0,
3,
0,
2,
2,
0,
0,
0,
2,
0,
3,
0,
0,
0,
1,
2,
0,
2,
2,
2,
2,
2,
0,
2,
2,
0,
3,
2,
0,
1,
0,
0,
3,
0,
2,
2,
0,
1,
3,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
2,
0,
2,
3,
0,
0,
3,
2,
0,
0,
0,
0,
0,
0,
3,
2,
0,
3,
0,
0,
0,
0,
0,
2,
1,
0,
0,
1,
0,
0,
2,
3,
0,
0,
2,
0,
1,
3,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
/*
/*
/*
/*
/*
/*
0 *7
16 */
32
48
64
80
/*
/*
/*
96
112
128
/* 144
/* 160
/* 176
7* 192
7* 208
7* 224
/* 240
*7
*/
*/
*/
*/
*/
*/
*7
*7
*/
*/
*/
*7
*/
};
static
static
**volfracs,
VolumeFractionsArrayForTwoMaterials (real8
*materiall, char *material2);
**volfracs,
void NodalVolumeFractionArray(int elem, real8
nodalvf[8][2], char *materiall, char
char
int
real8
*material2);
elem, real8
void SurfaceTensionSurfaceDefinition(int
static
PolygonList *polygons);
nodalvf[8][2],
static PolygonList HexContourSingle(Hex *hex, real8 value);
value);
HexCalculateCase(Hex *hex, real8
int
static
value);
edge, real8
Coord HexGetEdgeIsoCoord(Hex *hex, int
static
void SurfaceTensionSurfaceLogicForForceCalculations (PolygonList
static
polygons, real8 tensioncoeff, real8 forces[12] [3],
real8
nodalvf [8] [2]);
int elem,
static void SurfaceTensionSingleSurfaceForceCalculations(PolygonList
polygons,
real8 tensioncoeff, real8 forces[12][3], int
surfnum);
static void SurfaceTensionDistributeForces(PolygonList polygons, real8
forces[12][3], int elem);
face, real8
static
void SurfaceTensionPureElementForceApplication (int
coef);
7**********************************************************************
**
Function
Author(s)
* Purpose
*
*
*
:
:
:
ApplyMixedSurfaceTension
Kipp Whittaker
Main function to apply surface tension within mixed
elements to the force field.
*/
41
void ApplyMixedSurfaceTension()
BoundaryConditiont bc
bc = domain->bc[BCMixedSurfaceTension]
while (bc) I
char *materiall = bc->stmatl;
char *material2 = bc->stmat2;
real8 tensioncoeff = bc->coefs[O];
int
j;
i,
int
nelemTotal = 0;
int
numsurfaceelements =
*surfaceelements;
int
real8 **volfracs;
j
i =
=
0;
0;
NodesFindSurroundingElements(domain->nodes, domain->zonelist);
nelemTotal = /**Sum of the number of elements in the problem**/
malloc(3 * sizeof(real8 *));
volfracs = (real8 **)
volfracs[0] = (real8 *) malloc(nelemTotal * sizeof(real8));
volfracs[l] = (real8 *) malloc(nelemTotal * sizeof(real8));
volfracs[2] = (real8 *) malloc(nelemTotal * sizeof(real8));
for
(i=0;
i++)
i<nelemTotal;
{
volfracs[l] [i] = 0;
volfracs[2]
[i] = 0;
volfracs[2][i] =
I
0;
/*Find the volume fractions of two materials in each mixed
element*/
numsurfaceelements =
VolumeFractionsArrayForTwoMaterials(volfracs,
materiall, material2);
surfaceelements =
(int));
for
(i=0;
(int
*)
malloc(numsurfaceelements
i<numsurfaceelements;
i++)
*
sizeof
surfaceelements[i]
=
0;
/*Create an array of the elements containing surfaces*/
for (i=0; i<numElem; i++)
{
if
(volfracs[0]
[i]
==
{
surfaceelements[j]
j++;
2)
=
i;
/*For each element containing a surface*/
for(i=0; i<numsurfaceelements; i++)
{
42
real8 nodalvf[8][2] = {0};
PolygonList polygons = {0};
real8 forces[12][3] = {0};
/*Find the nodal volume fraction values for each material*/
NodalVolumeFractionArray(surfaceelements[i], volfracs,
nodalvf,
materiall, material2);
/*Determine the number of the
intercepts and their order for
further
calculations*/
SurfaceTensionSurfaceDefinition(surfaceelements[i],
&polygons);
/*Determine the
force magnitudes as applied to
nodalvf,
each element
edge*/
SurfaceTensionSurfaceLogicForForceCalculations (polygons,
tensioncoeff,
forces,
surfaceelements[i],
nodalvf);
/*Distribute the forces on each edge between the
SurfaceTensionDistributeForces(polygons, forces,
surfaceelements[i]);
nodes*/
}
/*Apply surface tension if the surface happens to
Facelistt advf = /**list of faces**/;
int numFaces = /**number of faces**/;
int faceIdx = 0;
for
(faceIdx=0; faceIdx<numFaces;
lie on a
face*/
faceIdx++)
{
int eleml = /**element on side 1 of faceIdx**/;
int elem2 = /**element on side 2 of faceIdx**/;
/*If neither element is a mixed element*/
if (eleml != /**mixed**/ && elem2 != /**mixed**/)
{
char *elemlMaterialName = /**material in eleml**/;
char *elem2MaterialName = /**material in elem2**/;
((strcmp(elemlMaterialName,materiall) == 0 &&
if
strcmp(elem2MaterialName,material2) == 0) 1
(strcmp(elem2MaterialName,materiall) == 0 &&
strcmp(elemlMaterialName,material2) ==0))
SurfaceTensionPureElementForceApplication(faceIdx,
tensioncoeff);
free (surfaceelements);
free (volfracs[0]);
free (volfracs[1]);
free (volfracs[2]);
free (volfracs);
bc = bc->next ;
43
}
}
/
**********************************************************************
**
:
:
:
Function
Author(s)
* Purpose
materials
*
*
VolumeFractionsArrayForTwoMaterials
Kipp Whittaker
Function to determine the volume fractions
for each mixed element
*
in the domain
of two
and how many
surface
elements
*
static
int
there
are
VolumeFractionsArrayForTwoMaterials (real8 **volfracs,
*materiall, char *material2)
char
{
int
int
int
int
numMat = /**number
Mat = 0;
numsurfel = 0;
mixelemTotal = 0;
of materials**/;
int i, j;
real8 *cvf;
*elemnum;
int
i =
j
=
0;
/*For each material*/
for (Mat = 0; Mat < numMat;
cvf =
/**function
Mat++)
to retrieve the volume
fraction of an element
for a
given material**/;
char *materialName = /**name of material Mat**/;
mixelemTotal = /**total number of mixed elements**/
/*For each mixed element*/
for (i=0; i<mixelemTotal; i++)
elemnum =
/**function to retrieve problem element number given
mixed
element number**/
(strcmp(materialName, materiall) == 0)
volfracs[l][elemnum[i]] = cvf[elemnum[i]];
if (strcmp(materialName, material2) == 0)
volfracs[2][elemnum[i]] = cvf[elemnum[i]];
if
/*For each mixed element, check to see if it has
therefore a surface in it*/
for (j=0; j < mixelemTotal; j++)
both materials and
44
elemnum = /**function to retrieve problem element number given
mixed
if
element number**/
(volfracs[l][elemnum[j]] > 0 && volfracs[l][elemnum[j]] <1
volfracs[2][elemnum[j]] > 0 && volfracs[2][elemnum[j]] <1)
&&
{
volfracs[0][elemnum[j)]
numsurfel++;
=
2;
return numsurfel;
/
*******************************************************
**
*
*
*
Function
Author(s)
Purpose
*
: NodalVolumeFractionArray
: Kipp Whittaker
: Function to determine the nodal volume fractions of two
materials for each node in a given surface element
void NodalVolumeFractionArray(int elem, real8 **volfracs, real8
nodalvf[8][2], char *materiall, char *material2)
static
int i, j;
i = j = 0;
real8 nodetotall, nodetotal2, nodevolume;
nodetotall = nodetotal2 = nodevolume = 0;
int node[8] = {0};
int *numElemAboutNode;
int *elemAboutNode;
real8 *v = /**function to retrieve the volume of an element**/;
int elAbout = 0;
int elmatAbout = 0;
numElemAboutNode = /**index of elements about a node**/;
elemAboutNode = /**function to get the element number of element
about a
node**/;
/*For each node in the element*/
for (i = 0; i < 8; i++)
{
node[i]
= /**function to find the node number**/;
nodetotall = nodetotal2 = 0;
nodevolume = 0;
/*For each element about the node*/
for(j=numElemAboutNode[node[i]]; j<numElemAboutNode[node[i]+l];
j++)
elAbout = elernAboutNode[j];
elmatAbout = /**function to determine what type of element**/;
/*If it's a mixed element find the volume fraction for each
material*/
if (elmatAbout == /**mixed element**/)
45
{
nodetotall +=
nodetotal2 +=
(volfracs[l][elAbout]);
(volfracs[2][elAbout]);
if (volfracs[1] [elAbout] II volfracs[2][elAbout])
nodevolume += v[elAbout]
I
/*Otherwise,
(v[elAbout]) *
(v[elAbout]) *
since it's a pure element, find which material
is
in it*/
else
{
char *materialName = /**function to determine the
material**/;
if
(strcmp(materialName, materiall)
{
nodetotall +=
nodevolume +=
if
0)
==
0)
v[elAbout];
v[elAbout];
}
(strcmp(materialName, material2)
{
nodetotal2 +=
nodevolume +=
==
v[elAbout];
v[elAbout];
I
if
0)
(nodevolume !=
{
nodalvf[i][0]
=
nodetotall/nodevolume;
nodalvf [i] [1]
=
nodetotal2/nodevolume;
}
}
}
/*Here
to the end of SurfaceTensionSurfaceDefinition written primarily
by
Jeremy Meredith, with editing to fit ALE3D done by Kipp Whittaker*/
/
**********************************************************************
Function
Author(s):
ALE3D)
* Purpose
necessary
*
:
*
:
SurfaceTensionSurfaceDefinition
Jeremy Meredith (primary) and Kipp Whittaker
and passes
it
to a subroutine
void SurfaceTensionSurfaceDefinition(int
static
nodalvf [8] [2],
to define
elem,
for
Collects
Set up program for defining the surface.
info
*
(editing
the surface.
real8
PolygonList *polygons)
{
Hex
real8
int
hex;
contourvalue;
i = 0;
46
/**function which stores
hex structure**/
for
(i=0;
i<8;
{
hex.v[i]
x,
y,
and z
coordinates
for vertices in the
i++)
nodalvf[i][0];
=
}
contourvalue
=
0.5;
/*
Define the Surface
*/
*polygons
= HexContourSingle(&hex, contourvalue);
}
Function : HexContourSingle
Author(s): Jeremy Meredith (primary) and Kipp Whittaker
ALE3D)
* Purpose
: Main program for defining the surface.
*
*
static PolygonList
HexContourSingle(Hex
(editing for
real8 value)
*hex,
{
PolygonList p = {0};
int
i;
int
*casepointer;
/*Find out which surface case from the table applies to this
situation*/
p.polycase = HexCalculateCase(hex, value);
p.npoly = 0;
casepointer = hexwirecases[p.polycase];
/*For each surface in the element*/
for (i=0; i<hexwirecount[p.polycase]; i++)
{
p.polysize[p.npoly]
while (*casepointer
{
int
=
0;
0)
edge = *casepointer++;
p.poly[p.npoly][p.polysize[p.npoly]]
=
HexGetEdgeIsoCoord(hex, edge, value);
p.polysize[p.npoly]++;
}
p.npoly++;
casepointer++;
}
return p;
47
:
Function
Author(s):
ALE3D)
* Purpose
*
*
:
HexCalculateCase
Jeremy Meredith (primary)
and Kipp
Whittaker
Calculate which Polygon Case to use
(editing
for
from the table at the
beginning of the file.
*
static
int
HexCalculateCase (Hex
*hex,
real8
value)
{
int
int
i;
hexcase =
for
(i=0;
Ox00;
i<8;
i++)
{
int nodecasebitmap[8] = {0, 1, 2, 3, 4,
if (hex->v[i] > value)
hexcase J= (1 << nodecase bitmap[i]);
return
5,
6,
7};
hexcase;
}
Function
Author(s):
ALE3D)
* Purpose
*
:
*
*
:
HexGetEdgeIsoCoord
Jeremy Meredith (primary)
and Kipp Whittaker
int
for
Calculate the point of intersection along an edge.
Interpolate that value as an xyz coordinate.
static Coord HexGetEdgeIsoCoord(Hex *hex, int edge,
Coord c =
(editing
real8 value)
{0};
edges[12] [2]
=
1{0,11,
{1,21,
{2,31,
{3, 01,
{4,5},
{5,6},
{6,7},
(7, 41,
(0,41,
{1,51,
{3,71,
{2, 611;
assumed to be 1-origin,
edge is
va = edges[edge-1 [01;
int vb = edges[edge-l][1];
real8 alpha = (value - hex->v[va])
/*
int
while
/
our
is
array
(hex->v[vb]
-
0-origin */
hex->v[va]);
48
real8 ialpha;
/* we know we need an intersection along this
* to be between the two endpoints (0 and 1)
if
if
edge,
so clamp
it
*
*/
(alpha>l) alpha=l;
(alpha<0) alpha=0;
ialpha =
1.0 -
linear interpolation *7
= edge;
= alpha;
= va;
= vb;
/* do the
c.edge
c.alpha
c.vertex0
c.vertexl
c.x =
c.y =
c.z =
alpha;
(hex->x[va] *
(hex->y[va] *
(hex->z[va] *
ialpha) +
ialpha) +
ialpha) +
(hex->x[vb] * alpha);
(hex->y[vb] * alpha);
(hex->z[vb] * alpha);
return c;
}
**
* Function
* Author(s)
* Purpose
:
:
:
*
SurfaceTensionSurfaceLogicForForceCalculations
Kipp Whittaker
Function to determine the force applied to each edge of
a surface element
*7
static void SurfaceTensionSurfaceLogicForForceCalculations(PolygonList
polygons,
real8 tensioncoeff, real8
forces[12][3],
int elem,
real8
nodalvf [8][2])
/*elem, and nodalvf only necessary for warnings*/
{
int
i =
0;
(i=0; i < 12;
for
i++)
{
forces[i][0]
forces[i][1]
= 0;
= 0;
forces[i] [2]
=
0;
I
/*Provide warnings for ambiguous cases*/
switch(hex_ambiguous-cases[polygons.polycase])
{
case 0:
break;
case 1:
printf("\nWarning: Conditionally ambiguous case with %d
surfaces found in element %d \nin domain %d with nodalvf values for
nodes 1-8 of \n%.3f %.3f
%.3f
%.3f
%.3f
%.3f
%.3f
%.3f\n",
49
polygons.npoly,
elem,
nodalvf[0] [0],
nodalvf[1] [0],
nodalvf [2] [0],
nodalvf[3] [0],
nodalvf[5] [0,
nodalvf[4] [0,
nodalvf[6][0],
nodalvf [7] [0]);
break;
case 2:
printf("\nWarning: Ambiguous case with %d surfaces found in
element %d \nin domain %d with nodalvf values for nodes 1-8 of \n%.3f
%.3f %.3f %.3f %.3f %.3f %.3f %.3f\n",
polygons.npoly, elem, nodalvf[0][0],
nodalvf[l][0],
nodalvf[2][0], nodalvf[3][0], nodalvf[4][0],
nodalvf[6][0], nodalvf[7][0]);
nodalvf[5][0],
break;
case 3:
printf("\nWarning: Non-planar surface being defined as planer
in element %d \nin domain %d with nodalvf values for nodes 1-8 of
\n%.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f\n",
elem, nodalvf[0][0], nodalvf[l][0], nodalvf[2][0],
nodalvf[3][0], nodalvf[4][0], nodalvf[5][0], nodalvf[6][0],
nodalvf [7] [0]);
break;
default:
break;
}
/*Switch depending on the number
switch(polygons.npoly)
of surfaces in each element*/
{
case 1:
SurfaceTensionSingleSurfaceForceCalculations(polygons,
tensioncoeff,
forces, 0);
break;
/*If there is more than one surface,
go through each surface
as
defined*/
/*Potential
case 2:
for
for adding more logic
(i=0; i<polygons.npoly;
functionality later*/
i++)
SurfaceTensionSingleSurfaceForceCalculations(polygons,
tensioncoeff,
forces, i);
break;
case 3:
for
(i=0; i<polygons.npoly;
i++)
SurfaceTensionSingleSurfaceForceCalculations(polygons,
tensioncoeff,
forces, i);
break;
case 4:
for
(i=0; i<polygons.npoly;
i++)
SurfaceTensionSingleSurfaceForceCalculations(polygons,
tensioncoeff,
forces, i);
break;
default:
break;
50
**
* Function
*
*
Author(s)
Purpose
SurfaceTensionSingleSurfaceForceCalculations
Kipp Whittaker
Function to determine the force applied to each edge
for
single surface in an element
*/
static void SurfaceTensionSingleSurfaceForceCalculations(PolygonList
polygons,
real8 tensioncoeff,
real8 forces[12][3],
int
surfnum)
{
real8
real8
real8
real8
real8
real8
real8
real8
int i
centroid[3] = {0, 0 , 0
positionl[3] = {0, 0, 0
position2[3] = {0, 0, 0
position3[3] = {0, 0, 0
vectorl[3] = {0, 0, 0};
vector2[3] = {0, 0, 0};
normal[3] = {0, 0, 0};
area = 0;
= 0;
/*If there are 3 intersection points*/
if
(polygons.polysize[surfnum] ==
3)
/*The coordinates of the 3 intersection points*/
polygons.poly[surfnum] [0] .x;
positionl [0]
polygons.poly[surfnum] [0] .Y;
positionl [1]
polygons.poly[surfnum] [0] .z;
positionl [2]
polygons.poly[surfnum] [1] .x;
position2 [0]
polygons.poly[surfnum] [1] .Y;
position2 [1]
polygons.poly[surfnum] [1] .z;
position2 [2]
polygons.poly[surfnum] [2] .x;
position3 [0]
polygons.poly[surfnum] [2] .Y;
position3 [1]
polygons.poly[surfnum] [2] .z;
position3 [2]
/*The vector
vectorl[0] =
vectorl[l]
vectorl[2]
/*The
=
=
vector
vector2[0]
vector2[l]
vector2[2]
=
=
=
/*The cross
normal[0] =
normal[l] =
normal[2] =
area = .5 *
normal[2]
from intercept
position2[0] position2[l] position2[2] from intercept
position3[0] position3[l] position3[2] -
1 to 2*/
positionl[0]
positionl [1]
positionl[2]
2 to 3*/
position2 [0]
position2 [1]
position2[2]
product
(normal) vector*/
* vector2[2] - vectorl[2]
vectorl[2] * vector2[0] - vectorl[0]
vectorl[l]
vectorl[0]
* vector2[l]
sqrt(normal[0]*normal[0]
*normal[2]);
-
*
*
vector2[l];
vector2[2];
vectorl[l] * vector2[0];
+ normal[l] *normal[l] +
51
(area !=
if
0)
{
/*Forces on intercept 1*/
forces[(polygons.poly[surfnum][0].edge) -1][0]
+=
-tensioncoeff
*
(normal[1] * vector2[2] - normal[2]
* vector2[1])/(4*area);
forces[
(polygons.poly[surfnum] [01 .edge)-1] [1] += -tensioncoeff
(normal[2] * vector2[0] - normal[O] * vector2[2])/(4*area);
forces[
(polygons.poly[surfnum] [0] .edge) -1] [2] += -tensioncoeff
*
(normal[G]
*
-
vector2[l]
* vector2[0])/(4*area);
normal[1]
/*Forces on intercept 2*/
forces[
(polygons.poly[surfnum] [1] .edge) -1]
[0]
+=
-tensioncoeff
(normal[2] * (vectorl[l]
+ vector2[l])
- normal[l] *
(vectorl[2] + vector2[2]))/(4*area);
forces[
(polygons.poly[surfnum] [1] .edge) -1] [1] += -tensioncoeff
(normal[O] * (vectorl[2] + vector2[2]) - normal[2] *
(vectorl[0] + vector2[0]))/(4*area);
forces[(polygons .poly[surfnum][1].edge)-1] [2] += -tensioncoeff
*
(normal[l]
* (vectorl[0] + vector2[0])
(vectorl[1] + vector2[1]))/(4*area);
-
normal[0]
/*Forces on intercept 3*/
forces[(polygons.poly[surfnum][2].edge)-1] [0]
+=
*
-tensioncoeff
*
(normal[1] * vectorl[2]
- normal[2] * vector1[l])/(4*area);
forces[
(polygons.poly[surfnum] [2].edge) -1] [1] += -tensioncoeff
(normal[2] * vectorl[0]
- normal[0] * vectorl[2])/(4*area);
forces[
(polygons.poly[surfnum] [2] .edge) -1] [2] += -tensioncoeff
normal[0]
* vectorl[l]
-
normal[1]
*
vectorl[0])/(4*area);
}
/*If
else
there
are more than 3 interesection
points
(4,
5,
or 6)*/
{
/*Find a centroid to define the surface
for (i=0; i<polygons.polysize[surfnum];
as a mesh of triangles*/
i++)
{
centroid[0] += polygons .poly[surfnum] [i] .x;
centroid[l] += polygons .poly[surfnum][i].y;
centroid[2] += polygons .poly[surfnum][i].z;
)
/*Average the x, y, and z coordinates respectively*/
centroid[0] = centroid [0]/polygons.polysize[0];
centroid[1] = centroid [1]/polygons.polysize[0];
centroid[2] = centroid [2]/polygons.polysize[0];
/*For each pair of intercepts in chart order*/
for(i=0; i<polygons.polysize[0]; i++)
{
52
/*The coordinates of the first intercept*/
positionl[0] = polygons.poly[surfnum][i].x;
positionl[1] = polygons.poly[surfnum][i].y;
positionl21 = polygons.poly[surfnum][i].z;
/*If this is not the last pair of intercepts*/
if
(i<(polygons.polysize[0]-l))
{
/*The coordinates of the second intercept*/
position2[0] = polygons.poly[surfnum][i+l].x;
position2[1] = polygons.poly[surfnum][i+11.y;
position2[2] = polygons.poly[surfnum][i+1].z;
}
/*If this is the last pair of intercepts*/
else if (i=(polygons.polysize[0]-l))
{
/*The coordinates of the second intercept*/
position2[0] = polygons.poly[surfnum][0].x;
position2[l1] = polygons.poly[surfnum][0].y;
position2[2] = polygons.poly[surfnum][01.z;
}
/*The vectors from the intercepts to
= positionl[0] - centroid
vectorl[l] = positionl[l] - centroid
vectorl[2] = positionl[2] - centroid
vector2[0] = position2[0] - centroid
vector2[l] = position2[1] - centroid
vector2[2] = position2[2] - centroid
vectorl[0]
/*The cross
normal[0]
normal[1]
normal[2]
area = .5
normal
if
product
the
centroid*/
[01;
[1];
[2];
[0];
[1];
[21;
(normal) vector*/
vectorl[2] * vector2 [1];
vectorl[0] * vector2 [2];
= vectorl[0] * vector2[l]
vectorl [1] * vector2 [0];
* sqrt(normal[0]*normal[0] + normal[1] *normal[1] +
= vectorl[l]
= vectorl[2]
*
*
vector2[2]
vector2[0]
[2] *normal [21);
(area != 0)
{
forces[(polygons.poly[surfnum][i].edge)-1][0]
tensioncoeff
(normal[l] * vector2[2]
vector2 [1])
tensioncoeff
+=
*
-
normal[2]
*
(4*area);
forces[(polygons.poly[surfnum][i].edge)-1][1]
+=
*
(normal[2] * vector2[0] - normal[0] *
vector2 [2] )/(4*area);
forces[(polygons.poly[surfnum][i].edge)-1][2]
tensioncoeff *
(normal[0] * vector2[l] - normal[l] *
vector2 [0] )/(4*area);
if (i<(polygons.polysize[surfnum]-l))
+=
{
forces[(polygons.poly[surfnum][i+l].edge)-l][0]
+=
tensioncoeff
*
(normal[2]
* vectorl[l]
-
normal[l]
*
vectorl[2])/
(4*area);
53
+=
forces[(polygons.poly[surfnum][i+1].edge)-l][1]
tensioncoeff
*
(normal[G] * vectorl[2] - normal[2] * vectorl(O])/
(4*area);
forces[(polygons.poly[surfnum][i+1].edge)-l][2] +=
tensioncoeff
*
(normal[l]
* vectorl[G]
-
normal[0]
* vectorl[l])/
(4*area);
else if
(i=(polygons.polysize[surfnum]-l))
I
forces[(polygons.poly[surfnum][0].edge)-l][0]
tensioncoeff
+=
*
(normal[2] * vectorl[1] - normal[l] * vectorl[2])/
(4*area);
forces[(polygons.poly[surfnum][0].edge)-1][1] +=
tensioncoeff
*
(normal(G] * vectorl[2] - normal[2] * vectorl[0])/
(4*area);
forces[(polygons.poly[surfnum][0].edge)-1][2] +=
tensioncoeff
*
(normal[]
(4*area);
* vectorl[E]
-
normal[0]
*
vectorl[l])/
I}
/}
**
Function
Author(s)
* Purpose
*
*
:
:
:
*
SurfaceTensionDistributeForces
Kipp Whittaker
Function to distribute the forces on the edges
element linearly to its nodes
of an
static void SurfaceTensionDistributeForces(PolygonList polygons,
forces[12][3], int
elem)
real8
{
int
edges[12] [2]
=
{{0,1},
{1,21,
{2,3},
{3,01,
{4,5},
{5,61,
{6,71,
17,41,
{0,41,
{1,51,
{3,71,
{2,611;
int
int
int
i = 0;
j = 0;
*pedge;
54
real8 *palpha;
int node[2] = {0};
real8 nodeforces[8][3] =
{0};
real8 *fx = /**function to apply the force to a node in the x
direction**/;
real8 *fy = /**function to apply the force to a node in the y
direction**/;
real8 *fz = /**function to apply the force to a node in the z
direction**/;
/*For each polygonal surface in the element*/
for (i=O; i<polygons.npoly; i++)
/*For each vertex of that surface*/
for (j=O; j<polygons.polysize[i]; j++)
{
pedge = &polygons.poly[i][j].edge;
palpha = &polygons.poly[i][j].alpha;
node[O] =
/**function to determine the node number of one end
of an
node[l]
other end of
edge**/;
= /**function to determine the node number of the
an edge**/;
fx[node[O]] +=
(1 -
+=
+=
+=
+=
+=
(1 (1 -
fy[node[O]]
fz[node[O]]
fx[node[l]]
fy[node[l]]
fz[node[l]]
*palpha) * forces[*pedge-1][0];
*palpha) * forces[*pedge-1][1];
*palpha) * forces[*pedge-1][2];
*palpha * forces[*pedge-1][0];
*palpha * forces[*pedge-1][1];
*palpha * forces[*pedge-1][2];
+=
(1
-
*palpha) *
+=
(1 -
*palpha) *
nodeforces[edges[*pedge-1][0]][2]
+=
(1 -
*palpha) *
forces [*pedge-1] [2];
nodeforces[edges[*pedge-1][1]][0]
+=
*palpha * forces[*pedge-
nodeforces[edges[*pedge-1][1]][1]
+=
*palpha * forces[*pedge-
nodeforces[edges[*pedge-1][1]][2]
+=
*palpha * forces[*pedge-
nodeforces[edges[*pedge-1][0]][0]
forces[*pedge-1] [0];
nodeforces[edges[*pedge-1][0]][1]
forces[*pedge-1][1];
1][0];
1][1];
1][2];
}
/
*
*
*
Function
Author(s)
Purpose
: SurfaceTensionPureElementForceApplication
: Tim Dunn with minor modifications by Kipp Whittaker
: Applies surface tension to adjacent pure elements
55
/
*
static
void
SurfaceTensionPureElementForceApplication(int
face,
real8
coef)
{
advf = /**list of faces**/;
= /**node number of vertex
*node2 = /**node number of vertex
*node3 = /**node number of vertex
*node4 = /**node number of vertex
Facelistt
int
*nodel
int
int
int
0
1
2
3
on
on
on
on
face**/;
face**/;
face**/;
face**/;
real8 *fx = /**function to apply the force to a node in the x
direction**/;
real8 *fy = /**function to apply the force to a node in the y
direction**/;
real8 *fz = /**function to apply the force to a node in the z
direction**/;
real8 *x = /**x position of a node**/;
real8 *y = /**y position of a node**/;
=
/**z
position
of
real8
*z
real8
real8
real8
real8
real8
real8
real8
aaa, bbb, ccc, abc
ax, bx, cx, dx ;
ay, by, cy, dy ;
az,
bz, cz,
dedxl,
dedyl,
dedzl,
dz
dedx2,
dedy2,
dedz2,
x[nodel [face]]
x[node2 [face]]
x[node3 [face]]
x[node4 [face]]
y[nodel [face]]
by = y[node2 [face]]
real8 dedzl, dedz2,
ax =
bx =
cx =
dx =
ay =
ax
bx
cx
dx
ay
by
cy
dy
az
bz
cz
dz
=
=
=
a node**/;
x[nodel
x [node2
x[node3
x[node4
y [nodel
y [node2
y [node3
y[node4
z [nodel
z [node2
z [node3
z [node4
[face]]
[face]]
[face]]
[face]]
[face]]
[face]]
[face]]
[face]]
[face]]
[face]]
[face]]
[face]]
;
dedx3,
dedx4
dedy3, dedy4
dedz3, dedz4
-
x[node2[face]
x[node3[face]
x[node4[face]
x[nodel[face]
y[node2[face]
y[node3[face]
dedz3, dedz4 ;
-
x[node2[face]
x[node3[face]
x[node4[face]
x[nodel[face]
y[node2[face]
y[node3[face]
y[node4[face]
y[nodel[face]
z[node2[face]
z[node3[face]
z[node4[face]
z[nodel[face]
aaa
bbb
ccc
abc
;
(cy-ay)* (dz-bz) -(dy-by)*(cz-az)
(cz-az)* (dx-bx) - (dz-bz) * (cx-ax) ;
;
(cx-ax)* (dy-by) -(dx-bx)*(cy-ay)
-0.25*coef/sqrt (aaa*aaa+bbb*bbb+ccc*ccc)
dedxl
= abc* (bbb*(-(cz-az)+(dz-bz))+ccc*
(-(dy-by)+(cy-ay)))
;
56
dedx2
dedx3
dedx4
abc* (bbb*
abc* (bbb*
abc* (bbb*
(cz-az)-(dz-bz) +ccc* (+(dy-by) + (cy-ay) )
(cz-az)-(dz-bz) +ccc* (+ (dy-by) - (cy-ay) )
- (cy-ay) )
(cz-az)+(dz-bz) +ccc* (-(dy-by)
dedyl
dedy2
dedy3
dedy4
abc*
abc*
abc*
abc*
(ccc*
(ccc*
(ccc*
(ccc*
(cx-ax) + (dx-bx)
(cx-ax) - (dx-bx)
(cx-ax) - (dx-bx)
(cx-ax) + (dx-bx)
+aaa* (-(dz-bz)
+ (cz-az)
+aaa* (+ (dz-bz) + (cz-az)
+aaa* (+ (dz-bz) - (cz-az)
+aaa* (-(dz-bz)
- (cz-az)
dedzl
dedz2
dedz3
dedz4
abc*
abc*
abc*
abc*
(aaa*
(aaa*
(aaa*
(aaa*
(cy-ay) +
(cy-ay)
(cy-ay)
(cy-ay) +
+bbb* (-(dx-bx)
+ (cx-ax)
+bbb* (+ (dx-bx) + (cx-ax)
+bbb* (+ (dx-bx) - (cx-ax)
+bbb* (- (dx-bx) - (cx-ax)
fx
fx
fx
fx
dedxl
dedx2
dedx3
dedx4
[nodel [face]
[node2[face]
[node3[face]
[node4 [face]
fy [nodel[face] ]
fy [node2 [face] ]
fy [node3[face] ]
fy [node4[face] ]
fz [nodel
fz [node2
fz [node3
fz [node4
[face]
[face]
[face]
[face]
]
]
]
]
(dy-by)
(dy-by)
(dy-by)
(dy-by)
;
;
;
;
dedyl
dedy2
dedy3
dedy4
dedzl
dedz2
dedz3
dedz4
I
57
Appendix D. LLNL Memo on ALE3D
The following memo was written and released by LLNL to describe ALE3D, a
finite element code used by the laboratory.
Capabilities
ALE3D is a 3D, aribitrary-Lagrange-Eulerian, finite element code that treats fluid and
elastic-plastic response of materials on an unstructured grid. The major components of
the code are explicit and implicit continuum-mechanics, thermal diffusion, and
chemistry. An incompressible flow model is under development. All components of the
code participate in advection and operate with slide surfaces. Advection is the process
whereby the mesh is modified to alleviate tangling or to preserve an Eulerian grid.
Advection is implemented in a Lagrange plus remap fashion. For each cycle, after a
Lagrangian motion, the state variables flow from the original mesh to the modified mesh.
Slide surfaces are boundaries between disjoint sections of the grid that may or may not be
in contact. They represent either physical contact discontinuities or a discontinuity in the
zoning. The unstructured grid is composed of 3D hexagonal elements that can be
arbitrarily connected. Triangular or prismatic elements are not allowed, but 2D shell
elements can couple to 3D elements at slide surfaces.
Platforms
ALE3D operates on a wide variety of UNIX platforms including SGI, IBM, DEC, HP,
and SUN work stations, Cray J90's, and the Intel (Red), IBM (Blue Pacific, White), and
SGI (Blue Mountain) ASCI MPP's. A somewhat less capable version is available for the
WindowsTM operating system. Operation on massively parallel machines has been the
major focus of a recent code rewrite. Parallelization is implemented by decomposing the
mesh into computational domains. Message passing is the primary mode for
communication between domains. The emphasis on message passing means that it is
possible to run parallel computations on a network of workstations. Threads have be used
for shared memory machines, but are not currently advocated. The code is mostly written
in C while Fortran is reused for some low level computational functions. Memory
allocation is dynamic and done entirely by the upper level C drivers.
The Code System
The ALE3D code system is composed of several executables. The user must first
generate a grid using one of several coordinate generators. Currently TrueGrid, PMESH
and INGRID are supported. The grid generator creates the primary geometry,
connectivity, and region layout information for the calculation. The output of the grid
generator is fed into a restart file generator that performs a domain decomposition for
parallel runs. The restart file generator then writes the coordinate arrays along with state
variable arrays, equation-of-state and constitutive model information, additional
connectivity data, region layout, boundary conditions, source information, and run time
control parameters into a restart file. The restart file generator can also be used to
58
construct a secondary geometry by overlaying region shapes on the grid created by the
grid generator. The main code reads the restart file and executes the physics calculation.
The main code writes out additional restart files, plot files, time history files, and link
files for connecting to other codes. The physics calculation can be restarted at any time
from a restart file. The restart file generator and the main code share a common parameter
input file. Consequently, much of the material information and run time control
parameters can be altered during the course of a calculation. Plot files can be viewed with
the MESHTV interactive graphics program. Restart files can also be viewed with
MESHTV, but they are much larger than plot files. Time history files are 1 D, versus time
tables of the values of physics variables at individual elements or nodes. They can be
viewed with spreadsheets, ULTRA, or MESHTV.
ExplicitHydrodynamics
The explicit hydrodynamics module was developed to model the behavior of objects
undergoing deformation due to the application of shocks in the kilobar regime. For such
problems the natural time step is consistent with the Courant time scale which governs
the stability of the equations.
The code explicitly conserves mass and momentum. Following DYNA3D (Hallquist,
1982), the stress gradients and strain rates for the Lagrange step are evaluated by a lowest
order finite-element method. A diagonal mass matrix is used. For second-order accuracy,
a staggered space and time grid is also used. The stress gradient calculation has been
modified so that it is represented by an integral of the shape function over the surface of
an element rather than an integral of the gradient of the shape function over the volume.
(The stress in general is discontinuous at the surface so that the stress gradient is a delta
function.) This modification corrects a problem in which distorted elements generated
forces even though the stress field was constant. Likewise, a more accurate volume
calculation is done following J. Dukowicz (JCP). Hour glass modes are damped using the
method of Flanagan and Belytschko.
The code is energy based rather than temperature based. Energy conservation is not
explicitly enforced but depends on the accuracy of the time integration. This averts the
problem of converting lost kinetic energy into internal energy and overheating materials.
The pressure, viscosity and strain work evaluations are fully time centered as in the 2D
Lagrangian hydrodynamic code HEMP (Wilkins, 1965). To integrate -PdV for nonlinear
equations-of-state, a third order Runge-Kutta method is used. Although the explicit
hydrodynamic module is isentropic except at shocks, a temperature variable exists for
each region and the temperature EOS can be evaluated either as part of the constitutive
model or from the EOS tables.
Shocks are treated with a scalar artificial viscosity. The default version simply uses 8v/v
for compressing elements. Both linear and quadratic terms are available. Recently, R.
Christensen's monotonic artificial viscosity has been added. This scalar viscosity is
constructed using velocity gradients from which the linear component of the gradient has
been subtracted. The form can be derived from the linearized Riemann problem.
The most commonly used equations of state and constitutive models are analytic models
extracted from the KO family of codes (Woodruff, 1976; Steinberg, 1980 and 1996).
59
Several material models from DYNA are available for engineering applications and to
facilitate modeling of structures. Both the KO and DYNA based models can access the
LEOS equation-of-state tables. The majority of these models are for isotropic materials
and a von Mises yield condition is applied. The deviatoric part of the stress tensor is
integrated through time, and the Jaumann stress rate is used to satisfy objectivity.
Recently, a number of microstructurally based models have been added to provide a more
accurate representation of damage evolution mechanisms leading to fracture and to
capture anisotropy at both the single crystal and polycrystal size scales. A few of these
latter models do not have time centered energy evaluations or use high order integration
for the EOS. For all material models, a Navier-Stokes viscosity is available to augment
the stress tensor.
For most problems, high explosive (HE) detonation is simulated by using a programmed
burn model with a beta bum override. Several options are available for computing HE
lighting times. A reactive flow model for HE detonation is also available. This model
uses a pressure and volume dependent rate law to describe the detonation process. The
reactive flow model is zoning dependent, needs high resolution, and has limited
usefulness in 3D.
Slide Surfaces
As mentioned above, slide surfaces model contact discontinuities or mesh discontinuities.
Slide surface accelerations are computed using extensions of methods developed for the
2D Lagrangian hydrodynamics codes, HEMP and TENSOR (Cherry et al., 1965). Slide
surface velocities are computed with a momentum conserving algorithm. Each side of a
slide surface is independently accelerated using interpolated physics quantities from the
opposing side. First a node is accelerated as if it were on a free surface or a surface with a
pressure boundary condition. The boundary pressure is the average of the normal stresses
on each side of the surface. The acceleration of the node is decomposed into normal and
tangential components. The normal component for each side is combined with the
interpolated normal component from the opposite side to form a center-of-mass
acceleration. This acceleration is used to integrate the velocity. Unless friction is called
for, the tangential acceleration remains that of the free surface. A distinction is then
made between master and slave surfaces for the final application of continuity boundary
conditions. This last step corrects for any lack of perfect continuity in the normal
direction due to truncation errors
Techniques for ordering nodes on one side of the slide surface with respect to nodes on
the other side, and for making projections normal to the slide surface are borrowed from
DYNA3D. These techniques have been modified, however, to make them more robust.
The ordering algorithm has been improved so that nodes are not prone to penetrating the
slide surface and getting lost. The normal projection algorithm uses normals that vary
across a slide surface element and capture the affects of curvature of the surface.
The opposing sides of a slide surface may be separated and come into contact during the
course of a calculation. This is called a void. When voids close, the momenta from the
opposing sides are combined to form the center-of-mass momentum. The collision is
inelastic for the first layer of nodes on each side of the slide surface. Void closing is
always done from the perspective of the master side. This is done to avoid miscounting
60
momentum transferred from one side to the other if nodes on each side of the surface
close in different cycles.
By default, the tangential velocities on each side of a slide surface are decoupled.
However, coulomb friction can be applied. In this case, a tangential force is applied that
opposes any relative velocity. This force is proportional to the normal force that is
inferred from the acceleration required to change the normal velocity from its free surface
value to its center-of-mass value. For so-called, tied sliding, both the normal and
tangential accelerations are combined into center-of-mass accelerations. This enables one
to use slide surfaces to affect a zoning change in the middle of a region.
Special provision is made for intersecting or overlapping slide surfaces. Intersections are
assumed to be orthogonal and errors grow to the extent that this condition is violated.
There are some additional, minor errors at intersections if the calculation is run in
parallel. A penalty function method exists in the previous version of ALE3D but it has
not yet been moved to the parallel version. It is recommended only for some special
purposes. Likewise, a single sided algorithm for slide surfaces that fold upon themselves
has not yet been moved to the parallel code.
Advection
The advection step was developed to handle problems in which gross deformation of
objects would tangle a Lagrangian mesh. The advection step uses methods similar to
those developed for the 2D ALE code, CALE (Tipton, 1990), and the 3D Eulerian code,
JOY (Couch et al., 1983). An "ideal" grid is created using an equipotential grid relaxation
algorithm. (A pure Eulerian option is also available.) The state variables are then
remapped onto the new grid by constructing fluxes between the old grid and the new grid.
The fluxes for extensive variables (mass, internal energy, and momentum) are
conservative. For pure zones, a second order, monotonic algorithm is used to calculate
the fluxes. This technique was pioneered by van Leer (1977). Velocities are updated by
applying the results of momentum conservation. This leads to a loss of kinetic energy
(which is quadratic rather than linear in the velocity), and high order advection is
required to limit the loss. As a rule, lost kinetic energy is not added to internal energy in
order to explicitly force total energy conservation. However, kinetic energy lost in the
vicinity of a shock can be put back into the internal energy field. This is useful for the
purpose of propagating shocks over long distances without degradation.
During relaxation, mixed region elements can be created. Region interfaces are not
explicitly tracked; however, for the purpose of carrying out mixed element advection,
they are inferred from volume fractions. The mixed element fluxes are first order.
Separate state variables are kept for each component of a mixed element. Pressure
relaxation between components of a mixed element is also available.
Free surface nodes cannot be relaxed. Advection can take place up to, but not across, a
slide surface. The slave nodes of a slide surface can be relaxed, but not the master nodes.
If necessary and if slide surface nodes are forced to match across the slide surface, the
slide surface can be deleted during the course of the calculation and thereby allow for
advection after that time.
61
Implicit Hydrodynamics
The implicit hydrodynamics module was developed to model problems that evolve at
time scales orders of magnitude greater than the courant time scale that determines the
stability of the explicit equations. The implicit hydrodynamics is a finite element
displacement formulation with single or eight point integration. Single point integration
requires the addition of hourglass stabilization forces. The formulation solves the nonlinear equilibrium equations using a Newton-Raphson iteration surrounding a
linearization of the equations. This linearization is based on estimates for material
properties, etc., at the end of the timestep. Convergence of the non-linear iterations is
achieved when corrections to the displacements and the nodal forces are sufficiently
small. Slide surface constraints are maintained with Lagrange multipliers. The implicit
time integration can be run using a quasi-static approximation, or the inertial terms can be
included via a Hilber-Hughes-Taylor stabilization of the standard Newmark time
integration. The code can convert automatically from implicit to explicit hydrodynamics
when the timestep is sufficiently small that the explicit integration is more
computationally efficient.
Thermal Diffusion
The thermal diffusion module was originally incorporated to model manufacturing
processes such as casting, forging, rolling, and extrusion. However, it is implemented in a
manner that allows for application to most engineering heat transfer problems. Recently
the diffusion module has been coupled to a chemical kinetics module for the purpose of
modeling thermal ignition of high explosives. The existing capabilities include
conduction with orthotropic and temperature dependent properties, phase changes,
enclosure thermal radiation, thermal contact resistance across interfaces, and temperature,
flux, thermal radiation, and convection boundary conditions.
The hydrodynamics and the heat transfer are solved consecutively at each step by
operator splitting. The heat transfer step changes energy without changing volume and
the hydrodynamics step changes volume without transferring heat. Cell-centered energy
is made consistent with nodal temperatures by including an adiabatic expansion source
term, 2(SV/V), and strain heating. Chemical reactions also contribute a source term.
The heat conduction equations are solved using a finite element approach. The solution
includes implicit time integration, direct or iterative matrix solution, hexahedral elements
with second-order Gaussian quadrature integration, nonlinear convergence by successive
substitution or Newton Raphson methods, and variable time step control with subcycling
of the thermal diffusion and hydrodynamics.
Heat transfer can occur across a slide surface by perfect thermal contact or by heat
conduction using 'virtual elements'. Virtual elements are conduction and thermal
radiation resistive elements that are inserted between the slide surfaces. The virtual
elements can have zero thickness or their resistance can be scaled with gap distance. The
perfect thermal contact algorithm is formulated as a penalty method. It maintains
symmetry at boundary edges through geometrical and mass weighting, and scales the
penalty function with the magnitude of the diagonal term of the coefficient matrix.
62
Bibliography
[1] Greenman, Roxana M., Dunn, Timmothy A., Becker, Richard, and Nakafuji, Glen T.
(2001). ALE Simulations of Droplet Deformation in Aerodynamic Flows. American
Physical Society, 541h Meeting of the Division of Fluid, Nov. 18, 2001, San Diego, CA.
[2] Phillips, Carolyn L. (1999). The Level-Set Method. MIT Undergraduate Journal of
Mathematics, vol. 1, p. 155-163.
[3] Israelachvili, Jacob (1991). Intermolecular and Surface Forces (2
ed.). Academic
Press, Inc.
[4] Fay, James A. (1998). Introduction to Fluid Mechanics. Cambridge, MA: MIT
Press. p. 17-19.
[5] Benson, David J. (2002). Volume of Fluid Interface Reconstruction Methods for
Multi-MaterialProblems. Appl Mech Rev, vol. 55 no. 2, p. 151-165.
[6] Youngs, D.L. (1982). Time Dependent Multi-MaterialFlow with Large Fluid
Distortion. Numerical Methods for Fluid Dynamics. Academic Press. p. 273-285.
[7] Youngs, D. L. (1987). An Interface Tracking Methodfor a 3D Eularian
Hydrodynamics Code. Tech Report AWRE/44/92/35, AWRE Math Division.
[8] Sussman, Mark, Fatemi, Emad, Smereka, Peter, Osher, Stanley (1998). An Improved
Level Set Methodfor Incompressible Two-Phase Flows. Computers and Fluids, vol. 27,
p. 663-680.
[9] Osher, Stanley and Sethian, James A. (1988). FrontsPropagatingwith Curvature
Dependent Speed: Algorithms Based on Hamilton-JacobiFormulations. J. of
Computational Physics, vol. 79, p. 12-49.
63
[10] Moses, Brooks. A Nearly Volume-Preserving Level Set FormulationFor
Multiphase Flow Simulation. URL http://www.stanford.edu/-bmoses/cs339-project.pdf.
(visited July 17, 2002).
[11] Lin, Jerry I. DYNA3D User's Manual. URL
http://www.llnl.gov/eng/mdg/Codes/DYNA3D.pdf (visited August 7, 2003).
[12] Tipton, R. (1990). CALE User's Manual. Lawrence Livermore National
Laboratory.
[13] Abaqus Theory Manual (Ver. 6.3). Abaqus, Inc.
[14] Giroux, E.D. (1973). HEMP User's Manual. University of California, Lawrence
Livermore National Laboratory, Rept. UCRL-51079.
[15] Arfken, George (1985). Mathematical Methods for Physicists (3 ded.). San Diego:
Academic Press, Inc. p. 680-682.
[16] Tsamopoulos, John A. and Brown, Robert A. (1983). Nonlinear Oscillationsof
Inviscid Drops and Bubbles. J. of Fluid Mech, vol. 127, P. 519-537.
[17] Greenman, Roxana. Surface Tension Capabilityin ALE3D. Internal LLNL
document.
64
Download