Fluid Modeling and Boolean Algebra for Arbitrarily Complex Topology in Two Dimensions

# Fluid Modeling and Boolean Algebra for Arbitrarily Complex Topology in Two Dimensions

Qinghai Zhang School of Mathematical Sciences, Zhejiang University, 38 Zheda Road, Hangzhou, Zhejiang Province, 310027 China (qinghai@zju.edu.cn).    Zhixuan Li School of Mathematical Sciences, Zhejiang University, 38 Zheda Road, Hangzhou, Zhejiang Province, 310027 China (zihinlai@163.com).
###### Abstract

We propose a mathematical model for fluids in multiphase flows in order to establish a solid theoretical foundation for the study of their complex topology, large geometric deformations, and topological changes such as merging. Our modeling space consists of regular open semianalytic sets with bounded boundaries, and is further equipped with constructive and algebraic definitions of Boolean operations. Major distinguishing features of our model include (a) topological information of fluids such as Betti numbers can be easily extracted in constant time, (b) topological changes of fluids are captured by non-manifold points on fluid boundaries, (c) Boolean operations on fluids correctly handle all degenerate cases and apply to arbitrarily complex topologies, yet they are simple and efficient in that they only involve determining the relative position of a point to a Jordan curve and intersecting a number of curve segments. Although the main targeting field is multiphase flows, our theory and algorithms may also be useful for related fields such as solid modeling, computational geometry, computer graphics, and geographic information system.

Key words. Multiphase flows, fluid modeling, topological changes, Boolean algebra, Betti numbers, oriented Jordan curves, polygon clipping.

AMS subject classifications. 76T99, 65D18, 06E99

## 1 Introduction

Physically meaningful regions in the sense of homogeneous continua are ubiquitous, and their modeling is of fundamental significance in innumerable applications of science and engineering. Traditionally, the modeling of two- and three-dimensional physical regions is the main subject of a mature research field called solid modeling [29, 35]. In comparison, modeling of fluids have always been avoided in the field of multiphase flows. However, rapid advancements in the science of multiphase flows have been calling for such a model so that complex phenomena such as those involving topological changes of fluids can be studied rigorously.

In this paper, we aim to answer this need by introducing the notion of fluid modeling in multiphase flows, analogous to solid modeling in computer-aided design (CAD). We propose a topological space for fluid modeling and further equip this space with natural algebraic structures in order to extract essential topological information and to perform simple and efficient Boolean operations.

In Sections LABEL:sec:solid-modeling, LABEL:sec:fluid-model-interf, and LABEL:sec:boolean-operations, we motivate different aspects of fluid modeling and review previous efforts and relevant results. We then list in Section LABEL:sec:motiv-contr-this a number of questions as the more detailed targets of this work.

### 1.1 Solid modeling

What distinguishes solid modeling from similar disciplines such as computer graphics is its emphasis on physical fidelity, as evident in its underlying mathematical and computational principles. This emphasis is natural: driven by the design, analysis, and manufacture of engineering systems, solid modeling must support the representation, visualization, exchange, interrogation, and creation of physical objects in CAD.

One common approach of solid modeling relies on point-set topology. The classical modeling space proposed by Requicha and colleagues [28, 31, 30] consists of r-sets, which are bounded, closed, regular semianalytic sets in Euclidean spaces. The regularity condition captures in solid continua the absence of low-dimensional features such as isolated gaps and points, and the semianalytic condition postulates that the boundary of a solid be locally well behaved; see Section LABEL:sec:regularSets for more details.

