Skip to content

Commit 088a0cd

Browse files
committed
Merge branch 'ansys' of https://github.com/pasteurlabs/tesseract-jax into ansys
2 parents 2d93b56 + 35550c7 commit 088a0cd

File tree

2 files changed

+1020
-1238
lines changed

2 files changed

+1020
-1238
lines changed

examples/ansys/optim_bars_pymapdl.ipynb

Lines changed: 1008 additions & 1234 deletions
Large diffs are not rendered by default.

examples/ansys/pymapdl_tess/tesseract_api.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ class HexMesh(BaseModel):
5353
description="Array of hexahedral faces defined by indices into the points array."
5454
)
5555
n_points: Int32 = Field(
56-
default=0, description="Number of valid points in the points array."
56+
default = 0, description="Number of valid points in the points array."
5757
)
5858
n_faces: Int32 = Field(
59-
default=0, description="Number of valid faces in the faces array."
59+
default = 0, description="Number of valid faces in the faces array."
6060
)
6161

6262

@@ -158,12 +158,15 @@ def __init__(self, inputs: InputSchema, mapdl: Mapdl) -> None:
158158

159159
# Extract input parameters
160160
self.rho = inputs.rho
161-
self.hex_mesh = inputs.hex_mesh
162161
self.dirichlet_mask = inputs.dirichlet_mask
163162
self.dirichlet_values = inputs.dirichlet_values
164163
self.van_neumann_mask = inputs.van_neumann_mask
165164
self.van_neumann_values = inputs.van_neumann_values
166165
self.hex_mesh = inputs.hex_mesh
166+
if self.hex_mesh.n_faces == 0:
167+
self.hex_mesh.n_faces = self.hex_mesh.faces.shape[0]
168+
if self.hex_mesh.n_points == 0:
169+
self.hex_mesh.n_points = self.hex_mesh.points.shape[0]
167170
self.E0 = inputs.E0
168171
self.rho_min = inputs.rho_min
169172
self.p = inputs.p
@@ -669,4 +672,9 @@ def vector_jacobian_product(
669672

670673
def abstract_eval(abstract_inputs):
671674
"""Calculate output shape of apply from the shape of its inputs."""
672-
return {"compliance": ShapeDType(shape=(), dtype="float32")}
675+
n_faces = abstract_inputs.hex_mesh.faces.shape[0]
676+
return {
677+
"compliance": ShapeDType(shape=(), dtype="float32"),
678+
"strain_energy": ShapeDType(shape=(n_faces,), dtype="float32"),
679+
"sensitivity": ShapeDType(shape=(n_faces,), dtype="float32"),
680+
}

0 commit comments

Comments
 (0)