hermit.csdl_helpers
Native-CSDL preprocessing / postprocessing helpers.
Everything here is ordinary CSDL (auto-differentiated) – gathers, reshapes, the isotropic ABD assembly, the force->pressure L2 solve, stress aggregation, nodal extraction. No FEniCSx, no custom operations.
Functions
|
Aggregated stress |
|
Isotropic single-layer A, B, D (n,3,3) and As (n,2,2) from E, nu, thickness (n,). |
|
Broadcast |
|
|
|
Combine nodal pressure + (force -> pressure) into the VF-dof RHS vector. |
|
(state dof vec) -> (n_nodes, 3) nodal field, reordered back to user node ordering. |
|
Per-cell angle (rad) from each cell's local e0 to the tangent-plane projection of |
|
Gather |
|
Return (mesh_nodes_variable, geometry_is_differentiable). |
|
Rotate the ABD stiffness |
Module Contents
- hermit.csdl_helpers.aggregate(pnorm_stress, m, rho)
Aggregated stress
(1/m) * (pnorm + guard)**(1/rho).mis a problem-specific scaling, not a smoothing knob: the aggregate is mathematically invariant underm(it cancels), and only the finite exponent range of float64 breaks that invariance – which it does violently oncem*max(vm)strays far from 1._warn_if_degeneratesays so out loud.
- hermit.csdl_helpers.assemble_abd_isotropic(E, nu, thickness)
Isotropic single-layer A, B, D (n,3,3) and As (n,2,2) from E, nu, thickness (n,).
Port of
MaterialInputFactory.from_isotropic(femo dev_coupling).
- hermit.csdl_helpers.broadcast0(var: csdl_alpha.Variable, n: int) csdl_alpha.Variable
Broadcast
varalong axis 0 to lengthn.A scalar (
()/(1,)) or a leading axis of length 1 is expanded ton(differentiably); an axis already of lengthnis returned unchanged. Used to let material inputs be given as a single value instead of a per-node / per-cell array.
- hermit.csdl_helpers.build_moment(loads, maps, vf_size: int)
- hermit.csdl_helpers.build_pressure(loads, maps, vf_size: int)
Combine nodal pressure + (force -> pressure) into the VF-dof RHS vector.
- hermit.csdl_helpers.extract_nodal(disp_vec, sparse_map, geom_shape, reverse_node_idx)
(state dof vec) -> (n_nodes, 3) nodal field, reordered back to user node ordering.
- hermit.csdl_helpers.orientation_angle(direction, frames) numpy.ndarray
Per-cell angle (rad) from each cell’s local e0 to the tangent-plane projection of
direction(a global(3,)vector or a per-cell(n, 3)field).frames:(n, 3, 3)local frames, rows e0, e1, e2. Pure numpy – fibre layout is fixed.
- hermit.csdl_helpers.reorder(var: csdl_alpha.Variable, idx) csdl_alpha.Variable
Gather
varalong axis 0 by integer index arrayidx(user -> FE ordering).
- hermit.csdl_helpers.resolve_mesh_nodes(reference_nodes, node_disp=None, mesh_nodes=None)
Return (mesh_nodes_variable, geometry_is_differentiable).
- hermit.csdl_helpers.rotate_abd(A, B, D, As, theta)
Rotate the ABD stiffness
(n,3,3)and transverse shearAs(n,2,2)by a per-cell in-plane angletheta(n,).thetamay be numpy (fixed fibre layout) or acsdl.Variable(differentiable, e.g. a fibre-angle design field).X_rot = Tsig_inv(theta) @ X @ Teps(theta)– LamAD’s CLT transform.Asis in the shell’s standard (xz, yz) transverse-shear ordering (the CLT seam inhm.laminatepermutes it there), so its rotation usesr2t @ As @ r2 == R(theta)^T As R(theta)– theTeps-consistent convention (r2 == R(theta),r2t == R(theta)^T), matchinghermit.fenics.kinematics.shear_rotation/congruent_transform. (r2 @ As @ r2twould instead be correct for a swapped(yz, xz)ordering.)