Grid
Types and Constants
VoronoiFVM.TokenStream
— Typemutable struct TokenStream
Tokenstream allows to read tokenized data from file without keeping the file ocntent in memory.
input::IOStream
Input stream
tokens::Array{SubString{String},1}
Array of current tokens kept in memory.
itoken::Int64
Position of actual token in tokens array
lineno::Int64
Line number in IOStream
comment::Char
Comment character
dlm::Function
Function telling if given character is a delimiter.
VoronoiFVM.TokenStream
— MethodTokenStream(input::IOStream; comment, dlm) -> TokenStream
Create Tokenstream with IOStream argument.
VoronoiFVM.TokenStream
— MethodTokenStream(filename::String; comment, dlm) -> TokenStream
Create Tokenstream with file name argument.
VoronoiFVM.Grid
— MethodGrid(#temp#::Type{#s79} where #s79<:IOStream; file, format) -> VoronoiFVM.Grid{Float64,Int32}
Read grid from file.
VoronoiFVM.AbstractGrid
— Typeabstract type AbstractGrid
Abstract type for grid like datastructures VoronoiFVM.Grid
and VoronoiFVM.SubGrid
.
VoronoiFVM.Cartesian1D
— Typestruct Cartesian1D
Type for dispatching formfactor calculations. Intepret 1D coordinates as cartesian.
VoronoiFVM.Cartesian2D
— Typestruct Cartesian2D
Type for dispatching formfactor calculations. Intepret 2D coordinates as cartesian.
VoronoiFVM.Cartesian3D
— Typestruct Cartesian3D
Type for dispatching formfactor calculations. Intepret 3D coordinates as cartesian.
VoronoiFVM.CircularSymmetric1D
— Typestruct CircularSymmetric1D
Type for dispatching formfactor calculations. Intepret 1D coordinates as radial coordinate r assuming circular symmetry around origin 0.
VoronoiFVM.CircularSymmetric2D
— Typestruct CircularSymmetric2D
Type for dispatching formfactor calculations. Intepret 2D coordinates as radial coordinate r and eight coordinate z assuming circular symmetry around axis r=0.
VoronoiFVM.Grid
— Typemutable struct Grid{Tc, Ti} <: VoronoiFVM.AbstractGrid
Structure holding grid data. It is parametrised by the type Tc of coordinates.
coord::Array{Tc,2} where Tc
2D Array of node coordinates
cellnodes::Array{Ti,2} where Ti
2D Array of node indices per grid cell
celledges::Array{Ti,2} where Ti
Array of edge indices per grid cell. Instatiated with prepare_edges!(grid)
edgecells::Array{Ti,2} where Ti
Array of cell indices per grid edge. The number of these indices may be less than the number of columns in this array. Nonexisting indices are set to 0 Instatiated with prepare_edges!(grid)
edgenodes::Array{Ti,2} where Ti
Array of node indices per grid edge. Instatiated with prepare_edges!(grid)
cellregions::Array{Ti,1} where Ti
Array of cell region numbers
bfacenodes::Array{Ti,2} where Ti
2D Array of node indices per boundary face
bfaceregions::Array{Ti,1} where Ti
Array of boundary face region numbers
num_cellregions::Any
Maximum inner cell region number
num_bfaceregions::Any
Maximum boundary region number
local_celledgenodes::Array{Ti,2} where Ti
2D Array describing local scheme of distributions nodes per cell edge.
coord_type::DataType
Type of coordinate system
VoronoiFVM.Grid
— MethodGrid(coord, cellnodes, cellregions, bfacenodes, bfaceregions)
Main constructor for general grid from basic incidence information
VoronoiFVM.SphericalSymmetric1D
— Typestruct SphericalSymmetric1D
Type for dispatching formfactor calculations. Intepret 1D coordinates as radial coordinate r assuming spehrical symmetry around point r=0.
VoronoiFVM.SubGrid
— Typestruct SubGrid{Tc} <: VoronoiFVM.AbstractGrid
Subgrid of parent grid (mainly for visualization purposes). Intended to hold support of species which are not defined everywhere.
parent::VoronoiFVM.Grid
Parent Grid
node_in_parent::Array{Int32,1}
Incidence between subgrid node numbers and node numbers in parent.
coord::Array{Tc,2} where Tc
2D Array of coordinates per grid node
cellnodes::Array{Int32,2}
2D Array of node numbers per grid cell
VoronoiFVM.Grid
— MethodGrid(X)
Constructor for 1D grid.
Construct 1D grid from an array of node cordinates. It creates two boundary regions with index 1 at the left end and index 2 at the right end.
Primal grid holding unknowns: marked by o
, dual grid marking control volumes: marked by |
.
o-----o-----o-----o-----o-----o-----o-----o-----o
|--|-----|-----|-----|-----|-----|-----|-----|--|
VoronoiFVM.Grid
— MethodGrid(X, Y)
Constructor for 2D grid from coordinate arrays. Boundary region numbers count counterclockwise:
location | number |
---|---|
south | 1 |
east | 2 |
north | 3 |
west | 4 |
VoronoiFVM.Grid
— MethodGrid(triangle_switches::String, tio_in::Triangulate.TriangulateIO) -> VoronoiFVM.Grid{Float64,Int32}
Create Grid from Triangle input data.
VoronoiFVM.Grid
— MethodGrid(; flags, points, bfaces, bfaceregions, regionpoints, regionnumbers, regionvolumes) -> VoronoiFVM.Grid{Float64,Int32}
Create Grid from a number of input arrays. The 2D input arrays are transposed if necessary and converted to the proper data types for Triangulate.
This conversion is not performed if the data types are thos indicated in the defaults and the leading dimension of 2D arrays corresponds to the space dimension.
VoronoiFVM.UnexpectedTokenError
— Typestruct UnexpectedTokenError <: Exception
Error thrown when the token expected in expect! is not there.
found::String
expected::String
lineno::Int64
Methods
VoronoiFVM.bfacenode
— Methodbfacenode(grid::VoronoiFVM.Grid, inode::Any, icell::Any) -> Any
Index of boundary face node.
VoronoiFVM.cellnode
— Methodcellnode(grid::VoronoiFVM.Grid, inode::Any, icell::Any) -> Any
Return index of i-th local node in cell icell
VoronoiFVM.dim_space
— Methoddim_space(grid::VoronoiFVM.Grid) -> Int64
Space dimension of grid
VoronoiFVM.nodecoord
— Methodnodecoord(grid::VoronoiFVM.Grid, inode::Any) -> SubArray
Return view of coordinates of node inode
.
VoronoiFVM.num_bfaceregions
— Methodnum_bfaceregions(grid::VoronoiFVM.Grid) -> Any
Maximum boundary face region number
VoronoiFVM.num_bfaces
— Methodnum_bfaces(grid::VoronoiFVM.Grid) -> Int64
Number of boundary faces in grid.
VoronoiFVM.num_cellregions
— Methodnum_cellregions(grid::VoronoiFVM.Grid) -> Any
Maximum cell region number
VoronoiFVM.num_cells
— Methodnum_cells(grid::VoronoiFVM.Grid) -> Int64
Number of cells in grid
VoronoiFVM.num_edges
— Methodnum_edges(grid::VoronoiFVM.Grid) -> Int64
Number of edges in grid
VoronoiFVM.num_nodes
— Methodnum_nodes(grid::VoronoiFVM.Grid) -> Int64
Number of nodes in grid
VoronoiFVM.tridata
— Methodtridata(g::Any) -> Tuple{Any,Any,Any}
Provide information for PyPlot triangulation data for plotting. Needs to be splatted. Use it e.g. like
PyPlot.trisurf(tridata(g)...,U)
VoronoiFVM.cartesian!
— Methodcartesian!(grid)
Set cartesian coordinates for grid.
VoronoiFVM.circular_symmetric!
— Methodcircular_symmetric!(grid)
Set circular coordinates for grid (1D or 2D).
VoronoiFVM.prepare_edges!
— Methodprepare_edges!(grid)
Prepare edge adjacencies (celledges, edgecells, edgenodes)
VoronoiFVM.bfacemask!
— Methodbfacemask!(grid::VoronoiFVM.Grid, maskmin::AbstractArray, maskmax::AbstractArray, ireg::Int64; tol) -> VoronoiFVM.Grid
Edit region numbers of grid boundary facets via rectangular mask. Currently, only for 1D grids, inner boundaries can be added.
VoronoiFVM.cellmask!
— Methodcellmask!(grid::VoronoiFVM.Grid, maskmin::AbstractArray, maskmax::AbstractArray, ireg::Int64; tol) -> Any
Edit region numbers of grid cells via rectangular mask.
VoronoiFVM.cellnode
— Methodcellnode(grid::VoronoiFVM.SubGrid, inode::Any, icell::Any) -> Any
Return index of i-th local node in cell icell
VoronoiFVM.dim_space
— Methoddim_space(grid::VoronoiFVM.SubGrid) -> Int64
Space dimension of grid
VoronoiFVM.nodecoord
— Methodnodecoord(grid::VoronoiFVM.SubGrid, inode::Any) -> SubArray
Return view of coordinates of node inode
.
VoronoiFVM.num_cells
— Methodnum_cells(grid::VoronoiFVM.SubGrid) -> Int64
Number of cells in grid
VoronoiFVM.num_edges
— Methodnum_edges(grid::VoronoiFVM.SubGrid)
Number of edges in grid
VoronoiFVM.num_nodes
— Methodnum_nodes(grid::VoronoiFVM.SubGrid) -> Int64
Number of nodes in grid
VoronoiFVM.subgrid
— Methodsubgrid(parent::VoronoiFVM.Grid, subregions::AbstractArray; transform, boundary) -> VoronoiFVM.SubGrid{_1} where _1
Create subgrid of list of regions.
VoronoiFVM.geomspace
— Methodgeomspace(a, b, ha, hb; tol)
(Try to) create a subdivision of interval (a,b) stored in the returned array X such that
X[1]==a, X[end]==b
(X[2]-X[1])<=ha+tol*(b-a)
(X[end]-X[end-1])<=hb+tol*(b-a)
- There is a number q such that
X[i+1]-X[i] == q*(X[i]-X[i-1])
- X is the array with the minimal possible number of points with the above property
Caveat: the algorithm behind this is well tested but unproven.
Returns an Array containing the points of the subdivision.
VoronoiFVM.glue
— Methodglue(a, b; tol)
Glue together two vectors a and b resulting in a vector c. They last element of a shall be equal (up to tol) to the first element of b. The result fulfills length(c)=length(a)+length(b)-1
VoronoiFVM.expecttoken
— Methodexpecttoken(tks::TokenStream, expected::String) -> Bool
Expect keyword token.
If token is missing, an UnexpectedTokenError is thrown If the token has been found, reading will continue at the position after the token found.
VoronoiFVM.gettoken
— Methodgettoken(tks::TokenStream) -> Union{Nothing, SubString{String}}
Get next token from tokenstream.
VoronoiFVM.trytoken
— Methodtrytoken(tks::TokenStream, expected::String) -> Bool
Try for keyword token.
It token is missing, the token read is put back into stream, a value of false is returned and the next try/gettoken command continues at the same position,
Otherwise, true is returned, and reading continues after the token found.
VoronoiFVM.edgevelocities
— Methodedgevelocities(grid, velofunc)
Project velocity onto grid edges,
VoronoiFVM.bfacefactors!
— Methodbfacefactors!(grid, icell, nodefac)
Calculate node volume contributions for boundary face.
VoronoiFVM.cellfactors!
— Methodcellfactors!(grid, icell, nodefac, edgefac)
Calculate node volume and voronoi surface contributions for cell.
Base.eltype
— Methodeltype(grid::VoronoiFVM.Grid) -> Any
Return element type of grid coordinates.
VoronoiFVM.celledge
— Methodcelledge(grid::VoronoiFVM.Grid, iedge::Any, icell::Any) -> Any
Index of cell edge node.
VoronoiFVM.celledgenode
— Methodcelledgenode(grid::VoronoiFVM.Grid, inode::Any, iedge::Any, icell::Any) -> Any
Index of cell edge node.
VoronoiFVM.dim_grid
— Methoddim_grid(grid::VoronoiFVM.Grid) -> Int64
Topological dimension of grid
VoronoiFVM.map
— Methodmap(f::Function, grid::VoronoiFVM.Grid)
Map a function onto grid coordinates.
VoronoiFVM.num_edges_per_cell
— Methodnum_edges_per_cell(grid::VoronoiFVM.Grid) -> Int64
Number of edges per grid cell.
VoronoiFVM.num_nodes_per_bface
— Methodnum_nodes_per_bface(grid::VoronoiFVM.Grid) -> Int64
Number of nodes per boundary face
VoronoiFVM.num_nodes_per_cell
— Methodnum_nodes_per_cell(grid::VoronoiFVM.Grid) -> Int64
Return number of nodes per cell in grid.
VoronoiFVM.reg_bface
— Methodreg_bface(grid::VoronoiFVM.Grid, icell::Any) -> Any
Boundary region number for boundary face
VoronoiFVM.reg_cell
— Methodreg_cell(grid::VoronoiFVM.Grid, icell::Any) -> Any
Bulk region number for cell
VoronoiFVM.spherical_symmetric!
— Methodspherical_symmetric!(grid)
Set spherical coordinates for grid (1D).
Base.eltype
— Methodeltype(grid::VoronoiFVM.SubGrid) -> Any
Return element type of grid coordinates.
VoronoiFVM.num_nodes_per_cell
— Methodnum_nodes_per_cell(grid::VoronoiFVM.SubGrid) -> Int64
Return number of nodes per cell in grid.
Base.eof
— Methodeof(tks::TokenStream) -> Bool
Check if all tokens have been consumed.
VoronoiFVM.destruct!
— Methoddestruct!(tks::TokenStream)
Tokenstream destructor should close input
VoronoiFVM.tricircumcenter!
— Methodtricircumcenter!(circumcenter, a, b, c)
Find the circumcenter of a triangle.
Created from C source of Jonathan R Shewchuk <jrs@cs.cmu.edu>
Modified to return absolute coordinates.