pyxfem.solidmechanics.finite_volume_2d_hyperelasticity module
Created on Thu Mar 7 11:17:17 2024 @author: nchevaug 2D Explicit Lagrangian Finite Volume Solver (GLACE Scheme).
Philosophy & Architecture: This module implements the Godunov-type Lagrangian Scheme for Compressible Euler equations (GLACE). It computes the evolution of a fluid on an unstructured 2D triangular mesh moving with the fluid velocity (Lagrangian framework).
The solver features a dual-execution architecture: 1. Pure NumPy (Fallback): Fully vectorized array operations. 2. Numba JIT (HPC Mode): Aggressively optimized loop-level parallelism
(prange), avoiding heap allocations and leveraging hardware registers for the nodal Riemann solver.
- class pyxfem.solidmechanics.finite_volume_2d_hyperelasticity.Additional_MeshStruct(XY, tXY, F0, txy, iF0, F1, F)[source]
Bases:
NamedTuple- F: NDArray[float64]
Alias for field number 6
- F0: NDArray[float64]
Alias for field number 2
- F1: NDArray[float64]
Alias for field number 5
- XY: NDArray[float64]
Alias for field number 0
- iF0: NDArray[float64]
Alias for field number 4
- tXY: NDArray[float64]
Alias for field number 1
- txy: NDArray[float64]
Alias for field number 3
- class pyxfem.solidmechanics.finite_volume_2d_hyperelasticity.ConservationLawManager_Hyperelasticity(hyplaw, nbdata)[source]
Bases:
ConservativeLawManager
- pyxfem.solidmechanics.finite_volume_2d_hyperelasticity.GELEES_bc_set_external_pressure(vids: NDArray[int64], ps: NDArray[float64], mesh: GELEES_MeshStruct, out_vA: NDArray[float64], out_vb: NDArray[float64]) None[source]
Applies external pressure directly to the RHS vectors $b_{jr}$ of boundary nodes.
- pyxfem.solidmechanics.finite_volume_2d_hyperelasticity.GELEES_bc_set_sliding_wall(vids: NDArray[int64], NxN: NDArray[float64], ImNxN: NDArray[float64], vA: NDArray[float64], vb: NDArray[float64]) None[source]
Applies a sliding wall (slip) boundary condition to the global nodal linear system.
This function modifies the assembled $A_r$ matrices and $b_r$ vectors in-place for the nodes located on a sliding wall. It ensures that the velocity vector resulting from the linear system solver will have zero component normal to the wall ($u cdot n = 0$).
The algebraic modification projects the system onto the tangent plane: $A_{new} = (I - n otimes n) A_r (I - n otimes n) + mathrm{Tr}(A_r)(n otimes n)$ $b_{new} = (I - n otimes n) b_r$
Adding the trace back to the normal component ensures the modified matrix remains strictly invertible and well-conditioned.
- Parameters:
vids (npt.NDArray[np.uint64]) – 1D array of length (n_boundary_nodes). The global indices of the vertices located on the sliding wall.
NxN (FloatArray) – 3D array of shape (n_boundary_nodes, 2, 2). The dyadic tensor product of the normal vectors ($n otimes n$) at each boundary node.
ImNxN (FloatArray) – 3D array of shape (n_boundary_nodes, 2, 2). The tangent projection matrix ($I - n otimes n$) at each boundary node.
vA (FloatArray) – 3D array of shape (nverts, 2, 2). The global assembled $A_r$ matrices for all nodes in the mesh. Modified in-place.
vb (FloatArray) – 2D array of shape (nverts, 2). The global assembled $b_r$ vectors for all nodes in the mesh. Modified in-place.
- Returns:
The global vA and vb arrays are modified in-place to reflect the boundary constraints.
- Return type:
None
- class pyxfem.solidmechanics.finite_volume_2d_hyperelasticity.GlaceExplicitLagrangian_HyperElasticty_EquationSolver(law: HyperElasticMaterial, XY: NDArray[float64], xy: NDArray[float64], tris: NDArray[int64], boundary_conditions: Dict[str, Any], use_numba: bool = False)[source]
Bases:
GlaceExplicitLagrangianBaseSolverA 2D Explicit Lagrangian Finite Volume Solver for the Euler Equations using the GLACE (Godunov-type Lagrangian Scheme for Compressible Euler) scheme.
This class manages the mesh topology, physical state variables, boundary conditions, and time integration (both in pure NumPy and Numba JIT modes).
- compute_impedance_tensors(mesh: GELEES_MeshStruct, out_cvZ: NDArray[float64] | None = None)[source]
Compute the impdence tensor Z, per cell vertex (cv)
- critical_timestep() float[source]
Computes the maximum allowable critical time step for the entire mesh based on the CFL condition (acoustic wave speeds).
- Returns:
dtmax – The critical time step (dt).
- Return type:
float
- set_initial_state(velocity: Callable[[NDArray[float64]], NDArray[float64]]) None[source]
Sets the initial macroscopic state of the fluid for all cells.
- Parameters:
density (Callable[[FloatArray], FloatArray]) – A function taking cell center coordinates (N, 2) and returning an array of initial densities (N,).
velocity (Callable[[FloatArray], FloatArray]) – A function taking cell center coordinates (N, 2) and returning an array of initial velocity vectors (N, 2).
pressure (Callable[[FloatArray], FloatArray]) – A function taking cell center coordinates (N, 2) and returning an array of initial pressures (N,).
- pyxfem.solidmechanics.finite_volume_2d_hyperelasticity.setup_AdditionalMeshStruct(XY, xy, tris)[source]
- pyxfem.solidmechanics.finite_volume_2d_hyperelasticity.update_AdditionalMeshStruct(mesh: GELEES_MeshStruct, additional_mesh_data: Additional_MeshStruct)[source]
- pyxfem.solidmechanics.finite_volume_2d_hyperelasticity.update_AdditionalMeshStruct_pnjit(mesh: GELEES_MeshStruct, additional_mesh_data: Additional_MeshStruct)[source]