Skip to content

Commit 4eb6178

Browse files
committed
improve test comments
1 parent 24c5359 commit 4eb6178

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

examples/ansys/pymapdl_tess/test.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import numpy as np
44
import pyvista as pv
5-
from tesseract_api import HexMesh # TODO can we standardize these mesh definitions?
5+
from tesseract_api import HexMesh
66
from tesseract_core import Tesseract
77

88
# load the MAPDL server's address from your environment
@@ -34,8 +34,7 @@
3434
def mesh_from_pyvista(Lx, Ly, Lz, Nx, Ny, Nz):
3535
grid = pv.ImageData(
3636
dimensions=np.array((Nx, Ny, Nz)) + 1,
37-
# origin=(-Lx / 2, -Ly / 2, -Lz / 2), # The bottom left corner of the data set
38-
origin=(0, 0, 0), # TODO
37+
origin=(0, 0, 0),
3938
spacing=(Lx / Nx, Ly / Ny, Lz / Nz), # These are the cell sizes along each axis
4039
)
4140
# repeated casts will eventually expose cell_connectivitiy
@@ -55,13 +54,10 @@ def mesh_from_pyvista(Lx, Ly, Lz, Nx, Ny, Nz):
5554

5655

5756
def cantilever_bc(Lx, Ly, Lz, Nx, Ny, Nz, hex_mesh):
57+
# Create a dirichlet_mask of nodes indices associated with diricelet condition
5858
# dirichlet condition (select nodes at x=0)
5959
on_lhs = hex_mesh.points[:, 0] <= 0
60-
# TODO should this be an n_node vector?
61-
# dirichlet_indices = np.where(on_lhs)[0]
62-
# dirichlet_mask = np.zeros(hex_mesh.n_points)
63-
# dirichlet_mask[dirichlet_indices] = 1
64-
dirichlet_mask = np.where(on_lhs)[0]
60+
dirichlet_mask = np.where(on_lhs)[0] # size (num_dirichlet_nodes,)
6561
dirichlet_values = np.zeros(dirichlet_mask.shape[0])
6662

6763
# von Neumann condition (select nodes at x=Lx with constraints on y and z)
@@ -81,7 +77,7 @@ def cantilever_bc(Lx, Ly, Lz, Nx, Ny, Nz, hex_mesh):
8177
),
8278
),
8379
)
84-
# TODO should this be an n_node array?
80+
# A (num_von_neumann_nodes, n_dof) array
8581
von_neumann_mask = np.where(von_neumann)[0]
8682
von_neumann_values = np.array([0, 0.0, 0.1 / len(von_neumann_mask)]) + np.zeros(
8783
(von_neumann_mask.shape[0], 3)
@@ -101,7 +97,7 @@ def main():
10197
Lx, Ly, Lz = 3, 2, 1
10298
Nx, Ny, Nz = 60, 40, 20
10399
Nx, Ny, Nz = 6, 4, 2
104-
num_tests = 5 # set to 0 if you don't want to run this check
100+
num_tests = 0 # set to 0 if you don't want to run this check
105101
run_central_difference = True
106102

107103
hex_mesh = mesh_from_pyvista(Lx, Ly, Lz, Nx, Ny, Nz)

0 commit comments

Comments
 (0)