• No se han encontrado resultados

5. Modelo predimensionamiento en Code_Bright

5.2 Ecuaciones de gobierno

This section describes the essential details of the isosurface stuffing meshing algo- rithm. Furthermore, we discuss the particulars of our implementation and its application for use in the liquid simulator.

3.2.1 Overview

Isosurface stuffing takes a level set function as an input and returns a body centered cubical (BCC) lattice tetrahedral mesh that is modified such that its boundary conforms well to the surface defined by the zero isocontour of the input function. The mesh has guaranteed quality elements and can be generated “whip fast.”

The first step of the meshing algorithm is to build a balanced octree that covers the volume to be meshed and that is refined to the levels desired by the user. In our

implementation the octree is refined to the finest level where the liquid surface is and grades to the coarsest level as quickly as is allowed by a balanced octree requirement. Alternatively, the user can specify whatever refinement criterion is desired, for example the criteria described in Section 3.1. One current limitation is that the guarantees on the mesh quality are severely degraded if the octree level varies over the cells that intersect the isosurface. Cells of the octree that lie completely within the liquid surface are filled with tetrahedra that have vertices at the corners and center of the cell. If a cell is adjacent to another cell that is refined to a finer level than itself, then vertices will also appear at the face and edge centers of the first cell. The tetrahedra are built from templates for each of the possible relative refinement levels of a cells neighbors.

Tetrahedra in cells that are sliced by the zero set of the level set function are modified so that they conform to the surface. We refer to the unmodified tetrahedra of the BCC lattice as background tetrahedra. First, the locations are found where the surface intersects the edges of the background tetrahedra. The location of an intersection can be found by querying the implicit function in a binary search along the edge. If the distance between a lattice vertex and an edge crossing is smaller than some fraction of the edge’s length, the vertex is moved to the closest crossing. Otherwise new vertices are added at the edge crossing locations, and the portion of each sliced background BCC tetrahedra that is inside the surface is filled with smaller tetrahedra. These tetrahedra can also be built from templates that depend on the number of vertices of the background tetrahedra that have been warped to the surface and how many edge crossings there are.

Figure 3.2: This figure illustrates the two-dimensional version of isosurface stuffing. Yellow points are the vertices of the octree lattice. The green line is the fluid’s surface. Blue points represent the warped locations of lattice vertices that were near the surface. Red points are vertices created where the surface cuts the lattice with no nearby vertices.

Figure 3.2 shows an example of how this approach can be applied to a two-dimensional triangulation. We also refer the reader to [41] for a detailed discussion of how this meshing algorithm is guaranteed to produce good-quality tetrahedra. Briefly, the strategy generates good quality tetrahedra because in the interior it uses high quality tetrahedra generated by the BCC lattice. Near the boundary it only moves the lattice vertices if the distance is sufficiently small to prevent creating bad tetrahedra. Otherwise it adds a vertex to an edge that is far enough away from existing vertices to avoid creating new thin tetrahedra.

3.2.2 Modifications

The algorithm works extremely well but as we use it in particular situation, a few minor modifications are needed. In a simulation the zero-contour of the implicit function which defines the liquid surface will typically not conform perfectly to an obstacle that the fluid is interacting with. This is due to small errors in the surface advection and because

a grid with finite resolution is used to represent the implicit function. To avoid errors that could lead to meshing inside the obstacle or artificial gaps between the obstacle and fluid, we build a negative signed distance function for each obstacle, then intersect it with the signed distance function for the liquid and use the result as the input of the meshing algorithm. After the mesh is built, vertices that are within some small tolerance (we use 1/8 the edge length of the finest octree level) of an obstacle are moved along their normal direction to snap to the obstacle. We have found that moving them this small distance does not introduce bad quality tetrahedra.

A mesh face on the boundary of the mesh is classified as liquid-obstacle interface if all of its vertices lie on the obstacle. All other boundary faces are classified as liquid-air interface.

3.2.3 Comments

Isosurface stuffing makes it feasible to simulate liquid with a large number of tetrahedra (in our examples∼ 1 − 3 million). The main advantage of the isosurface stuffing algorithm is its speed and quality guarantees. Because we use a different mesh every time step (to have a mesh that always conforms well to the moving liquid surface) it is imperative to generate meshes quickly. Good quality tetrahedra are needed because poor quality tetrahedra create simulation errors that can result in noticeable unnatural motion in the resulting animation.

A more subtle reason that isosurface stuffing makes the simulator feasible is that the meshes it creates exhibit structure that I aggressively exploit. For one, the meshes contain many tetrahedra that are identically shaped. Therefore, important geometric prop-

erties that are used in the simulator such as tetrahedra volumes, face areas, and face normals are the same for a large number of elements, and much memory can be saved by only stor- ing the geometric properties for the set of template shapes. When the geometric quantities for a particular tetrahedron are needed they can be obtained by referencing its template shape. In a typical simulation we find that, on average, approximately 2/3 of the tetrahedra come from template shapes. Another aspect of the mesh’s structure that we exploit is the spatial structure of each element’s location. As shown in Figure 6.10 the tetrahedra are positioned relative to the background octree structure. We take advantage of this structure when determining which tetrahedron contains some query point. First, we determine which leaf of the octree the point is in. Then we determine which portion of that cell it is in to efficiently find the appropriate tetrahedra.

The advantages offered by the structure inherent to isosurface stuffing allow for similar optimizations used with regular grids to be applied to the more adaptable tetrahedral mesh. While still not as memory or computationally efficient on a per-element basis as regular grids, we feel that the features of isosurface stuffing that we exploit allow for a very favorable compromise between the grading of tetrahedral meshes and the efficiency of regular grids.

One disadvantage of isosurface stuffing is that there is not complete freedom in the shape of the tetrahedra. For example, grading of the mesh is limited to octree refinement which means that tetrahedra can only be a discrete set of sizes. Taken in consideration with the numerous advantages that isosurface stuffing has to offer, we find this penalty insignificant and a price we are happy to pay.

Chapter 4

Simulation

4.1

Overview

After a mesh is generated we can associate fluid properties such as velocity and pressure with each mesh element. With these variables and an interpolation method, we can describe the fluid properties everywhere within the domain using a finite number of variables. Simulation is the process of determining these fluid property variables at instances in time such that the evolution of the discrete fluid approximates the behavior of a real fluid.

Simulation starts with an initial state for the fluid. This includes specifying the fluid domain (the volume of fluid we wish to simulate) and fluid properties within that domain. From this initial description of the fluid, we evolve the fluid over time using the following steps.

1. Mesh the fluid domain (as described in Chapter 3).

3. Alter the fluid domain by the fluid velocities, or by scripted motion of internal objects or external boundaries.

The simulation repeats this process using the updated fluid properties (computed by step 2) as initial fluid properties, and using the updated fluid domain (computed by step 3) as the initial domain in the next iteration through the steps. The simulation domain of a liquid with a free surface is altered by the motion of the liquid. Accurately tracking the domain is a difficult problem and the subject of much research. In our implementation we use the semi-Lagrangian contouring technique of Bargteil et al.[3]. At the boundary between a fluid and a solid object, the domain can change by either scripted motion of the object or by the interaction of the fluid with the object. The first case is trivial since it is a specified motion. We describe a method for simulating the two-way interaction between a fluid and a rigid body in Section 4.7.3.

This chapter is mainly concerned with step 2 above, altering the fluid properties such that they change according to the governing equations of motion of the fluid. In this chapter I first describe the equations used in this work. Next, I discuss how to al- ter the discrete fluid variables on a tetrahderal mesh discretization such that they evolve approximately according to the equations of motion.

Documento similar