The other common approach in solid modeling is combinatorial, in the sense of cell complexes in algebraic topology [22] [34]. Complex objects are viewed in terms of primitive building blocks called cells, thus it is not the constituting cells but their combinational informations that describe the physical object. Take simplicial complexes for example, a -cell is a -simplex in the Euclidean space , and many cells of different dimensions are glued together to form an -dimensional simplicial complex by requiring that any adjacent pair of -cells be attached to each other along a -cell for each . The adjacency of -cells is encoded in the th boundary operator , which maps each -cell to an element in the -chain , a group of formal sums of -cells. If we concatenate the chain groups with the boundary operators, we obtain a chain complex,

 \leavevmodeto157.1pt\vboxto5pt\pgfpicture\makeatletterto0.0pt\pgfsys@beginscope\definecolorpgfstrokecolorrgb0,0,0\pgfsys@color@rgb@stroke000\pgfsys@color@rgb@fill000\pgfsys@setlinewidth0.4pt\nullfontto0.0pt\pgfsys@beginscope\hbox{{\pgfsys@beginscope{\offinterlineskip{}{}{{{} }{{} }{{} }{{} }{{} }}{{{}}}{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} {}{{{{}}{\pgfsys@beginscope\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{0.0pt}{0.0% pt}{}\hbox{\vbox{\halign{\cr}{\hskip 10.149911pt\hbox{{\pgfsys@beginscope {{}}\hbox{\hbox{{\pgfsys@beginscope{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} {}{{{{}}{\pgfsys@beginscope\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-5.849911pt% }{0.0pt}{}\hbox{\definecolorpgfstrokecolorrgb0,0,0\pgfsys@color@rgb@stroke000\pgfsys@color@rgb@fill000Cn}{}% \pgfsys@endscope}}}}\pgfsys@endscope}}}\pgfsys@endscope{}}}}&\hskip 10.149911% pt&{\hskip 28.049943pt\hbox{{\pgfsys@beginscope {{}}\hbox{\hbox{{\pgfsys@beginscope{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} {}{{{{}}{\pgfsys@beginscope\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-3.749943pt% }{0.0pt}{}\hbox{\definecolorpgfstrokecolorrgb0,0,0\pgfsys@color@rgb@stroke000\pgfsys@color@rgb@fill000⋯}{}% \pgfsys@endscope}}}}\pgfsys@endscope}}}\pgfsys@endscope{}}}}&\hskip 8.049943pt% &{\hskip 30.149911pt\hbox{{\pgfsys@beginscope {{}}\hbox{\hbox{{\pgfsys@beginscope{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} {}{{{{}}{\pgfsys@beginscope\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-5.849911pt% }{0.0pt}{}\hbox{\definecolorpgfstrokecolorrgb0,0,0\pgfsys@color@rgb@stroke000\pgfsys@color@rgb@fill000Ck}{}% \pgfsys@endscope}}}}\pgfsys@endscope}}}\pgfsys@endscope{}}}}&\hskip 10.149911% pt&{\hskip 28.049943pt\hbox{{\pgfsys@beginscope {{}}\hbox{\hbox{{\pgfsys@beginscope{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} {}{{{{}}{\pgfsys@beginscope\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-3.749943pt% }{0.0pt}{}\hbox{\definecolorpgfstrokecolorrgb0,0,0\pgfsys@color@rgb@stroke000\pgfsys@color@rgb@fill000⋯}{}% \pgfsys@endscope}}}}\pgfsys@endscope}}}\pgfsys@endscope{}}}}&\hskip 8.049943pt% &{\hskip 30.149911pt\hbox{{\pgfsys@beginscope {{}}\hbox{\hbox{{\pgfsys@beginscope{{}{}{{ {}{}}}{ {}{}} {{}{{}}}{{}{}}{}{{}{}} {}{{{{}}{\pgfsys@beginscope\pgfsys@transformcm{1.0}{0.0}{0.0}{1.0}{-5.849911pt% }{0.0pt}{}\hbox{\definecolorpgfstrokecolorrgb0,0,0\pgfsys@color@rgb@stroke000\pgfsys@color@rgb@fill000C0}{}% \pgfsys@endscope}}}}\pgfsys@endscope}}}\pgfsys@endscope}}}&\hskip 10.149911pt}% }}{}\pgfsys@endscope}}}}{{{{}}}{{} }{{} }{{} }{{} }{{} }}}\pgfsys@endscope}\pgfsys@beginscope\pgfsys@setlinewidth0.0pt\pgfsys@moveto20.499821pt0.0pt\pgfsys@lineto40.099822pt0.0pt\pgfsys@stroke\pgfsys@invoke\pgfsys@endscope\pgfsys@beginscope\pgfsys@setlinewidth0.0pt\pgfsys@moveto56.599708pt0.0pt\pgfsys@lineto76.199708pt0.0pt\pgfsys@stroke\pgfsys@invoke\pgfsys@endscope\pgfsys@beginscope\pgfsys@setlinewidth0.0pt\pgfsys@moveto96.899529pt0.0pt\pgfsys@lineto116.49953pt0.0pt\pgfsys@stroke\pgfsys@invoke\pgfsys@endscope\pgfsys@beginscope\pgfsys@setlinewidth0.0pt\pgfsys@moveto132.999416pt0.0pt\pgfsys@lineto152.599415pt0.0pt\pgfsys@stroke\pgfsys@invoke\pgfsys@endscope\pgfsys@endscope\hss\pgfsys@discardpath\pgfsys@endscope\hss\endpgfpicture, \hb@xt@.01(1.1)

where each boundary operator is a group homomorphism. This chain complex is all we need for mathematical modeling and computer representation of any -dimensional solid! As a prominent advantage, key topological quantities, such as the number of connected components and the number of holes, can be systematically computed from the chain complex. The cost of this computation, however, can be substantial [15].

Thanks to the fact that any r-set can be represented by a simplicial complex as accurately as one wishes, the point-set approach and the combinatorial approach are seamlessly consistent [30]. Thus we can use these two models interchangeably, at least theoretically. This consistency also forces an -dimensional r-set to be closed; otherwise a boundary operator in (LABEL:eq:chainComplex) may have a range outside of the chain complex.

