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

Tools related to the (computation of) the smoothing length. More...

Functions

 _neighbour_loop_vectorized (ndarray r, float h, str kernel, int ndim)
 A neighbour interaction loop used to determine the smoothing lengths.
 
 _neighbour_loop (ndarray r, float h, str kernel, int ndim)
 A neighbour interaction loop used to determine the smoothing lengths.
 
 find_smoothing_length (ndarray xp, ndarray xn, str kernel, float eta, float h_tolerance, int ndim, bool verbose=False)
 Determine the smoothing length of a particle with coordinates xp and neighbours with positions xn.
 
 eta_from_number_of_neighbours (float N, str kernel, int ndim)
 Compute the resolution eta from a given (approximate) number of neighbours.
 
 number_of_neighbours_from_eta (float eta, str kernel, int ndim)
 Compute the (approximate) number of neighbours from a given resolution eta.
 

Detailed Description

Tools related to the (computation of) the smoothing length.

Function Documentation

◆ _neighbour_loop()

exaparty.api.sphtools.smltools._neighbour_loop ( ndarray  r,
float  h,
str  kernel,
int  ndim 
)
protected

A neighbour interaction loop used to determine the smoothing lengths.

Parameters

r: ndarray distances from the particle to the neighbours

h: float current guess for the particle's smoothing length

kernel: str which SPH kernel to use.

ndim: int number of dimensions to work for.

Returns

wcount: float sum of particle's kernel weight at neighbour positions

wcount_dh: float sum of particle's kernel derivative weight at neighbour positions

Definition at line 64 of file smltools.py.

◆ _neighbour_loop_vectorized()

exaparty.api.sphtools.smltools._neighbour_loop_vectorized ( ndarray  r,
float  h,
str  kernel,
int  ndim 
)
protected

A neighbour interaction loop used to determine the smoothing lengths.

Parameters

r: ndarray distances from the particle to the neighbours

h: float current guess for the particle's smoothing length

kernel: str which SPH kernel to use.

ndim: int number of dimensions to work for.

Returns

wcount: float sum of particle's kernel weight at neighbour positions

wcount_dh: float sum of particle's kernel derivative weight at neighbour positions

Definition at line 15 of file smltools.py.

Referenced by exaparty.api.sphtools.smltools.find_smoothing_length().

Here is the caller graph for this function:

◆ eta_from_number_of_neighbours()

exaparty.api.sphtools.smltools.eta_from_number_of_neighbours ( float  N,
str  kernel,
int  ndim 
)

Compute the resolution eta from a given (approximate) number of neighbours.

Note that the neighbour number does not need be an integer. See Price 2012, https://ui.adsabs.harvard.edu/abs/2012JCoPh.231..759P, eq. 12

Parameters

N: float Number of neighbours

kernel: str which kernel we're computing for.

ndim: int how many dimensions we are working with.

Returns

eta: float the corresponding resolution eta

Definition at line 315 of file smltools.py.

◆ find_smoothing_length()

exaparty.api.sphtools.smltools.find_smoothing_length ( ndarray  xp,
ndarray  xn,
str  kernel,
float  eta,
float  h_tolerance,
int  ndim,
bool   verbose = False 
)

Determine the smoothing length of a particle with coordinates xp and neighbours with positions xn.

This function assumes that the an appropriate amount of neighbours is passed on via the xn array of their positions, meaning that max{|xn - xp|} <= gamma * h.

Parameters

xp: ndarray Coordiate of particle to determine smoothing length for

xn: ndarray Array of coordinates of neighbour particles

kernel: str Which kernel to use. Choices are given in sph_kernels.py:sph_kernel_list

eta: float resolution eta to use, "smoothing scale". This determines the number of neighbours.

h_tolerance: float tolerance to adapt to consider smoothing length converged

ndim: int number of dimensions to work with

verbose: bool whether to be verbose about what's going on

Returns

h: float the smoothing length

Definition at line 115 of file smltools.py.

References exaparty.api.sphtools.smltools._neighbour_loop_vectorized().

Here is the call graph for this function:

◆ number_of_neighbours_from_eta()

exaparty.api.sphtools.smltools.number_of_neighbours_from_eta ( float  eta,
str  kernel,
int  ndim 
)

Compute the (approximate) number of neighbours from a given resolution eta.

Note that the neighbour number does not need be an integer. See Price 2012, https://ui.adsabs.harvard.edu/abs/2012JCoPh.231..759P, eq. 12

Parameters

eta: float resolution eta

kernel: str which kernel we're computing for.

ndim: int how many dimensions we are working with.

Returns

N: float the (approximate) number of neighbours

Definition at line 353 of file smltools.py.