13.2 s

Finite volumes: transient problems

4.6 μs

Construction of control volumes

  • Start with a triangulation of a polygonal domain (intervals in 1D,triangles in 2D, tetrahedra in 3D).

  • Join triangle circumcenters by lines create Voronoi cells which can serve as control volumes, akin to representative elementary volumes (REV) used to derive conservation laws.

  • Black + green: triangle nodes

  • Gray: triangle edges

  • Blue: triangle circumcenters

  • Red: Boundaries of Voronoi cells

32.6 ms

Condition on triangulation

  • There is a 1:1 incidence between triangulation nodes and Voronoi cells. Moreover, the angle between the interface between two Voronoi cells and the edge between their corresponding nodes is π2.

  • Requires (in 2D) that sums of angles opposite to triangle edges are less than π and that angles opposite to boudary edges are less than π2.

  • "boundary conforming Delaunay property". It has different equivalent definitions and analogues in 3D.

  • Construction:

    • "by hand" (or script) from tensor product meshes

    • Mesh generators: Triangle, TetGen

    • Julia packages: Triangulate.jl, TetGen.jl; SimplexGridFactory.jl

11.7 μs

The discretization approach

  • Use Voronoi cells as REVs aka control volumes aka finite volume cells.

16.5 μs
  • Given a continuity equation j=0 in a domain Ω, integrate this over a contol volume ωk with associated node xk and apply Gauss theorem:

0=ωkj dω=ωkjnds=lNkωkωljnds+ωkΩjndslNkσklhklg(uk,ul)+γkb(uk)

  • Here, Nk is the set of neighbor control volumes, σkl=|ωkωl|, hkl=|xkxl|, γk=|ωkΩ|, where || denotes the measure (length resp. area) of a geometrical entity.

6.5 μs

Flux functions

For instance, for the diffusion flux j=Du, we use g(uk,ul)=D(ukul).

For a convective diffusion flux j=Du+uv, one can chose the upwind flux

g(uk,ul)=D(ukul)+vkl{uk,vkl>0ul,vkl0,

where vkl=hklσklωkωlvnkl ds Fluxes also can depend nonlinearily on u.

5.6 μs

Software API and implementation

ts(u)+j(u)+r(u)=f

The entities describing the discrete system can be subdivided into two categories:

  • geometrical data: |ωk|,γk,σkl,hkl together with the connectivity information of the triangles

  • physical data: the number m and the functions s,g,r,f describing the particular problem, where g is a flux function approximating j.

This structure allows to describe the problem to be solved by data derived from the discretization grid and by the functions describing the physics, giving rise to a software API.

The solution of the nonlinear systems of equations can be performed by Newton's method combined with various direct and iterative linear solvers.

The generic programming capabilities of Julia allow for an implementation of the method which results in an API which consists in the implementation of functions s,g,r,f without the need to write code for their derivatives.

7.8 μs

Examples

General settings

Initial value problem with homgeneous Neumann boundary conditions

Ω=(0,1)d,d=1,2

T=[0,tend]

4.2 μs
fpeak (generic function with 2 methods)
23.7 μs
create_grid (generic function with 1 method)
21.5 μs

Diffusion problem

tuDu=0inΩ

Dun=0onΩ

u|t=0=u0

2.9 μs
diffusion (generic function with 1 method)
87.4 μs
10.2 s
TransientSolution{Float64, 3, Vector{Matrix{Float64}}, Vector{Float64}}
62.0 ns
7.9 μs

Time step number:1

25.8 ms
820 ms
790 ms

Reaction-diffusion problem

Diffusion + physical process which "eats" species

tuDu+Ru=0inΩ

Dun=0onΩ

u|t=0=u0

8.0 μs
reaction_diffusion (generic function with 1 method)
118 μs
1.3 s

Time step number:1

46.9 μs
106 ms
4.3 ms

Convection-Diffusion problem

tu(Duuv)=0inΩ

(Duuv)n=0onΩ

u|t=0=u0

4.7 μs
convection_diffusion (generic function with 1 method)
161 μs

scheme:

116 ms
2.1 s

Time step number:1

45.3 μs
37.8 ms
4.2 ms

Brusselator system

Two species interacting via a reaction:

tu1(D1u1)+(B+1)u1Au12u2=0tu2(D2u2)+u12u2Bu1=0

4.5 μs
brusselator (generic function with 1 method)
128 μs
4.3 s

Time step number:365

45.7 μs
77.5 ms
50.8 ms
69.0 ns
      Status `/tmp/jl_1ZzYoO/Project.toml`
  [cfc395e8] ExtendableGrids v0.7.4
  [5eed8a63] GridVisualize v0.1.5
  [7f904dfe] PlutoUI v0.7.4
  [d330b81b] PyPlot v2.9.0
  [295af30f] Revise v3.1.14
  [82b139dc] VoronoiFVM v0.10.9
663 ms