### 1.2 Fluid modeling and interface tracking (IT) in multiphase flows

In dramatic comparison to the aforementioned research on solid modeling, efforts on geometric modeling of fluids are rare: mathematical models and computer algorithms have been deliberately designed such that geometric modeling of fluids is avoided in numerically simulating multiphase flows. In the volume-of-fluid (VOF) method [12], a deforming fluid phase is represented by a color function , of which the value is 1 if there is at and 0 otherwise; then the fluid phase at time is represented as a moving point set . Either the scalar conservation law

 ∂f∂t+∇⋅(fu)=0 \hb@xt@.01(1.2)

or the advection equation

 ∂f∂t+u⋅∇f=0 \hb@xt@.01(1.3)

is solved to recover the boundary of at subsequent time instants. In the level-set method [25], the boundary of a fluid phase is represented as the zero isocontour of a signed distance function , and once again the region of the fluid phase is recovered by numerically solving either (LABEL:eq:SCL) or (LABEL:eq:advection) on . In the front tracking method [40], the boundary of a fluid phase is represented by connected Lagrangian markers; tracking the fluid phase is then reduced to tracking these markers via numerically solving ordinary differential equations. In all of these IT methods, geometric problems in deforming fluids with sharp interfaces are converted to numerically solving differential equations. With topological information discarded, this conversion largely reduces the complexity of IT both theoretically and computationally; this is a main reason for successes of the aforementioned IT methods. During the past forty years, these IT methods have been extremely valuable in studying multiphase flows.

As the science of multiphase flows moves towards more and more complex phenomena, higher and higher expectations are imposed on IT. First, the wider and wider spectrum of relevant time scales and length scales in mainstream problems demands that IT methods be more and more accurate and efficient. Second, the tight coupling of interface to ambient fluids necessitates accurate estimation of derived geometric quantities such as curvature and unit normal vectors. Third, topological changes of a fluid phase such as merging exhibit distinct behaviors for different regimes of the Weber number and other impact parameters [27], hence it is not enough to handle topological changes solely from the interface locus and the velocity field. For these problems, an IT method should also take as its input a policy that describes how the interface shall evolve at the branching time and place of topological changes.

Despite their tremendous successes, current IT methods have a number of limitations in answering the aforementioned challenges of multiphase flows. First, most methods are at best second-order accurate [43]. Second, the IT errors put an upper limit on the accuracy of estimating curvature and unit vectors. It is shown in [47] that, for a second-order method, its error of curvature estimation is proportional to where denotes a norm of IT errors. In other words, the number of accurate digits one gets in curvature estimation is at best half of that in the IT results. Third, the avoidance of geometric modeling of fluids renders it highly difficult to treat topological changes rigorously. When merging and separation happen, front-tracking methods have to resort to “surgical” operations that are short of theoretical justification. VOF methods and level-set methods have no special procedures for topological changes; this is often advertised as an advantage. However, by using this “automatic” treatment, an application scientist has no control over the evolution of an interface that undergoes topological changes: the evolution is determined not by the physics, but by particularities of numerical algorithms [43, 48]. Clearly, this disadvantage is a consequence of avoiding the geometric and topological modeling of fluids.

In this work, we aim to establish a theoretical foundation for fluid modeling. To prevent reinventing the wheel, we have tried to utilize the wealth of solid modeling, but found that none of the two main approaches in Section LABEL:sec:solid-modeling is adequate for fluid modeling. Topology computing based on cell complexes involves much machinery, yet its efficiency may not be acceptable; nor are the r-sets suitable for fluid modeling. First, the requirement of r-sets being closed is not amenable to numerical analysis of IT methods [43]. Second, topological changes create on the fluid boundary a special type of non-manifold points, such as the points in Figure LABEL:fig:YinSets, which cause non-uniqueness of boundary representations, c.f. Figure LABEL:fig:boundaryDecompositions. This non-uniqueness degrades isomorphisms to homomorphisms in the association of algebraic structures with elements in the topological modeling space. Third, r-sets can be modified to yield a new Boolean algebra whose implementation is much simpler and more efficient.

### 1.3 Boolean operations

The operations to be performed on the modeling space are an indispensable part of the modeling process; after all, a major purpose of modeling is to answer questions on the objects being modeled. Hence theoretically a modeling space is shaped by primary cases of queries. Computationally, these operations should be defined algebraically and constructively so that they furnish realizable algorithms that finish in reasonable time.

We are interested in Boolean operations on physically meaningful regions with arbitrarily complex topologies. This interest follows naturally from the motivations in Section LABEL:sec:fluid-model-interf. First, we have shown that algorithms for clipping splinegons with a linear polygon can improve the IT accuracy by many orders of magnitudes [48]. Second, for coupling an IT method to an Eulerian main flow solver, regions occupied by the fluid inside fixed control volumes are needed to define averaged values and to construct stencils for approximating spatial operators with linear combinations of these averaged values. Third, in handling topological changes, the emerging time and sites of non-manifold points need to be detected on the fluid boundary before we are able to decide how to evolve it. This detecting problem requires calculating intersections of multiple regions inside a single control volume.

