Peano
Loading...
Searching...
No Matches
exaparty.api.sphtools.sph_kernels Namespace Reference

SPH Kernel related constants, coefficients, and functions. More...

Data Structures

class  _forbidInvalidKernelsDict
 Modify the default dict to raise an error if a user tries to access kernels which aren't defined. More...
 

Functions

 _sph_kernel_eval_cubic_spline (float q)
 Evaluates the cubic spline kernel.
 
 _sph_kernel_eval_quartic_spline (float q)
 Evaluates the quartic spline kernel.
 
 _sph_kernel_eval_quartic_spline_vectorized (np.ndarray q)
 Evaluates the quartic spline kernel.
 
 _sph_kernel_eval_quintic_spline (float q)
 Evaluates the quintic spline kernel.
 
 _sph_kernel_eval_quintic_spline_vectorized (np.ndarray q)
 Evaluates the quintic spline kernel.
 
 _sph_kernel_eval_wendland_C2 (float q)
 Evaluates the Wendland C2 kernel.
 
 _sph_kernel_eval_wendland_C4 (float q)
 Evaluates the Wendland C4 kernel.
 
 _sph_kernel_eval_wendland_C6 (float q)
 Evaluates the Wendland C6 kernel.
 
 _sph_kernel_deval_cubic_spline (float q)
 Evaluates the cubic spline kernel derivative.
 
 _sph_kernel_deval_quartic_spline (float q)
 Evaluates the quartic spline kernel derivative.
 
 _sph_kernel_deval_quartic_spline_vectorized (np.ndarray q)
 Evaluates the quartic spline kernel derivative.
 
 _sph_kernel_deval_quintic_spline (float q)
 Evaluates the quintic spline kernel derivative.
 
 _sph_kernel_deval_wendland_C2 (float q)
 Evaluates the Wendland C2 kernel derivative.
 
 _sph_kernel_deval_wendland_C4 (float q)
 Evaluates the Wendland C4 kernel derivative.
 
 _sph_kernel_deval_wendland_C6 (float q)
 Evaluates the Wendland C6 kernel derivative.
 
 sph_kernel_W (Union[float, np.ndarray] r, Union[float, np.ndarray] h, str kernel, int ndim)
 Evaluates various kernels.
 
 sph_kernel_dWdr (Union[float, np.ndarray] r, Union[float, np.ndarray] h, str kernel, int ndim)
 Evaluates kernel derivatives for various kernels: returns dW/dr = dW/dq dq/dr = 1/H * dW/dq.
 
 sph_kernel_get_interaction_radius (Union[float, np.ndarray] h, str kernel, int ndim)
 Computes the interaction radius (compact support radius) for a given smoothing length h, SPH kernel kernel, and kernel dimension ndim.
 
 sph_kernel_get_H (Union[float, np.ndarray] h, str kernel, int ndim)
 Compute the compact support radius of a given kernel and given smoothing length.
 
 sph_kernel_get_smoothing_length_from_interaction_radius (Union[float, np.ndarray] H, str kernel, int ndim)
 Compute the smoothing length given the compact support length of a given kernel.
 
 sph_kernel_root (str kernel, int ndim)
 Evaluate kernel root, i.e.
 

Variables

list sph_kernel_list
 
list sph_vectorized_kernel_list
 
 sph_kernel_macro_name = _forbidInvalidKernelsDict()
 
list sph_kernel_H_over_h
 
list sph_kernel_normalization
 
 sph_kernel_eval_function = _forbidInvalidKernelsDict()
 
 sph_kernel_deval_function = _forbidInvalidKernelsDict()
 

Detailed Description

SPH Kernel related constants, coefficients, and functions.

All constants and kernel coefficients are taken from table 1 of Dehnen & Aly, MNRAS, 425, pp. 1062-1082 (2012).

Function Documentation

◆ _sph_kernel_deval_cubic_spline()

exaparty.api.sphtools.sph_kernels._sph_kernel_deval_cubic_spline ( float  q)
protected

Evaluates the cubic spline kernel derivative.

Definition at line 342 of file sph_kernels.py.

◆ _sph_kernel_deval_quartic_spline()

exaparty.api.sphtools.sph_kernels._sph_kernel_deval_quartic_spline ( float  q)
protected

Evaluates the quartic spline kernel derivative.

Definition at line 356 of file sph_kernels.py.

◆ _sph_kernel_deval_quartic_spline_vectorized()

exaparty.api.sphtools.sph_kernels._sph_kernel_deval_quartic_spline_vectorized ( np.ndarray  q)
protected

