mass_matrices.py

Given a CoordinateTransformation instance which stands for a mapping \Phi:\Omega_{\mathrm{ref}}\to\Omega, we compute the mass matrices, \mathsf{M}_{\text{N}}, \mathsf{M}_{\text{E}}, \mathsf{M}_{\text{F}} and \mathsf{M}_{\text{V}}, of spaces \text{NP}_{N}(\Omega), \text{EP}_{N-1}(\Omega), \text{FP}_{N-1}(\Omega) and \text{VP}_{N-1}(\Omega).

⭕ To access the source code, click on the [source] button at the right side or click on [mass_matrices.py]. Dependence may exist. In case of error, check import and install required packages or download required scripts. © mathischeap.com

class mass_matrices.MassMatrices(bf, ct, quad_degree=None)[source]

The mass matrices.

Parameters:
  • bf (MimeticBasisPolynomials) –

  • ct (CoordinateTransformation) – A CoordinateTransformation instance that represents the mapping \Phi:\Omega_{\mathrm{ref}}\to\Omega.

  • quad_degree (list, tuple) – (default: None) The degree used for the numerical integral. It should be a list or tuple of three positive integers. If it is None, a suitable degree will be obtained from bf.

Example:

>>> from coordinate_transformation import CoordinateTransformation
>>> from coordinate_transformation import Phi, d_Phi
>>> from mimetic_basis_polynomials import MimeticBasisPolynomials
>>> ct = CoordinateTransformation(Phi, d_Phi)
>>> bf = MimeticBasisPolynomials('Lobatto-2', 'Lobatto-2', 'Lobatto-2')
>>> mm = MassMatrices(bf, ct)
>>> mm.quad_degree
[4, 4, 4]
>>> MN = mm.NP
>>> np.shape(MN)
(27, 27)
>>> ME = mm.EP
>>> np.shape(ME)
(54, 54)
>>> MF = mm.FP
>>> np.shape(MF)
(36, 36)
>>> MV = mm.VP
>>> np.shape(MV)
(8, 8)
>>> MN[13, :].toarray() 
array([[0.00069202, 0.00092145, 0.00016439, 0.00092145, 0.01896296,
        0.00381929, 0.00016439, 0.00381929, 0.00016439, ...
>>> ME[25, :].toarray() 
array([[ 2.84993722e-04,  2.18286425e-02,  2.31867356e-02,
         8.84765301e-03,  7.36065685e-04, -6.34982123e-03,...
>>> MF[30,:].toarray() 
array([[ 9.57306626e-03,  1.40151619e-02, -3.83134271e-03,
        -1.56689038e-01,  5.83237762e-02,  7.05662159e-02,...
>>> MV.toarray() 
array([[12.32813585, -0.99033139, -0.99033139,  0.29781084, -0.99033139,
         0.29781084,  0.29781084, -0.04159915],
       [-0.99033139, 16.33440736,  0.29781084, -3.27422609,  0.29781084,
        -3.27422609, -0.04159915,  0.29781084],...
property EP

The mass matrix \mathsf{M}_{\text{E}}.

Returns:

Return a csc_matrix representing the mass matrix.

property FP

The mass matrix \mathsf{M}_{\text{F}}.

Returns:

Return a csc_matrix representing the mass matrix.

property NP

The mass matrix \mathsf{M}_{\text{N}}.

Returns:

Return a csc_matrix representing the mass matrix.

property VP

The mass matrix \mathsf{M}_{\text{V}}.

Returns:

Return a csc_matrix representing the mass matrix.

↩️ Back to Ph.D. thesis complements (ptc).