Boolean operations on polygons are an active and intense research topic in many related fields such as computational geometry, computer graphics, CAD, and geographic information system (GIS). In particular, physically meaningful regions in GIS such as parks, roads, and lakes are represented by polygons and their Boolean operations are essential for extracting information and answering queries. Consequently, there exist numerous papers on this topic; see, e.g., [38, 18, 41, 10, 24, 19, 7, 36, 21] and references therein. However, many current algorithms are subject to strong restrictions on operand polygons such as convexity, simple-connectedness, and no self-intersections. In addition, most algorithms fail for degenerate cases such as a vertex of a polygon being on the edge of the other polygon; these degenerate scenarios, nonetheless, are at the core of characterizing and treating topological changes. Therefore, current Boolean algorithms are not suitable for fluid modeling.

As another main reason for their lack of applicability in multiphase flows, very few of current Boolean algorithms have a solid mathematical foundation, and those that do have other notable drawbacks. For example, Boolean algorithms based on cell complexes [26, 32] seem to be inefficient for complex topologies. Those based on Nef polyhedra [23, 3, 11] have an elegant theoretical foundation and is applicable to arbitrarily complex topologies, but they appear as an overkill for fluid modeling in that many elements in the modeling space of Nef polyhedra do not have counterparts in multiphase flows. In addition, the corresponding algorithms and data structures are complicated and difficult to implement. For both types of algorithms, computing the topological information such as Betti numbers would be very time-consuming.

### 1.4 Motivations and contributions of this work

Methods that couple elementary concepts or tools from multiple disciplines often perform surprisingly well. For fluid-structure interactions, a recent approach called isogeometric analysis [6, 1] has been increasingly popular, and much of its success is due to the integration of finite element methods with highly accurate (and sometimes exact) solid modeling in CAD. In our previous work, we have adopted a similar guiding principle to integrate IT with a topological space for fluid modeling [49]. The resulting generic framework, called MARS, furnishes new tools for analyzing current IT methods [43] and leads to a new IT method and a new curvature-estimation algorithm that are more accurate than current methods by many orders of magnitudes [47, 48].

In recognition of the potentially large benefits of integrating fluid modeling with multiphase flows and in view of the discussions in previous subsections, we list a number of questions as the driving forces behind this work.

1. Can we propose a generic topological space that appropriately models physically meaningful regions across multiple research fields such as solid modeling, GIS, and multiphase flows?

2. Can we find a simple representation scheme for elements in the modeling space to facilitate geometric and topological queries?

3. Can we design simple and efficient Boolean operations that correctly handle all degenerate cases?

4. In particular, can we provide theoretical underpinning and algorithmic support for handling topological changes of moving regions?

5. Meanwhile, can we extract topological information such as Betti numbers with optimal complexity?

In this paper, we provide positive answers to all of the above questions. (Q-1) is answered in Section LABEL:sec:repr-yin-sets, where physically meaningful regions are modeled by a topological space, called the Yin space, which consists of regular open semianalytic sets with bounded boundaries. These conditions capture fluid features that are commonly relevant in multiphase flows, solid modeling, and GIS. Furthermore, Yin sets are defined in terms of computable mathematical properties and are thus independent of any particular representation or individual application. As such, this modeling space serves as a bridge between multiphase flows and the other fields that emphasize geometry and topology. As our answer to (Q-2), each Yin set can be uniquely expressed as the result of finite Boolean operations on interiors of oriented Jordan curves. This uniqueness leads to an isomorphism from the Yin space into the Jordan space, a collection of certain posets of oriented Jordan curves, and this isomorphism reduces Boolean algebra on the two-dimensional Yin space to one-dimensional routines in the Jordan space, namely locating a point relative to a simple polygon and finding intersections of curve segments. This is our answer to (Q-3); see Section LABEL:sec:boolean-algebra-yin.

In addressing (Q-4), we pay special attentions to issues related to non-manifold points on the fluid boundary, such as characterizing topological changes with improper intersections of curves and dividing closed curves at these improper intersections to ensure correctness of Boolean operations. However, we emphasize that, in both our theory and our algorithms, non-manifold points of topological changes are treated not as an anomaly, but as a natural consequence of capturing the physical meaningfulness of fluids with the mathematical conditions that constitute the notion of Yin sets. This is a major advantage of the Yin sets over the r-sets.

As another prominent feature of our theory, the number of connected components in any bounded Yin set is simply the number of positively oriented Jordan curves in its boundary representation, and the number of holes in a component is the number of negatively oriented Jordan curves in the boundary representation of that component. Since these numbers are returned in time, our answer to (Q-5) is of optimal complexity.

