System

Types and Constants

VoronoiFVM.DenseSystemType
mutable struct DenseSystem{Tv, Ti} <: VoronoiFVM.AbstractSystem{Tv,Ti}

Structure holding data for finite volume system solution. Information on species distribution is kept in dense matrices, and the solution array is of type Array{2}.

Unlike in the SparseSystem, the system matrix handles exactly those degrees of freedom which correspond to unknowns, and dummy degrees of freedom where unknowns are not defined. Handling of the sparse matrix structures for the bookeeping of the unknowns has less overhead, but additional dummy equations are added to the system matrix.

  • grid::VoronoiFVM.Grid

    Grid{Tv,Ti}

  • physics::VoronoiFVM.Physics

    Physics data

  • boundary_values::Array{Tv,2} where Tv

    Array of boundary values

  • boundary_factors::Array{Tv,2} where Tv

    Array of boundary factors

  • region_species::Array{Int8,2}

    Full matrix containing species numbers for inner regions

  • bregion_species::Array{Int8,2}

    Full matrix containing species numbers for boundary regions

  • node_dof::Array{Int8,2}

    Full matrix containing degree of freedom numbers for each node

  • matrix::ExtendableSparse.ExtendableSparseMatrix{Tv,Ti} where Ti where Tv

    Jacobi matrix for nonlinear problem

  • species_homogeneous::Bool

    Flag which says if the number of unknowns per node is constant

  • update::Array{Tv,2} where Tv

    Solution vector holding Newton update

  • residual::Array{Tv,2} where Tv

    Solution vector holding Newton residual

source
VoronoiFVM.DenseSystemMethod
DenseSystem(grid::VoronoiFVM.Grid, physics::VoronoiFVM.Physics) -> VoronoiFVM.DenseSystem{_1,_2} where _2 where _1

Constructor for DenseSystem.

source
VoronoiFVM.SparseSolutionArrayType
struct SparseSolutionArray{Tv, Ti} <: AbstractArray{Tv,2}

Struct holding solution information for SparseSystem. Solution is stored in a sparse matrix structure.

This class plays well with the abstract array interface.

  • node_dof::SparseArrays.SparseMatrixCSC{Tv,Ti} where Ti where Tv

    Sparse matrix holding actual data.

source
VoronoiFVM.SparseSystemType
mutable struct SparseSystem{Tv, Ti} <: VoronoiFVM.AbstractSystem{Tv,Ti}

Structure holding data for finite volume system solution. Information on species distribution is kept in sparse matrices, and the solution array is of type SparseSolutionArray, i.e. effectively it is a sparse matrix.

Unlike in the DenseSystem, the system matrix handles exactly those degrees of freedom which correspond to unknowns. However, handling of the sparse matrix structures for the bookkeeping of the unknowns creates overhead.

  • grid::VoronoiFVM.Grid{Tv,Ti} where Ti where Tv

    Grid

  • physics::VoronoiFVM.Physics

    Physics data

  • boundary_values::Array{Tv,2} where Tv

    Array of boundary values

  • boundary_factors::Array{Tv,2} where Tv

    Array of boundary factors

  • region_species::SparseArrays.SparseMatrixCSC{Int8,Ti} where Ti

    Sparse matrix containing species numbers for inner regions

  • bregion_species::SparseArrays.SparseMatrixCSC{Int8,Ti} where Ti

    Sparse matrix containing species numbers for boundary regions

  • node_dof::SparseArrays.SparseMatrixCSC{Int8,Ti} where Ti

    Sparse matrix containing degree of freedom numbers for each node

  • matrix::ExtendableSparse.ExtendableSparseMatrix{Tv,Ti} where Ti where Tv

    Jacobi matrix for nonlinear problem

  • species_homogeneous::Bool

    Flag which says if the number of unknowns per node is constant

  • update::VoronoiFVM.SparseSolutionArray

    Solution vector holding Newton update

  • residual::VoronoiFVM.SparseSolutionArray

    Solution vector holding Newton residual

source
VoronoiFVM.SubgridArrayViewType
struct SubgridArrayView{Tv, Ta} <: AbstractArray{Tv,2}

Struct holding information for solution array view on subgrid

  • sysarray::Any

    Original array

  • subgrid::VoronoiFVM.SubGrid

    Subgrid for view

source
VoronoiFVM.BNodeType
mutable struct BNode{Tv, Ti} <: VoronoiFVM.AbstractGeometryItem{Tv,Ti}

Structure holding local boundary node information.

  • index::Any

    Index in grid

  • region::Any

    Boundary region number

  • nspec::Any

    Number of species defined in node

  • grid::VoronoiFVM.Grid{Tv,Ti} where Ti where Tv

    Grid

source
VoronoiFVM.EdgeType
mutable struct Edge{Tv, Ti} <: VoronoiFVM.AbstractGeometryItem{Tv,Ti}

