Periodic domains with shear (class Domain)¶
- class Domain.Domain(Lx, Ly, Lz)¶
This class handles the domain and the relevant BCs (periodic domain is a child of general domain). In the abstract, there is a domain \(D\) that is just a regular rectangular box of size \(L_x \times L_y \times L_z\). Then, there is some mapping from \(\mathbb{R}^3\) to this domain. This can involve periodic replication in some directions and shearing/stretching
- __init__(Lx, Ly, Lz)¶
Constructor. In the abstract the length inputs are NOT necessarily periodic length, but give the domain a characteristic volume we can use for stress calculations.
- Parameters:
Lx (double) – The length in the \(x\) direction
Ly (double) – The length in the \(y\) direction
Lz (double) – The length in the \(z\) direction
- class Domain.PeriodicShearedDomain(Lx, Ly, Lz)¶
Child class of Domain that handles periodic BCs and shear. In this implementation the domain deformation is limited to be simple shear. The domain is assumed to be a potentially deformed (non-orthogonal) parallelepiped. Unprimed coordinates denote positions in the undeformed (orthogonal) domain and primed in the deformed domain.
Letting \(g\) denote the strain in the coordinate system, the mapping between coordinates is given by
\[\begin{split} p':=\begin{pmatrix} x' \\ y' \\ z' \end{pmatrix} = \begin{pmatrix} 1 & -g & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} x \\ y \\ z \end{pmatrix}:=Lp \end{split}\]and we will make use of the matrix \(L\) extensively in the methods below.In this implementation, the strain \(g\) (self._g) is a private member of this class.
- __init__(Lx, Ly, Lz)¶
Constructor.
- Parameters:
Lx (double) – The periodic length in the \(x\) direction
Ly (double) – The periodic length in the \(y\) direction
Lz (double) – The periodic length in the \(z\) direction
- safetyfactor()¶
Compute the safety factor for measuring distance in the primed coordinates. If two points are at most \(r_c\) apart in real coordinates, then they are at most \(r_c \times S(g)\) apart in shear coordinates. For a sheared domain, the safety factor can be found by bounding the distance in Eulerian coordinates by the “distance” in sheared coordinates to obtain
\[ ||x|| = \sqrt{ (x')^T L^{-T} L^{-1} x'}\geq \left(1+ \frac{1}{2} \left(g^2 + \sqrt{g^2 \left(g^2+4\right)}\right)\right)^{-1}:=S^{-1} ||x'||. \]Thus, points that are \(S r_c\) or more apart using the (wrong) Euclidean metric in primed coordinates are at least \(r_c\) or more apart in orthogonal coordinates.- Returns:
The safety factor.
- Return type:
double
- roundg()¶
Shift g so it’s on [-1/2,1/2]
- calcShifted(dvec)¶
Method to compute the nearest periodic image of a point. The periodicity is in the primed directions. What this method is doing is to take a vector and slide it along the PERIODIC axes until it is on \([-L/2,L/2]^3\) in undeformed space (this is necessary to estimate the minimum norm)
- Parameters:
dvec (3-vector) – Vector in unprimed coordinates
- Returns:
The shifted vector
- Return type:
vector (3)
- EliminatePairsOfPointsOutsideRange(pairs, pts, rcut)¶
This method takes a list of pairs of points that are potentially less than rcut apart. It then removes any erroneous pairs that come from using a safety factor in the sheared coordinates.
- Parameters:
pairs (list) – List of pairs (of integer indices) of potentially interacting points that were picked up by neighbor search with the safety factor.
pts (array) – Array that has the positions of the points
rcut (double) – The cutoff distance we want to compute interactions below
- Returns:
List of pairs (of integer indices) of interacting points that are indeed a distance less than rcut in Euclidean distance (with periodicity measured using sheared coordinates)
- Return type:
list
- MinPrimeShiftInPrimeCoords(rprime)¶
Method to shift input deformed coordinates into their minimum periodic image on \([-L/2, L/2]\).
- Parameters:
rprime (array) – \(N \times 3\) array of \(N\) vectors in deformed \((x',y',z')\) coordinates.
- Returns:
The DEFORMED coordinates with a periodic shift so that their locations are on \([-L/2,L/2]\)
- Return type:
array
- ZeroLShiftInPrimeCoords(rprime)¶
Method to shift input deformed coordinates into their minimum periodic image on \([0,L]\). This is necessary if an external method requires them on this box.
- Parameters:
rprime (array) – \(N \times 3\) array of \(N\) vectors in deformed \((x',y',z')\) coordinates.
- Returns:
The DEFORMED coordinates with a periodic shift so that their locations are on \([0,L]\)
- Return type:
array
- getPeriodicLens()¶
- Returns:
The length in each direction
- Return type:
Array (3)
- primecoords(ptsxyz)¶
Method to calculate the coordinates of a vector in the shifted coordinate system by applying the matrix \(L\) (see constructor)
- Parameters:
ptsxyz (array) – \(N \times 3\) array of points in the \((x,y,z)\) coordinate system
- Returns:
\(N \times 3\) array of points in the \((x',y',z')\) coordinate system
- Return type:
array
- unprimecoords(ptsprime)¶
Method to calculate the coordinates of a vector in the shifted coordinate system by applying the matrix \(L^{-1}\) (see constructor)
- Parameters:
ptsprime (array) – \(N \times 3\) array of points in the \((x',y',z')\) coordinate system
- Returns:
\(N \times 3\) array of points in the \((x,y,z)\) coordinate system
- Return type:
array
- primeWaveNumbersFromUnprimed(kxUP, kyUP, kzUP)¶
Compute the wave numbers on a sheared grid from the wave numbers on an unsheared grid. The wave numbers are discussed in (86) of this paper.
- Parameters:
kxUP (array) – \(x\) wave numbers on standard unprimed coordinate system \((x,y,z)\).
kyUP (array) – \(y\) wave numbers on standard unprimed coordinate system \((x,y,z)\).
kzUP (array) – \(z\) wave numbers on standard unprimed coordinate system \((x,y,z)\).
- Returns:
Wave numbers on the primed deformed coordindate system \((x',y',z')\). These are the same as the \((x,y,z)\) system, except the \(y\) wave number becomes \(k_y'=k_y - g k_x\)
- Return type:
(array,array,array)