FE_transformation_2d
Module: fe_transformation_2d.py
This module provides the abstract base class for all 2D finite element transformations. It defines the interface for mapping between reference and physical coordinates in two-dimensional finite element analysis.
Classes:
Name | Description |
---|---|
FETransformation2D |
Abstract base class for 2D finite element transformations |
Dependencies
- abc: For abstract base class functionality
- quad_affine: For affine transformation implementations
- quad_bilinear: For bilinear transformation implementations
Key Features
- Abstract interface for coordinate transformations
- Reference to physical domain mapping
- Jacobian matrix computation
- Support for different element geometries
- Cell geometry specification interface
- Systematic transformation validation
Version Info
27/Dec/2024: Initial version - Thivin Anandh D
References
None
FETransforamtion2D
A base class for 2D finite element transformations.
This abstract class defines the interface for mapping between reference and physical coordinates in 2D finite element analysis. Implementations must provide specific transformation rules for different element types.
Methods:
Name | Description |
---|---|
set_cell |
Sets the physical coordinates of the element vertices. Must be implemented by derived classes. |
get_original_from_ref |
Maps coordinates from reference to physical domain. Must be implemented by derived classes. |
get_jacobian |
Computes the Jacobian matrix of the transformation. Must be implemented by derived classes. |
Example
class QuadTransform(FETransformation2D): ... def set_cell(self, vertices): ... self.vertices = vertices ... def get_original_from_ref(self, xi:np.ndarray, eta:np.ndarray) -> np.ndarray: ... # Implementation for quad element ... pass ... def get_jacobian(self, xi: np.ndarray, eta:np.ndarray) -> np.ndarray: ... # Implementation for quad element ... pass
Notes
- Reference domain is typically [-1,1] × [-1,1]
- Transformations must be invertible
- Implementations should handle element distortion
- Jacobian is used for both mapping and integration
Source code in scirex/core/sciml/fe/fe_transformation_2d.py
__init__()
get_jacobian(xi, eta)
abstractmethod
This method returns the Jacobian of the transformation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
xi
|
ndarray
|
The xi coordinate. |
required |
eta
|
ndarray
|
The eta coordinate. |
required |
Returns:
Type | Description |
---|---|
ndarray
|
np.ndarray: Returns the Jacobian of the transformation. |
Source code in scirex/core/sciml/fe/fe_transformation_2d.py
get_original_from_ref(xi, eta)
abstractmethod
This method returns the original coordinates from the reference coordinates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
xi
|
ndarray
|
The xi coordinate. |
required |
eta
|
ndarray
|
The eta coordinate. |
required |
Returns:
Type | Description |
---|---|
ndarray
|
np.ndarray: Returns the transformed original coordinates from the reference coordinates. |
Source code in scirex/core/sciml/fe/fe_transformation_2d.py
set_cell()
abstractmethod
Set the cell coordinates, which will be used to calculate the Jacobian and actual values.
:return: None
QuadAffin
Bases: FETransforamtion2D
Implements affine transformation for quadrilateral elements.
This class provides methods to transform between reference and physical quadrilateral elements using affine mapping. It handles coordinate transformations, Jacobian computations, and derivative mappings.
Attributes:
Name | Type | Description |
---|---|---|
co_ordinates |
Array of physical element vertex coordinates Shape: (4, 2) for 2D quadrilateral |
|
x0, |
(x1, x2, x3)
|
x-coordinates of vertices |
y0, |
(y1, y2, y3)
|
y-coordinates of vertices |
xc0, |
(xc1, xc2)
|
x-coordinate transformation coefficients |
yc0, |
(yc1, yc2)
|
y-coordinate transformation coefficients |
detjk |
(yc1, yc2)
|
Determinant of the Jacobian |
rec_detjk |
(yc1, yc2)
|
Reciprocal of Jacobian determinant |
Example
coords = np.array([[0,0], [1,0], [1,1], [0,1]]) quad = QuadAffin(coords) ref_point = np.array([0.5, 0.5]) physical_point = quad.get_original_from_ref(*ref_point)
Note
The implementation assumes counterclockwise vertex ordering and non-degenerate quadrilateral elements.
References
[1] ParMooN Project: QuadAffine.C implementation
Source code in scirex/core/sciml/fe/quad_affine.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
|
__init__(co_ordinates)
Constructor for the QuadAffin class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
co_ordinates
|
ndarray
|
Array of physical element vertex coordinates Shape: (4, 2) for 2D quadrilateral |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in scirex/core/sciml/fe/quad_affine.py
get_jacobian(xi, eta)
Returns the Jacobian of the transformation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
xi
|
ndarray
|
The xi coordinate. |
required |
eta
|
ndarray
|
The eta coordinate. |
required |
Returns:
Type | Description |
---|---|
ndarray
|
np.ndarray: The Jacobian of the transformation. |
Source code in scirex/core/sciml/fe/quad_affine.py
get_orig_from_ref_derivative(ref_gradx, ref_grady, xi, eta)
Returns the derivatives of the original coordinates with respect to the reference coordinates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ref_gradx
|
ndarray
|
The reference gradient in the x-direction. |
required |
ref_grady
|
ndarray
|
The reference gradient in the y-direction. |
required |
xi
|
ndarray
|
The xi coordinate. |
required |
eta
|
ndarray
|
The eta coordinate. |
required |
Returns:
Name | Type | Description |
---|---|---|
tuple |
The derivatives of the original coordinates with respect to the reference coordinates. |
Source code in scirex/core/sciml/fe/quad_affine.py
get_orig_from_ref_second_derivative(grad_xx_ref, grad_xy_ref, grad_yy_ref, xi, eta)
Returns the second derivatives (xx, xy, yy) of the original coordinates with respect to the reference coordinates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
grad_xx_ref
|
ndarray
|
The reference second derivative in the x-direction. |
required |
grad_xy_ref
|
ndarray
|
The reference second derivative in the xy-direction. |
required |
grad_yy_ref
|
ndarray
|
The reference second derivative in the y-direction. |
required |
xi
|
ndarray
|
The xi coordinate. |
required |
eta
|
ndarray
|
The eta coordinate. |
required |
Returns:
Name | Type | Description |
---|---|---|
tuple |
The second derivatives (xx, xy, yy) of the original coordinates with respect to the reference coordinates. |
Source code in scirex/core/sciml/fe/quad_affine.py
get_original_from_ref(xi, eta)
Returns the original coordinates from the reference coordinates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
xi
|
ndarray
|
The xi coordinate. |
required |
eta
|
ndarray
|
The eta coordinate. |
required |
Returns:
Type | Description |
---|---|
ndarray
|
np.ndarray: The transformed original coordinates from the reference coordinates. |
Source code in scirex/core/sciml/fe/quad_affine.py
set_cell()
Set the cell coordinates, which will be used to calculate the Jacobian and actual values.
Returns:
Type | Description |
---|---|
None |
Source code in scirex/core/sciml/fe/quad_affine.py
QuadBilinear
Bases: FETransforamtion2D
Implements bilinear transformation for quadrilateral elements.
This class provides methods to transform between reference and physical quadrilateral elements using bilinear mapping. It handles coordinate transformations, Jacobian computations, and derivative mappings for more general quadrilateral elements than affine transformations.
Attributes:
Name | Type | Description |
---|---|---|
co_ordinates |
Array of physical element vertex coordinates Shape: (4, 2) for 2D quadrilateral |
|
x0, |
(x1, x2, x3)
|
x-coordinates of vertices |
y0, |
(y1, y2, y3)
|
y-coordinates of vertices |
xc0, |
(xc1, xc2, xc3)
|
x-coordinate transformation coefficients |
yc0, |
(yc1, yc2, yc3)
|
y-coordinate transformation coefficients |
detjk |
Determinant of the Jacobian matrix |
Example
coords = np.array([[0,0], [1,0], [1.2,1], [0.2,1.1]]) quad = QuadBilinear(coords) ref_point = np.array([0.5, 0.5]) physical_point = quad.get_original_from_ref(*ref_point)
Note
- Implementation assumes counterclockwise vertex ordering
- Second derivatives computation is not fully implemented
- Jacobian is computed point-wise due to non-constant nature of bilinear transformation
References
[1] ParMooN Project: QuadBilineare.C implementation
Source code in scirex/core/sciml/fe/quad_bilinear.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
|
__init__(co_ordinates)
Constructor for the QuadBilinear class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
co_ordinates
|
ndarray
|
Array of physical element vertex coordinates Shape: (4, 2) for 2D quadrilateral |
required |
Returns:
Type | Description |
---|---|
None
|
None |
Source code in scirex/core/sciml/fe/quad_bilinear.py
get_jacobian(xi, eta)
This method returns the Jacobian of the transformation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
xi
|
ndarray
|
The xi coordinate. |
required |
eta
|
ndarray
|
The eta coordinate. |
required |
Returns:
Type | Description |
---|---|
ndarray
|
np.ndarray: Returns the Jacobian of the transformation. |
Source code in scirex/core/sciml/fe/quad_bilinear.py
get_orig_from_ref_derivative(ref_gradx, ref_grady, xi, eta)
This method returns the derivatives of the original coordinates with respect to the reference coordinates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ref_gradx
|
ndarray
|
The derivative of the xi coordinate in the reference element. |
required |
ref_grady
|
ndarray
|
The derivative of the eta coordinate in the reference element. |
required |
xi
|
ndarray
|
The xi coordinate. |
required |
eta
|
ndarray
|
The eta coordinate. |
required |
Returns:
Type | Description |
---|---|
ndarray
|
np.ndarray: The derivatives of the original coordinates [x, y] with respect to the reference coordinates. |
Source code in scirex/core/sciml/fe/quad_bilinear.py
get_orig_from_ref_second_derivative(grad_xx_ref, grad_xy_ref, grad_yy_ref, xi, eta)
This method returns the second derivatives of the original coordinates with respect to the reference coordinates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
grad_xx_ref
|
ndarray
|
The second derivative of the xi coordinate in the reference element. |
required |
grad_xy_ref
|
ndarray
|
The second derivative of the xi and eta coordinates in the reference element. |
required |
grad_yy_ref
|
ndarray
|
The second derivative of the eta coordinate in the reference element. |
required |
xi
|
ndarray
|
The xi coordinate. |
required |
eta
|
ndarray
|
The eta coordinate. |
required |
Note
Second derivative calculations are not fully implemented in this method. Needs further development.
Source code in scirex/core/sciml/fe/quad_bilinear.py
get_original_from_ref(xi, eta)
This method returns the original coordinates from the reference coordinates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
xi
|
ndarray
|
The xi coordinate. |
required |
eta
|
ndarray
|
The eta coordinate. |
required |
Returns:
Type | Description |
---|---|
ndarray
|
np.ndarray: Returns the transformed original coordinates from the reference coordinates. |
Source code in scirex/core/sciml/fe/quad_bilinear.py
set_cell()
Set the cell coordinates, which will be used as intermediate values to calculate the Jacobian and actual values.
Returns:
Type | Description |
---|---|
None |