Boundaries
The Boundary struct
In what follows we describe how boundaries are implemented in the calculation of Voronoi meshes. Handling boundaries within HighVoronoi
is done using the following struct.
HighVoronoi.Boundary
— TypeBoundary
provides the data structure for boundaries of VoronoiGeometry. Its most important feature is the vector
planes::Vector{Plane}
which stores every flat part of the boundary as
struct Plane
base::Vector{Float64} # base of the plane
normal::Vector{Float64} # outer normal of the domain on this plane
BC::Int16 # 0 for Dirichlet, -1 for Neumann and >0 for the index of the other correspondant in case this is supposed to be periodic
end
Creating Boundaries
Apart from cuboids, Boundary
should always be generated using the following method:
HighVoronoi.Boundary
— MethodBoundary(planes...)
is the constructor for Boundaries. planes... is a list of planes generated by either one of the following functions:
BC_Dirichlet(b,n)
BC_Neumann(b,n)
generating Dirichlet resp. Neumann boundaries with base b
and normal n
.
BC_Periodic(base1,base2,normal1)
generating two periodic boundaries with base1
and normal1
resp. with base2
and normal = -normal1
Rectangular domains
For simplicity of application, the following methods are provided for boundaries of rectangular domains. They return an object of type b::Boundary
with the following structure:
For every $i\in 1,...\mathrm{dim}$
- the plane
b.plane[2*i-1]
has base $\mathrm{offset}[i]+e_i*\mathrm{dimensions}[i]$ and normal $e_i$ - the plane
b.plane[2*i]
has base $\mathrm{offset}[i]$ and normal $-e_i$
HighVoronoi.cuboid
— Methodcuboid(dim;dimensions=ones(Float64,dim),periodic=collect(1:dim),neumann=Int64[],offset=zeros(Float64,dim))
or simply cuboid(dim)
generates a cube of type Boundary
.
- dim : This is the dimension of the cuboid
- dimensions : provides the size of the cuboid in each dimension
- periodic : this is a (sorted!!) list of dimensions in which the cube is assumed to have periodic boundary conditions
- neumann : every dimension k=1...dim which is not periodic my be put here with positive sign for the right hand side or negative sign (i.e. -k) for the left hand side
- offset : shifts the cube in space
A particular application is the following method provided by HighVoronoi.
center_cube(dim,size) = cuboid(dim,dimensions=size*ones(Float64,dim),offset=-0.5*size*ones(Float64,dim))
Relying on cuboid(...)
it generates a cube with center 0
and edge length size
.
Warnings
when using no boundary planes the result "at infinity" i.e. for farout vertex points can be corrupted for high dimensions. This is because virtually every boundary point (a point with infinite cell) becomes neighbor with almost all other boundary points and the verteces reach out to very very very large coordinates compared to the original nodes coordinates. The Library provides internal algorithms to identify and correct misscalculations but this functionallity is, however, limited to the precission of Float64
. We advise to implement a farout boundary (e.g. 1.0E6
) compared to a cube of diameter 1
.