The rest of this paper is organized as follows. In Section LABEL:sec:prel-notat, we introduce prerequisites and notation. In Section 3, we propose Yin sets as our fluid modeling space and study its topological properties. In Section 4, we design Boolean operations on the Yin space in a way so that corresponding algorithms can be implemented by straightforward orchestration of the definitions. Utilizing the Bentley-Ottmann paradigm of plane sweeping [2] in calculating intersections of curve segments, our current implementation of the Boolean operations is close to optimal complexity. A number of fun tests are given in Figure LABEL:fig:panda-mickey to illustrate the Boolean algebra. Finally, we draw the conclusion and discuss several research prospects in Section LABEL:sec:conclusion.

## 2 Preliminaries

In this section we collect relevant definitions and theorems that form the algebraic foundation of this work. Some notations introduced here will be repeatedly used in subsequent sections.

### 2.1 Partially ordered sets

The Cartesian product of a nonempty set with itself times is denoted by ; in particular, . An -ary relation on is a subset of ; if it is called a binary relation. A given binary relation “” on a set is said to be an equivalence relation if and only if it is reflexive (), symmetric (), and transitive () for all . A binary relation “” defined on a set is a partial order on if and only if it is reflexive (), antisymmetric (), and transitive () for all .

A nonempty set with a partial order on it is called a partially ordered set, or more briefly a poset. Two elements are comparable if either or ; otherwise and are incomparable. If all are comparable by , then “” is a total order on and is a chain or linearly-ordered set. For examples, with the usual order of real numbers is a chain; the power set of , i.e. the set of all subsets of , with the subset relation “” is a poset but not a chain. The notation means , and means both and .

###### Definition 2.1 (Covering relation)

Let denote a poset and . We say covers and write or if and only if and no element satisfy .

Most concepts on the ordering of make sense for posets. Let be a subset of a poset . An element is an upper bound of if for all . is the least upper bound of , or supremum of () if is an upper bound of , and for any upper bound of . Similarly we can define the concepts of a lower bound and the greatest lower bound of or the infimum of ().

###### Definition 2.2 (Lattice as a poset)

A lattice is a poset satisfying that, for all , both sup and inf exist in .

### 2.2 Distributive Lattices

An -ary operation on is a function where is the arity of . A finitary operation is an -ary operation for some nonnegative integer . is nullary (or a constant) if its arity is zero, i.e. it is completely determined by the only element , hence a nullary operation on can be identified with the element ; for convenience it is regarded as an element of . An operation on is unary or binary if its arity is 1 or 2, respectively.

###### Definition 2.3 (Universal algebra)

A algebra is an ordered pair where is a nonempty set and a family of finitary operations on . The set is the universe or the underlying set of and the fundamental operations of .

An algebra is finite if the cardinality of its universe is bounded. When is finite, say , we also write with the operations sorted by their arities in descending order. As a common example, a group is an algebra of the form where are a binary, a unary, and a nullary operations on , respectively.

###### Definition 2.4 (Lattice as an algebra)

A lattice is an algebra where contains two binary operations and (read “join” and “meet” respectively) on that satisfy the following axiomatic identities for all ,

1. commutative laws: , ;

2. associative laws: , ;

3. absorption laws: , .

Sometimes the following idempotent laws are also included in the definition of a lattice although they can be derived from the above three axioms,

 x∨x=x,x∧x=x. \hb@xt@.01(2.1)

A lattice defined as a poset can be converted to an algebra by constructing the binary operations as and ; the converse case can also be achieved by defining the partial order as . Hence Definition LABEL:def:LatticeAsPoset and Definition LABEL:def:LatticeAsAlgebraicStruct are equivalent.

###### Definition 2.5

A bounded lattice is an algebra where contains binary operations and nullary operations so that is a lattice and, ,

 x∧^0=^0,x∨^1=^1. \hb@xt@.01(2.2)

The boundedness in the above definition is best understood from the poset viewpoint: and for all .

###### Definition 2.6

A distributive lattice is a lattice which satisfies either of the distributive laws

 x∧(y∨z)=(x∧y)∨(x∧z),x∨(y∧z)=(x∨y)∧(x∨z). \hb@xt@.01(2.3)

Either identity in (LABEL:eq:distributiveLaws) can be deduced from the other and Definition LABEL:def:LatticeAsAlgebraicStruct [5, p. 10].

A notion central to every branch of mathematics is isomorphism. In particular, two lattices are isomorphic if they have the same structure.

###### Definition 2.7 (Lattice isomorphism)

A homomorphism of the lattice into the lattice is a map satisfying

 ∀x,y∈\@fontswitchL1,  ϕ(x∨y)=ϕ(x)∪ϕ(y), ϕ(x∧y)=ϕ(x)∩ϕ(y). \hb@xt@.01(2.4)

An isomorphism is a bijective homomorphism.