Evaluates the quartic spline kernel derivative.

Definition at line 371 of file sph_kernels.py.

◆ _sph_kernel_deval_quintic_spline()

exaparty.api.sphtools.sph_kernels._sph_kernel_deval_quintic_spline ( float  q)
protected

Evaluates the quintic spline kernel derivative.

Definition at line 396 of file sph_kernels.py.

◆ _sph_kernel_deval_wendland_C2()

exaparty.api.sphtools.sph_kernels._sph_kernel_deval_wendland_C2 ( float  q)
protected

Evaluates the Wendland C2 kernel derivative.

Definition at line 417 of file sph_kernels.py.

◆ _sph_kernel_deval_wendland_C4()

exaparty.api.sphtools.sph_kernels._sph_kernel_deval_wendland_C4 ( float  q)
protected

Evaluates the Wendland C4 kernel derivative.

Definition at line 428 of file sph_kernels.py.

◆ _sph_kernel_deval_wendland_C6()

exaparty.api.sphtools.sph_kernels._sph_kernel_deval_wendland_C6 ( float  q)
protected

Evaluates the Wendland C6 kernel derivative.

Definition at line 446 of file sph_kernels.py.

◆ _sph_kernel_eval_cubic_spline()

exaparty.api.sphtools.sph_kernels._sph_kernel_eval_cubic_spline ( float  q)
protected

Evaluates the cubic spline kernel.

Definition at line 169 of file sph_kernels.py.

◆ _sph_kernel_eval_quartic_spline()

exaparty.api.sphtools.sph_kernels._sph_kernel_eval_quartic_spline ( float  q)
protected

Evaluates the quartic spline kernel.

Definition at line 183 of file sph_kernels.py.

◆ _sph_kernel_eval_quartic_spline_vectorized()

exaparty.api.sphtools.sph_kernels._sph_kernel_eval_quartic_spline_vectorized ( np.ndarray  q)
protected

Evaluates the quartic spline kernel.

Definition at line 198 of file sph_kernels.py.

◆ _sph_kernel_eval_quintic_spline()

exaparty.api.sphtools.sph_kernels._sph_kernel_eval_quintic_spline ( float  q)
protected

Evaluates the quintic spline kernel.

Definition at line 225 of file sph_kernels.py.

◆ _sph_kernel_eval_quintic_spline_vectorized()

exaparty.api.sphtools.sph_kernels._sph_kernel_eval_quintic_spline_vectorized ( np.ndarray  q)
protected

Evaluates the quintic spline kernel.

Definition at line 251 of file sph_kernels.py.

◆ _sph_kernel_eval_wendland_C2()

exaparty.api.sphtools.sph_kernels._sph_kernel_eval_wendland_C2 ( float  q)
protected

Evaluates the Wendland C2 kernel.

Definition at line 287 of file sph_kernels.py.

◆ _sph_kernel_eval_wendland_C4()

exaparty.api.sphtools.sph_kernels._sph_kernel_eval_wendland_C4 ( float  q)
protected

Evaluates the Wendland C4 kernel.

Definition at line 299 of file sph_kernels.py.

◆ _sph_kernel_eval_wendland_C6()

exaparty.api.sphtools.sph_kernels._sph_kernel_eval_wendland_C6 ( float  q)
protected

Evaluates the Wendland C6 kernel.

Definition at line 321 of file sph_kernels.py.

◆ sph_kernel_dWdr()

exaparty.api.sphtools.sph_kernels.sph_kernel_dWdr ( Union[float, np.ndarray]  r,
Union[float, np.ndarray]  h,
str  kernel,
int   ndim 
)

Evaluates kernel derivatives for various kernels: returns dW/dr = dW/dq dq/dr = 1/H * dW/dq.

The kernels are scaled such that W(q > 1) = 0. Currently implemented: cubic_spline, quartic_spline, quintic_spline, wendland_C2, wendland_C4, [not with ndim=1] wendland_C6, [not with ndim=1]

Parameters

r: float or ndarray particle distance(s)

h: float or ndarray smoothing length(s)

kernel: str which kernel to use

ndim: int what dimension to use. [1-3]

Returns

dWdr: float or ndarray evaluated kernel derivative

Definition at line 535 of file sph_kernels.py.

◆ sph_kernel_get_H()

exaparty.api.sphtools.sph_kernels.sph_kernel_get_H ( Union[float, np.ndarray]  h,
str  kernel,
int  ndim 
)

Compute the compact support radius of a given kernel and given smoothing length.

The kernels defined above are defined and scaled to support a region <= H.

Parameters

