modepy.version.
VERSION
¶A tuple like (2013,1,1) indicating modepy’s version.
modepy.version.
VERSION_TEXT
¶A textual representation of the modepy version.
modepy.
vandermonde
(functions, nodes)¶Return a (generalized) Vandermonde matrix.
The Vandermonde Matrix is given by \(V_{i,j} := f_j(x_i)\) where functions is the list of \(f_j\) and nodes is the array of \(x_i\), shaped as (d, npts), where d is the number of dimensions and npts is the number of nodes.
functions are allowed to return tuple
instances.
In this case, a tuple of matrices is returned–i.e. this function
works directly on modepy.grad_simplex_onb()
and returns
a tuple of matrices.
Vandermonde matrices are very useful to concisely express interpolation. For instance, one may use the inverse \(V^{-1}\) of a Vandermonde matrix \(V\) to map nodal values (i.e. point values at the nodes corresponding to \(V\)) into modal (i.e. basis) coefficients. \(V\) itself maps modal coefficients to nodal values. This allows easy resampling:
modepy.
resampling_matrix
(basis, new_nodes, old_nodes, least_squares_ok=False)¶Return a matrix that maps nodal values on old_nodes onto nodal values on new_nodes.
Parameters: |
|
---|
Vandermonde matrices also obey the following relationship useful for obtaining point interpolants:
where \((\phi_i)_i\) is the basis of functions underlying \(V\).
modepy.
mass_matrix
(basis, nodes)¶Return a mass matrix \(M\), which obeys
Parameters: | basis – assumed to be an orthonormal basis with respect to the \(L^2\) inner product. |
---|
New in version 2014.1.
Differentiation is also convenient to express by using \(V^{-1}\) to obtain modal values and then using a Vandermonde matrix for the derivatives of the basis to return to nodal values.
modepy.
differentiation_matrices
(basis, grad_basis, nodes, from_nodes=None)¶Return matrices carrying out differentiation on nodal values in the \((r,s,t)\) unit directions. (See Coordinates on the triangle and Coordinates on the tetrahedron.)
Parameters: |
|
---|---|
Returns: | If grad_basis returned tuples (i.e. in 2D and 3D), returns a tuple of length dims containing differentiation matrices. If not, returns just one differentiation matrix. |
Changed in version 2013.4: Added from_nodes.
Estimate the smoothness of a function represented in a basis
returned by modepy.simplex_onb()
.
The method implemented in this module follows this article:
A. Kloeckner, T. Warburton, and J. S. Hesthaven. “Viscous Shock Capturing in a Time-Explicit Discontinuous Galerkin Method”. Mathematical Modelling of Natural Phenomena 6, No. 3 (May 16, 2011): 57-83. http://dx.doi.org/10.1051/mmnp/20116303 http://arxiv.org/abs/1102.3190
New in version 2013.2.
modepy.modal_decay.
fit_modal_decay
(coeffs, dims, n, ignored_modes=1)¶Fit a curve to the modal decay on each element.
Parameters: |
|
---|---|
Returns: | a tuple (expn, constant) of arrays of length num_elements,
where the modal decay is fit to the curve
|
-exponent-1
can be used as a rough indicator of how many continuous
derivatives the underlying function possesses.
modepy.modal_decay.
estimate_relative_expansion_residual
(coeffs, dims, n, ignored_modes=1)¶Use the modal fit to estimate the relative residual of the expansion.
The arguments to this function exactly match fit_modal_decay()
.
Returns: | An array of estimates of the fraction of the \(L^2\) norm contained in the (unrepresented) tail of |
---|
An idea like this is described in this article:
H. Feng and C. Mavriplis, “Adaptive Spectral Element Simulations of Thin Premixed Flame Sheet Deformations”, Journal of Scientific Computing, Volume 17, Nr. 1, S. 385-395, Dec. 2002. http://dx.doi.org/10.1023/A:1015137722700
For this function, however, the decay curve is fitted using the Kloeckner/Warburton/Hesthaven technique (see above).
modepy.tools.
estimate_lebesgue_constant
(n, nodes, visualize=False)¶Estimate the Lebesgue constant of the nodes at polynomial order n.
Parameters: |
|
---|---|
Returns: | the Lebesgue constant, a scalar |
New in version 2013.2.