More details on distributive lattices can be found in [5] from the perspective of universal algebra and in [37, ch. 3] from the viewpoint of posets. See [9] for a more accessible one.

### 2.3 Boolean algebra

The simplest definition may be due to Huntington [13].

###### Definition 2.8

A Boolean algebra is an algebra of the form

 B:=(\@fontswitchB, ∨, ∧, ′, ^0, ^1), \hb@xt@.01(2.5)

where the binary operations , the unary operation called complementation, and the nullary operations satisfy

1. the identity laws: ,

2. the complement laws: ,

3. the commutative laws (LA-1),

4. the distributive laws (LABEL:eq:distributiveLaws).

Other definitions contain redundant axiomatic laws that can be deduced from the above four conditions. For example, Givant and Halmos [8, p. 10] defined a Boolean algebra as an algebra with its fundamental operations satisfying (LA-1), (LA-2), (LABEL:eq:idempotentLaws), (LABEL:eq:boundedLattice), (LABEL:eq:distributiveLaws), (BA-1), (BA-2), , , , and the DeMorgan’s laws,

 (x∧y)′=x′∨y′,(x∨y)′=x′∧y′. \hb@xt@.01(2.6)

In this work we adopt the viewpoint of Burris and Sankappanavar [5, p. 116].

###### Definition 2.9

A Boolean algebra is a bounded distributive lattice with an additional complementation operation that satisfies the complement laws (BA-2).

### 2.4 Veblen’s theorem

A graph is an ordered pair where is the set of vertices and the set of edges, each edge being an unordered pair of distinct vertices. is a subgraph of , written as , if and . If , then and are adjacent in , and the edge is said to be incident to and . The degree of a vertex is the number of edges incident to .

###### Definition 2.10

A path is a graph of the form and . A cycle is a graph of the form where is a path and .

A graph is connected if for every pair of distinct vertices in there is a subgraph of as the path from one vertex to the other. A component of the graph is a maximal connected subgraph.

###### Theorem 2.11 (Veblen [42])

The edge set of a graph can be partitioned into edge-disjoint cycles if and only if the degree of every vertex is even.

Proof. If a graph is the union of a number of edge-disjoint cycles, then clearly a vertex contained in cycles has degree . Hence the necessity holds.

Suppose that the degree of every vertex is a positive even integer. How do we find a single cycle in ? Let be a path of maximal length in . Since , must have another neighbor in addition to . Furthermore, we must have for some ; otherwise it would contradict the starting condition that is of maximal length. Therefore we have found a cycle .

Having found one cycle, we remove it from . If the remaining subgraph of is not empty, then the degree of every vertex in remains positive and even. Repeating the cycle-finding procedures completes the proof; see [4, p. 5].

A multigraph is an augmented graph that allows loops and multiple edges; the former is defined as a special edge joining a vertex to itself and the latter several edges joining the same vertices. A loop contributes 2 to the degree of a vertex while each edge in a multiple edge contribute 1. As for cycles, the condition of in Definition LABEL:def:cycles is changed to for a multigraph: indicates a loop and two edges joining the same vertices. It is straightforward to extend Theorem LABEL:thm:Veblen to multigraphs.

###### Theorem 2.12

The edge set of a multigraph can be partitioned into edge-disjoint cycles if and only if the degree of each vertex is positive and even.

A directed graph/multigraph is a graph/multigraph where the edges are ordered pairs of vertices. An edge is then said to start at and end at . Furthermore, the degree of a vertex is split into the outdegree and the indegree , with the former as the number of edges starting at and the latter that of edges ending at . Veblen’s Theorem generalizes to directed multigraphs in a straightforward manner.

###### Theorem 2.13

The edge set of a directed multigraph can be partitioned into directed cycles if and only if each vertex has the same outdegree and indegree.

## 3 Yin sets

Based on regular semianalytic sets introduced in Section LABEL:sec:regularSets, we propose in Section LABEL:sec:YinSpace the Yin space for fluid modeling in two dimensions. From the viewpoint of Jordan curves in Section LABEL:sec:JordanCurves, we study in Section LABEL:sec:topologyOfYinSets the local and global topology of Yin sets, the results of which yield the notion of realizable spadjors in Section LABEL:sec:spadjors as a unique boundary representation of Yin sets.

### 3.1 Regular semianalytic sets

In a topological space , the complement of a subset , written , is the set . The closure of a set , written , is the intersection of all closed supersets of . The interior of , written , is the union of all open subsets of . The exterior of , written , is the interior of its complement. By the identity [8, p. 58], we have . A point is a boundary point of if and . The boundary of , written , is the set of all boundary points of . It can be shown that and . An open set is regular if it coincides with the interior of its own closure, i.e. if . A closed set is regular if it coincides with the closure of its own interior, i.e. if . The duality of the interior and closure operators implies , hence is a regular open set if and only if . For any subset , it can be shown that is a regular open set and is a regular closed set.

