WallGo.grid3Scales
Class for computing and storing the coordinates on the grid and other related quantities.
Classes
|
Redefinition of the Grid class to take into account the different scales present in the z direction. |
- class Grid3Scales(M, N, tailLengthInside, tailLengthOutside, wallThickness, momentumFalloffT, ratioPointsWall=0.5, smoothing=0.1, wallCenter=0, spacing='Spectral')[source]
Redefinition of the Grid class to take into account the different scales present in the z direction. More specifically, the \(z\) mapping function should scale as
\[\begin{split}z(\chi \to -1) &= \lambda_- \log(1+\chi),\\ z(\chi \to 1) &= -\lambda_+ \log(1-\chi),\end{split}\]where \(\lambda_-\) and \(\lambda_+\) are the lengths of the solution’s tails inside and outside the bubble, respectively. Furthermore, the mapping should be approximately linear in the region \(-r<\chi<r\), where \(r\) is roughly the ratio of points that are used to resolve the wall’s interior. The slope in that region should be \(L/r\), where \(L\) is the wall thickness, so that
\[z'(\chi) \approx \frac{L}{r}, \quad \chi \in [-r, r].\]It is easier to find the derivative of a function that has these properties, and then integrate it. We choose here
\[z'(\chi)=\frac{f(\chi)}{1-\chi^2},\]where \(f(\chi)\) is a smoothed step function equal to
\[\begin{split}f(\chi) \approx \begin{cases} 2\lambda_-,& \chi<-r,\\ L/r,& -r<\chi<r,\\ 2\lambda_+,& \chi>r. \end{cases}\end{split}\]We choose \(f(\chi)\) to be a sum of functions like \(\frac{\chi-\chi_0}{\sqrt{a^2+(\chi-\chi_0)^2}}\), which allows us to find analytically the mapping function with
\[z(\chi) - z(\chi_0) =\int^\chi_{\chi_0} \frac{f(\chi')}{1-\chi'^2} d\chi'.\]The parameter \(a\) can be adjusted to control the smoothness of the mapping function.
- Parameters:
M (int) – Number of basis functions in the \(\xi\) (and \(\chi\)) direction.
N (int) – Number of basis functions in the \(p_z\) and \(p_\Vert\) (and \(\rho_z\) and \(\rho_\Vert\)) directions.
tailLengthInside (float) – Decay length of the solution’s tail inside the wall. Should be larger than wallThickness*(1/2+smoothing)/ratioPointsWall. Should be expressed in physical units (the units used in EffectivePotential).
tailLengthOutside (float) – Decay length of the solution’s tail outside the wall. Should be larger than wallThickness*(1/2+smoothing)/ratioPointsWall. Should be expressed in physical units (the units used in EffectivePotential).
wallThickness (float) – Thickness of the wall. Should be expressed in physical units (the units used in EffectivePotential).
momentumFalloffT (float) – Temperature scale determining transform in momentum directions. Should be close to the plasma temperature.
ratioPointsWall (float, optional) – Ratio of grid points inside the wall. The remaining points are distributed equally between the 2 tails. The default is 0.5.
smoothing (float, optional) – Controls the smoothness of the mapping function. Its first derivative becomes discontinuous at \(\chi=\pm r\) when smoothness is 0. Should be smaller than 1, otherwise the function would not be linear at \(\chi=0\) anymore. As explained above, the decay length is controlled by adding 2 smoothed step functions. ‘smoothing’ is the value of these functions at the origin, in units of \(L/r\). The default is 0.1.
wallCenter (float, optional) – Position of the wall’s center (in the z coordinates). Default is 0.
spacing ({'Spectral', 'Uniform'}) – Choose ‘Spectral’ for the Gauss-Lobatto collocation points, as required for WallGo’s spectral representation, or ‘Uniform’ for a uniform grid. Default is ‘Spectral’.
- Return type:
None.
- changePositionFalloffScale(tailLengthInside, tailLengthOutside, wallThickness, wallCenter)[source]
Change the position falloff scale.
- Parameters:
newScale (float) – New position falloff scale.
tailLengthInside (float)
tailLengthOutside (float)
wallThickness (float)
wallCenter (float)
- Return type:
None