Structure holding local edge information.

  • index::Any

    Index in grid

  • node::Array{Ti,1} where Ti

    Index

  • region::Any

    Inner region number corresponding to edge

  • nspec::Any

    Number of species defined in edge

  • icell::Any

    Number of discretization cell the edge is invoked from

  • grid::VoronoiFVM.Grid{Tv,Ti} where Ti where Tv

    Grid

source
VoronoiFVM.NodeType
mutable struct Node{Tv, Ti} <: VoronoiFVM.AbstractGeometryItem{Tv,Ti}

Structure holding local node information.

  • index::Any

    Index in grid

  • region::Any

    Inner region number

  • nspec::Any

    Number of species defined in node

  • icell::Any

    Number of discretization cell the node is invoked from

  • grid::VoronoiFVM.Grid{Tv,Ti} where Ti where Tv

    Grid

source
VoronoiFVM.NewtonControlType
mutable struct NewtonControl

Control parameter structure for Newton method.

  • tol_absolute::Float64

    Tolerance (in terms of norm of Newton update)

  • tol_relative::Float64

    Tolerance (relative to the first residual)

  • tol_round::Float64

    Tolerance for roundoff error detection

  • damp_initial::Float64

    Initial damping parameter

  • damp_growth::Float64

    Damping parameter growth factor

  • max_iterations::Int32

    Maximum number of iterations

  • max_lureuse::Int32

    Maximum number of reuses of lu factorization

  • max_round::Int32

    Maximum number of consecutive iterations within roundoff error tolerance

  • tol_linear::Float64

    Tolerance of iterative linear solver

  • verbose::Bool

    Verbosity flag

  • handle_exceptions::Bool

    Handle exceptions

  • Δp::Float64

    Parameter step for embedding

  • Δp_max::Float64

    Maximal parameter step

  • Δp_min::Float64

    Minimal parameter step

  • edge_cutoff::Float64

    Edge cutoff for rectangular triangles

source
VoronoiFVM.TestFunctionFactoryType
mutable struct TestFunctionFactory{Tv}

Data structure containing DenseSystem used to calculate test functions for boundary flux calculations.

  • system::VoronoiFVM.AbstractSystem{Tv,Ti} where Ti<:Integer where Tv

    Original system

  • tfsystem::VoronoiFVM.DenseSystem

    Test function system

source

Methods

VoronoiFVM.boundary_dirichlet!Method
boundary_dirichlet!(this::VoronoiFVM.AbstractSystem, ispec::Integer, ibc::Integer, val::Any) -> Any

Set Dirichlet boundary conditon for species ispec at boundary ibc.

source
VoronoiFVM.boundary_neumann!Method
boundary_neumann!(this::VoronoiFVM.AbstractSystem, ispec::Integer, ibc::Integer, val::Any) -> Any

Set Neumann boundary conditon for species ispec at boundary ibc.

source
VoronoiFVM.boundary_robin!Method
boundary_robin!(this::VoronoiFVM.AbstractSystem, ispec::Integer, ibc::Integer, fac::Any, val::Any) -> Any

Set Robin boundary conditon for species ispec at boundary ibc.

source
VoronoiFVM.enable_boundary_species!Method
enable_boundary_species!(this::VoronoiFVM.AbstractSystem, ispec::Integer, bregions::AbstractArray{T,1} where T)

Add species to a list of boundary regions. Species numbers for bulk and boundary species have to be distinct.

source
VoronoiFVM.enable_species!Method
enable_species!(this::VoronoiFVM.AbstractSystem, ispec::Integer, regions::AbstractArray{T,1} where T)

Add species to a list of bulk regions. Species numbers for bulk and boundary species have to be distinct.

source
VoronoiFVM.num_nodesMethod
num_nodes(a::AbstractArray) -> Any

Number of nodes (size of second dimension) of solution array.

source
VoronoiFVM.num_dofMethod
num_dof(this::VoronoiFVM.DenseSystem) -> Int64

Number of degrees of freedom for system.

source
VoronoiFVM.unknownsMethod

Create a solution vector for dense system. If inival is not specified, the entries of the returned vector are undefined.

source
VoronoiFVM.unknownsMethod
unknowns(Tu::Tv, sys::Tv; inival) -> Any

Create a solution vector for dense system. If inival is not specified, the entries of the returned vector are undefined.

source
VoronoiFVM.dofMethod
dof(a, i, j)

Get number of degree of freedom. Return 0 if species is not defined in node.

source
VoronoiFVM.getdofMethod
getdof(a::VoronoiFVM.SparseSolutionArray, i::Integer) -> Any

Return value for degree of freedom.

source
VoronoiFVM.num_dofMethod
num_dof(this::VoronoiFVM.SparseSystem) -> Any

Number of degrees of freedom for system.

source
VoronoiFVM.setdof!Method
setdof!(a::VoronoiFVM.SparseSolutionArray, v::Any, i::Integer) -> Any