Regular sets, open or closed, capture the salient feature that physically meaningful regions are free of lower-dimensional elements such as isolated points and curves in 2D and dangling faces in 3D.

###### Theorem 3.1 (MacNeille [20] and Tarski [39])

Let denote the class of all regular open sets of a topological space and define for all . Then is a Boolean algebra.

Proof. See [8, §10].

Similarly, it can be shown that, with appropriately defined operations, regular closed sets of a topological space also form a Boolean algebra [17, p. 39].

Regular sets are not perfect for representing physically meaningful regions yet: some of them cannot be described by a finite number of symbol structures. For example, some sets have nowhere differentiable boundaries, which, in their parametric forms, are usually infinite series of continuous functions [33]. Another pathological case is more subtle: intersecting two regular sets with piecewise smooth boundaries may yield an infinite number of disjoint regular sets. Consider

 {Ap:={(x,y)∈R2:−2

Although both and are described by two inequalities, their intersection is a disjoint union of an infinite number of regular sets; see [28, Fig. 4-1, Fig. 4-2]. This poses a fundamental problem that results of Boolean operations of two regular sets may not be well represented on a computer by a finite number of entitites.

Therefore, we need to find a proper subspace of regular sets, each element of which is finitely describable. This search eventually arrives at semianalytic sets.

###### Definition 3.2

A set is semianalytic if there exist a finite number of analytic functions such that is in the universe of a finite Boolean algebra formed from the sets

 Xi={x∈RD:gi(x)≥0}. \hb@xt@.01(3.2)

The ’s are called the generating functions of . In particular, a semianalytic set is semialgebraic if all of its generating functions are polynomials.

Recall that a function is analytic if and only if its Taylor series at converges to the function in some neighborhood for every in its domain. In the example of (LABEL:eq:pathologicalIntersection), is semianalytic while is not, because the Taylor series of at the origin does not converge. Roughly speaking, the boundary curves of regular semianalytic sets are piecewise smooth.

### 3.2 Y: the Yin space for fluid modeling

Regular closed semianalytic sets have been an essential mathematical tool for solid modeling since the dawning time of this field [31]. However, as shown in Figure LABEL:fig:boundaryDecompositions, requiring regular semianalytic sets to be closed would make their boundary representation not unique, degrading the isomorphism in Definition LABEL:def:boundaryToInteriorMap and Theorem LABEL:thm:b2iMapIsBijective to a homomorphism. As another work closely related to this one, the analysis on a family of interface tracking methods [43, 49] via the theory of donating regions [44, 45] also requires that the regular sets be open. Therefore, only regular open semianalytic sets are employed in this work.

###### Definition 3.3

A Yin set111 Yin sets are named after the first author’s mentor, Madam Ping Yin. As a coincidence, the most important dichotomy in Taoism consists of Yin and Yang, where Yang represents the active, the straight, the ascending, and so on, while Yin represents the passive, the circular, the descending, and so on. From this viewpoint, straight lines and Jordan curves can be considered as Yang 1-manifolds and Yin 1-manifolds, respectively. is a regular open semianalytic set whose boundary is bounded. The class of all such Yin sets form the Yin space .

In Figure LABEL:fig:YinSets, the Yin set in subplot (a) is unbounded and connected while that in subplot (b) is bounded and consists of four disjoint components.

By Definition LABEL:def:semianalytic-sets, semianalytic sets are closed under set complementation, finite union, and finite intersection. Then by Theorem LABEL:thm:regularOpenAlgebra, regular open semianalytic sets form a Boolean algebra since they are the intersection of the universes of two Boolean algebras. Furthermore, Boolean operations on Yin sets preserve the attribute of a bounded boundary being bounded, hence we have

###### Theorem 3.4

The algebra is a Boolean algebra.

### 3.3 Jordan curves and orientations

A path in from to is a continuous map satisfying and . A subset of is path-connected if every pair of points of can be joined by a path in . Given , define an equivalence relation on by setting if there is a path-connected subset of that contains both and . The equivalence classes are called the path-connected components of .

A planar curve is a continuous map . It is smooth if the map is smooth. It is simple if the map is injective; otherwise it is self-intersecting. Although strictly speaking a curve is a map, we also use to refer to its image. Two distinct piecewise smooth curves and intersect at if there exist such that . Then is the intersection of and . For an open ball with sufficiently small radius , consists of two disjoint connected regular open sets. If is entirely contained in one of these two sets, is an improper intersection; otherwise it is a proper intersection. Two curves are disjoint if they have neither proper intersections nor improper ones. Suppose upon its extension to a path, a simple curve further satisfies , then is a simple closed curve or Jordan curve.

###### Theorem 3.5 (Jordan Curve Theorem [14])

The complement of a Jordan curve in the plane consists of two components, each of which has as its boundary. One component is bounded and the other is unbounded; both of them are open and path-connected.

The above theorem states that a Jordan curve divides the plane into three parts: itself, its interior, and exterior.

###### Definition 3.6

The interior of an oriented Jordan curve , denoted by , is the component of the complement of that always lies to the left when an observer traverses the curve in the increasing direction of the parameterization .

A Jordan curve is said to be positively oriented if its interior is the bounded component of its complement; otherwise it is negatively oriented. The orientation of a Jordan curve can be flipped by reversing the increasing direction of the parameterization. The following notion will be used throughout this work.

###### Definition 3.7

Two Jordan curves are almost disjoint if they have no proper intersections and at most a finite number of improper intersections.

### 3.4 The local and global topology of a Yin set

The following lemma characterizes the local topology of a Yin set at its boundary.

###### Lemma 3.8

Let be a boundary point of a Yin set and denote by the open ball centered at with its radius . For any sufficiently small ,

1. consists of simple curves, where is a finite positive integer,

2. if , all simple curves in (a) intersect and is their sole intersection,

3. consists of an even number of disjoint regular open sets; for two such sets sharing a common boundary, one is a subset of while the other that of .

Proof. Since is semianalytic, Definition LABEL:def:semianalytic-sets implies that is defined by a finite number of analytic functions . By the implicit function theorem, each defines a planar curve. Then (a) and (b) follows from the condition of being regular open and the condition that can be as small as one wishes. Hence the local topology at a boundary point can be characterized by the number of the aforementioned curves that intersect at , as is shown in Figure LABEL:fig:localTopology.

By (a), (b), and the fact of being regular open, consists of an even number of disjoint regular open sets. Consider two such sets that share a common boundary. Suppose both of them are subsets of , then it contradicts the fact of being regular. Suppose both of them are subsets of , then it contradicts the fact of their common boundary being a subset of . Hence (c) follows.

The above lemma on the local topology naturally yields a result on the global topology of a connected Yin set.

###### Theorem 3.9

For a connected Yin set , its boundary can be uniquely partitioned into a finite set of pairwise almost disjoint Jordan curves.

Proof. Without loss of generality, we focus on a single connected component of . By Lemma LABEL:lem:localTopologyOfBdPtOfYinSet, a boundary point can be classified into two types according to , the number of curves that intersect at .

If all boundary points satisfy , the condition of being bounded implies that this connected component of must be a single Jordan curve. Hence the statement holds trivially.

Otherwise a finite number of boundary points satisfy . Then we construct a multigraph by setting its vertex set as and by obtaining its edges from dividing with . By Lemma LABEL:lem:localTopologyOfBdPtOfYinSet (a), (b), and being connected, the degree of each vertex in is even. Then it follows from Theorem LABEL:thm:VeblenMultigraph that we can decompose into edge-disjoint cycles. As shown in Figure LABEL:fig:edgePairing, the decomposition is performed by requiring that, at each vertex , two edges incident to are assigned to the same cycle if and only if they belong to the boundary of the same connected component of . Consequently, no edges in different cycles intersect properly at each self-intersection, hence the resulting Jordan curves are pairwise almost disjoint.

Finally, we show that the decomposition in Figure LABEL:fig:edgePairing is the only valide choice. Consider the other possibilities shown in Figure LABEL:fig:edgePairingProof. If the two edges in the same cycle are not adjacent as in Figure LABEL:fig:edgePairingProof (a), then two cycles would have a proper intersection at , which contradicts the condition of the Jordan curves having no proper intersections. As for the last possibility shown in Figure LABEL:fig:edgePairingProof (b), two edges in the same cycle are adjacent but they both belong to the boundary of some connected component of . Then we can draw Jordan curves that contain them. The simpleness of a Jordan curve implies . Then there exist two points that belong to the bounded complements of and , respectively. Because is connected, there exists a path within that connects and . By Theorem LABEL:thm:jordan, this path has to intersect at some point, say . The construction of this path implies ; the construction of implies . This is a contradiction because is open.

The above proof hinges on the fact of a Yin set being open, so Theorem LABEL:thm:uniqueRep may not hold for the closure of a Yin set. As shown in Figure LABEL:fig:boundaryDecompositions, the decomposition of the boundary of a regular closed set is not unique. This is a main reason that we do not model physically meaningful regions with regular closed sets.

To relate to its boundary Jordan curves, we first define a partial order on Jordan curves.

###### Definition 3.10 (Inclusion of Jordan curves)

A Jordan curve is said to include , written as or , if and only if the bounded complement of is a subset of that of . If includes and , we write or .

Definitions LABEL:def:covering and LABEL:def:inclusionRelation yield a covering relation for Jordan curves.

###### Definition 3.11 (Covering of Jordan curves)

Let denote a poset of Jordan curves with inclusion as the partial order. We say covers in and write ‘’ or ‘’ if and no elements satisfies .