h: float or np.ndarray smoothing length

kernel: str which kernel to use.

ndim: int how many dimensions we're working with

Returns

H: float or np.dnarray compact support radii.

Definition at line 594 of file sph_kernels.py.

◆ sph_kernel_get_interaction_radius()

exaparty.api.sphtools.sph_kernels.sph_kernel_get_interaction_radius ( Union[float, np.ndarray]  h,
str  kernel,
int   ndim 
)

Computes the interaction radius (compact support radius) for a given smoothing length h, SPH kernel kernel, and kernel dimension ndim.

Definition at line 584 of file sph_kernels.py.

◆ sph_kernel_get_smoothing_length_from_interaction_radius()

exaparty.api.sphtools.sph_kernels.sph_kernel_get_smoothing_length_from_interaction_radius ( Union[float, np.ndarray]  H,
str  kernel,
int   ndim 
)

Compute the smoothing length given the compact support length of a given kernel.

The kernels defined above are defined and scaled to support a region <= H.

Parameters

H: float or np.ndarray compact support radii.

kernel: str which kernel to use.

ndim: int how many dimensions we're working with

Returns

h: float or np.dnarray smoothing lengt(s)

Definition at line 623 of file sph_kernels.py.

◆ sph_kernel_root()

exaparty.api.sphtools.sph_kernels.sph_kernel_root ( str  kernel,
int  ndim 
)

Evaluate kernel root, i.e.

W(0, h). We don't actually need h here, because the quantity used in the kernels, q = r/h is also zero by construction.

Parameters

kernel: str which kernel to use

ndim: int what dimension to use. [1-3]

Returns

W: float evaluated kernel

Definition at line 655 of file sph_kernels.py.

◆ sph_kernel_W()

exaparty.api.sphtools.sph_kernels.sph_kernel_W ( Union[float, np.ndarray]  r,
Union[float, np.ndarray]  h,
str  kernel,
int   ndim 
)

Evaluates various kernels.

The kernels are scaled such that W(q > 1) = 0. Currently implemented: cubic_spline, quartic_spline, quintic_spline, wendland_C2, wendland_C4, [not with ndim=1] wendland_C6, [not with ndim=1]

Parameters

r: float or ndarray particle distance(s)

h: float or ndarray smoothing length(s)

kernel: str which kernel to use

ndim: int what dimension to use. [1-3]

Returns

W: float evaluated kernel

Definition at line 487 of file sph_kernels.py.

Variable Documentation

◆ sph_kernel_deval_function

exaparty.api.sphtools.sph_kernels.sph_kernel_deval_function = _forbidInvalidKernelsDict()

Definition at line 84 of file sph_kernels.py.

◆ sph_kernel_eval_function

exaparty.api.sphtools.sph_kernels.sph_kernel_eval_function = _forbidInvalidKernelsDict()

Definition at line 81 of file sph_kernels.py.

◆ sph_kernel_H_over_h

list exaparty.api.sphtools.sph_kernels.sph_kernel_H_over_h
Initial value:
1= [
2 _forbidInvalidKernelsDict(blocked_keys=("wendland_C4", "wendland_C6"), ndim=1),
3 _forbidInvalidKernelsDict(ndim=2),
4 _forbidInvalidKernelsDict(ndim=3),
5]

Definition at line 66 of file sph_kernels.py.

◆ sph_kernel_list

list exaparty.api.sphtools.sph_kernels.sph_kernel_list
Initial value:
1= [
2 "cubic_spline",
3 "quartic_spline",
4 "quintic_spline",
5 "wendland_C2",
6 "wendland_C4",
7 "wendland_C6",
8]

Definition at line 15 of file sph_kernels.py.

◆ sph_kernel_macro_name

exaparty.api.sphtools.sph_kernels.sph_kernel_macro_name = _forbidInvalidKernelsDict()

Definition at line 63 of file sph_kernels.py.

◆ sph_kernel_normalization

list exaparty.api.sphtools.sph_kernels.sph_kernel_normalization
Initial value:
1= [
2 _forbidInvalidKernelsDict(blocked_keys=("wendland_C4", "wendland_C6"), ndim=1),
3 _forbidInvalidKernelsDict(ndim=2),
4 _forbidInvalidKernelsDict(ndim=3),
5]

Definition at line 74 of file sph_kernels.py.

◆ sph_vectorized_kernel_list

list exaparty.api.sphtools.sph_kernels.sph_vectorized_kernel_list
Initial value:
1= [
2 "quartic_spline_vectorized",
3]

Definition at line 24 of file sph_kernels.py.