Set value for degree of freedom.

source
VoronoiFVM.unknownsMethod

Create a solution vector for sparse system. The entries of the returned vector are undefined.

source
VoronoiFVM.unknownsMethod
unknowns(Tu, sys; inival)

Create a solution vector for sparse system with given type. If inival is not specified, the entries of the returned vector are undefined.

source
VoronoiFVM.viewKMethod
viewK(edge::VoronoiFVM.Edge, u::AbstractArray) -> Any

Solution view on first edge node

source
VoronoiFVM.viewLMethod
viewL(edge::VoronoiFVM.Edge, u::AbstractArray) -> Any

Solution view on second edge node

source
VoronoiFVM.embed!Method
embed!(solution::Tv, xinival::Tv, this::Tv; control, pre, post)

Solution method for instance of abstract system.

Perform solution via parameter embedding, calling solve! for each value of the parameter p from interval (0,1). The user is responsible for the interpretation of the parameter. The optional pre() callback can be used to communicate its value to the system. The optionalpost() callback method can be used to perform various postprocessing steps.

If control.handle_error is true, solve! throws an error, and stepsize control.Δp is lowered, and solve! is called again with a smaller parameter value. If control.Δp<control.Δp_min, embed! is aborted with error.

source
VoronoiFVM.integrateMethod
integrate(this, F, U)

Integrate function F of solution vector over domain. The result contains the integral for each species separately.

source
VoronoiFVM.solve!Method

Solution method for instance of abstract system.

Perform solution of stationary system (if tstep==Inf) or one tine step of implicit Euler time step system using Newton's method with damping. Initial damping is chosen according control.damp_initial.

source
VoronoiFVM.valueFunction

Extract value from dual number. Use to debug physics callbacks. Re-exported from ForwardDiff.jl

source
VoronoiFVM.testfunctionMethod
testfunction(factory::Tv, bc0::Tv, bc1::Tv)

Create testfunction which has Dirichlet zero boundary conditions for boundary regions in bc0 and Dirichlet one boundary conditions for boundary regions in bc1.

source
VoronoiFVM.SystemMethod
System(grid::VoronoiFVM.Grid, physics::VoronoiFVM.Physics; unknown_storage) -> Union{DenseSystem{_1,_2} where _2 where _1, SparseSystem{_1,_2} where _2 where _1}

Create Finite Volume System.

  • grid: 1D/2D/3D discretization grid
  • physics: Physics struct containing node and edge callbacks
  • unknown_storage: string or symbol:
    • :dense : solution vector is an nspecies x nnodes dense matrix
    • :sparse : solution vector is an nspecies x nnodes sparse matrix
source
VoronoiFVM.is_boundary_speciesMethod
is_boundary_species(this::VoronoiFVM.AbstractSystem, ispec::Integer) -> Bool

Check if species number corresponds to boundary species.

source
VoronoiFVM.is_bulk_speciesMethod
is_bulk_species(this::VoronoiFVM.AbstractSystem, ispec::Integer) -> Bool

Check if species number corresponds bulk species.

source
VoronoiFVM.isdofMethod
isdof(this::VoronoiFVM.AbstractSystem, ispec::Any, inode::Any) -> Bool

Check if degree of freedom is defined.

source
Base.getindexMethod
getindex(a::VoronoiFVM.SparseSolutionArray, ispec::Integer, inode::Integer) -> Any

Accessor for solution array.

source
Base.setindex!Method
setindex!(a::VoronoiFVM.SparseSolutionArray, v::Any, ispec::Integer, inode::Integer) -> Union{Nothing, SparseSolutionArray}

Accessor for solution array.

source
Base.sizeMethod
size(a::VoronoiFVM.SparseSolutionArray) -> Tuple{Int64,Int64}

Return size of solution array.

source
VoronoiFVM.valuesMethod
values(a::VoronoiFVM.SparseSolutionArray) -> Array{Tv,1} where Tv

Array of values in solution array.

source
Base.getindexMethod
getindex(aview::VoronoiFVM.SubgridArrayView, ispec::Integer, inode::Integer) -> Any

Accessor method for subgrid array view.

source
Base.setindex!Method
setindex!(aview::VoronoiFVM.SubgridArrayView, v::Any, ispec::Integer, inode::Integer) -> VoronoiFVM.SubgridArrayView

Accessor method for subgrid array view.

source
Base.sizeMethod
size(a::VoronoiFVM.SubgridArrayView) -> Tuple{Any,Int64}

Return size of solution array view.

source
Base.viewMethod
view(a::Tv, sg::Tv) -> SubArray

Create a view of the solution array on a subgrid.

source
VoronoiFVM.eval_and_assembleMethod
eval_and_assemble(system, U, UOld, F, tstep; edge_cutoff)

Main assembly method.

Evaluate solution with result in right hand side F and assemble matrix into system.matrix.

source