coordinate_transformation.py¶
Compute the coordinate transformation related variables for a mapping,
We get an instance of class CoordinateTransformation
. The
transformations are its methods.
⭕ To access the source code, click on the [source] button at the right
side or click on
[coordinate_transformation.py]
.
Dependence may exist. In case of error, check import and install
required packages or download required scripts. © mathischeap.com
- class coordinate_transformation.CoordinateTransformation(Phi, d_Phi)[source]¶
The coordinate transformation class.
- Parameters:
Phi (function) –
The mapping . It should be a function which returns three components of the mapping, i.e.,
d_Phi (function) –
The Jacobian matrix of , . It should be a function return the 9 components of the Jacobian matrix, i.e.,
( , , ), ( , , ), ( , , ).
- Example:
>>> ct = CoordinateTransformation(Phi, d_Phi) # generate a CT instance >>> xi = np.linspace(-0.9, 0.6, 3) >>> et = np.linspace(-0.7, 0.9, 3) >>> sg = np.linspace(-0.8, 0.7, 3) >>> xi, et, sg = np.meshgrid(xi, et, sg, indexing='ij') >>> x, y, z = ct.mapping(xi, et, sg) >>> x array([[[0.06469463, 0.05391086, 0.02977458],... >>> y array([[[0.16469463, 0.15391086, 0.12977458],... >>> z array([[[0.11469463, 0.47891086, 0.82977458],... >>> J = ct.Jacobian_matrix(xi, et, sg) >>> J[0][0] # J_{1,1} array([[[0.64207986, 0.53781345, 0.30444385],... >>> J[1][1] # J_{2,2} array([[[0.53354051, 0.50892654, 0.45383545],... >>> detJ = ct.Jacobian(xi, et, sg) >>> detJ array([[[0.1847901 , 0.11729178, 0.07611096],... >>> iJ = ct.inverse_Jacobian_matrix(xi, et, sg) >>> iJ[2][2] # J^{-1}_{3,3} array([[[1.82807508, 2.33068327, 1.69672867],... >>> iJ[1][2] # J^{-1}_{2,3} array([[[-0.17192492, 0.33068327, -0.30327133],... >>> G = ct.metric_matrix(xi, et, sg) >>> G[0][1] # g_{1,2} array([[[ 0.10210648, 0.02438263, -0.09377707],... >>> G[1][2] # g_{2,3} array([[[ 0.05493377, -0.03640053, -0.0063935 ],... >>> g = ct.metric(xi, et, sg) >>> g array([[[0.03414738, 0.01375736, 0.00579288],... >>> iG = ct.inverse_metric_matrix(xi, et, sg) >>> iG[1][2] # g^{2,3} array([[[-0.33977063, 0.72204401, 1.83434454],...
- Jacobian_matrix(xi, et, sg)[source]¶
A wrap of the input Jacobian matrix,
d_Phi
, i.e., .- Returns:
Return the Jacobian matrix :
- inverse_Jacobian(xi, et, sg)[source]¶
Compute the inverse Jacobian, the determinant of the inverse Jacobian matrix, .
- inverse_Jacobian_matrix(xi, et, sg)[source]¶
Compute the Jacobian matrix of the inverse mapping ,
- Returns:
Return the inverse Jacobian matrix : :
- inverse_metric_matrix(xi, et, sg)[source]¶
Compute the inverse metric matrix, .
- Returns:
Return the inverse metric matrix : :
↩️ Back to Ph.D. thesis complements (ptc).