Skip to content

fatimp/diff-boundary-corrfn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

diff-boundary-corrfn

CI tests

This library provides a function which calculates surface-surface (resp. surface-surface-surface) correlation functions (see Salvatore Torquato's book "Random heterogeneous materials") for a two- (resp. three-)dimensional sets with differentiable (almost everywhere) boundary. A set is defined as points which satisfy an inequation f(X) > T where X is a two- or three-dimensional vector. The function f must be defined using cl-forward-diff package and have cl-forward-diff:differentiable-multivariate type. Let's look at this example:

(defpackage math-function
  (:use #:cl)
  (:local-nicknames (:diff :cl-forward-diff))
  #.(cl-forward-diff:shadowing-import-math)
  (:export #:f))
(in-package :math-function)

(declaim (ftype diff:differentiable-multivariate f))
(defun f (coord)
  (declare (optimize (speed 3)))
  (let ((x (aref coord 0))
        (y (aref coord 1)))
    (max (abs x)
         (abs y))))

An inequation (> (FUNCALL F COORD) 2d-1) defines a set ℝ \ [-0.2, 0.2]^2 with a boundary which is differentiable almost everywhere. Now evaluation of

(diff-boundary-corrfn:surface2
 (diff-boundary-corrfn:interface
  #'math-function:f
  2            ;; Number of dimensions
  2d-1)        ;; Parameter T
 (cl-forward-diff:to-doubles '(1d-1 1d-1))) ;; Calculate F_{ss}(0.1, 0.1)

gives 2d0. This can be understood as that two boundaries of a square which lie close to each other have two points of intersection and have an angle of intersection equal to π/2:

|-------|
|  |----|--|
|  |    |  |
|  |    |  |
|--|----|  |
   |-------|

Caveats

Currently all points of intersection must lie in a cube [-1, 1]^{ndims}.

About

Computation of surface-surface function for two-dimensional sets with differentiable boundary

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published