Home

Awesome

Build Status codecov.io

DiscreteDifferentialGeometry

The DiscreteDifferentialGeometry Julia package defines Types and methods to implement Discrete Differential Geometry.

Discrete Exterior Calculus

A concise description of the implemented operators follows. For learning Discrete Exterior Calculus we recommend the course available on-line (http://geometry.cs.cmu.edu/ddg).

The Discrete Exterior Calculus methods and Types supported by this package closely follow CMU's DDG course.

The intention is to extend this package to Discrete Geometric Algebra, any differences from DEC as currently taught in Computer Science will be due to this.

Operators

The ๐‘‘ and โ‹† operators interact with each other and elements of a simplical complex ( i.e. a mesh ) in a way illustrated by the following graph.

  ฮฉแตข : k-form domain of the mesh.  i.e. ฮฉโ‚€ represents verts, ฮฉโ‚ edges, ฮฉโ‚‚ faces
  ฮฉโ‹†แตข : k-form dual domain of the mesh.  i.e. ฮฉโ‹†โ‚‚ represents dual verts, ฮฉโ‚ dual edges, ฮฉโ‚€ dual faces
  โ‹†แตข : hodge star operator
  ๐‘‘แตข : differential operator

  ฮฉโ‚€---๐‘‘โ‚€-โ†’ฮฉโ‚----๐‘‘โ‚-โ†’ฮฉโ‚‚ 
  โ†‘        โ†‘         โ†‘   
โ‹†โ‚€|โ‹†โ‚€โป   โ‹†โ‚|โ‹†โ‚โป    โ‹†โ‚‚|โ‹†โ‚‚โป
  โ†“        โ†“         โ†“     
  ฮฉโ‹†โ‚‚โ†-๐‘‘โ‚--ฮฉโ‹†โ‚โ†-๐‘‘โ‚€---ฮฉโ‹†โ‚€ 

The dual side of this graph are the simplex components of a one ring cell around each vertex of the primal mesh. This cell connects the centres of each face (dual faces) via dual edges. To disambiguate, we use the word cell rather than dual from now on. The ฮฉโ‹†โ‚‚ cell is the circumcentric area around the vertex ฮฉโ‚€. The ฮฉโ‹†โ‚ edges are perpendicular to the primal ฮฉโ‚ edges. The ฮฉโ‹†โ‚€ cell vertices are the centres of a primal ฮฉโ‚‚ face.
The circumcentre is conceptually the correct ฮฉโ‹†โ‚€ centre, although in practice the barycentre may be used instead.

Discrete Differential

The method ๐‘‘ implements the discrete differential operator on discrete k-forms or discrete differential forms.

Also called the exterior derivative.

You can enter this into julia with the character sequence "\itd[Tab]"

In the discrete setting, k-forms and differential forms are typically represented as matrices and vectors. Many of which you will recoginize as incidence matrices or simple column/row vectors corresponding to values at vertices/edges/faces.

Discrete Hodge Star

The method โ‹† implements the discrete hodge star on discrete k-forms or discrete differential forms.

You can enter this into julia with the character sequence "\star[Tab]"

Discrete Codifferential

The method ฮด implements the discrete codifferential.

ฮด = โ‹†๐‘‘โ‹†

You can enter this into julia with the character sequence "\delta[Tab]"

Discrete Laplace Operator

The method ฮ” implements the discrete Laplace-Beltrami operator when applied to a triangle mesh.

You can enter this into julia with the character sequence "\Delta[Tab]"

By far the most important operator in DiscreteDifferentialGeometry.

ฮ” = ฮด๐‘‘ + ๐‘‘ฮด

Examples

Solve a simple poisson problem that doesn't involve boundary conditions. Simple heat diffusion.

julia> using DiscreteDifferentialGeometry, LinearAlgebra

# For triangle mesh topology
julia> using HalfEdges; using HalfEdges: loadmesh

# Load a mesh
julia> topo, P = loadmesh("resource/mesh/bunny.obj")

# Discrete Laplace-Beltrami operator
julia> L = ฮ”(topo, P);

# Time step
julia> dt = 1.0/24.0;

# System matrix for implicit integration step applied to heat diffusion.
julia> A = array(L*dt) + I;

# Set up right hand side with some hot and cold spots 
julia> b = zeros(nvertices(topo)); b[1000:1000:14000] = repeat([100.0,-100.0],7);

# Solve the system for new temperatures.
julia> bโ€ฒ = A\b;

# Step it one more time to get a bit more diffusion
julia> bโ€ฒ = A\bโ€ฒ;

# Display the results
julia> using Makie; mesh(P, reduce(hcat, HalfEdges.facelist(topo))', color = bโ€ฒ)

Project Information

Contributing

Please read CONTRIBUTING.md for details.

Authors

License

This project is licensed under a modified Apache 2.0 license - see the LICENSE file for details