-
Notifications
You must be signed in to change notification settings - Fork 9
Description
Hello Everyone,
I am writing my thesis on Homogenisation of Triply periodic minimal surfaces, the approach is to generate periodic FEM meshes of TPMS unit cells for applicaiton of Periodic boundary conditions .
Describe the bug
The code I'm using makes use of the hmax parameter to change the FEA mesh density. However, varying the hmax parameter in remesh_keeping_periodicity_for_fem() does not change the resulting mesh density, element count, or Abaqus .inp file size, even when the parameter is adjusted over several orders of magnitude.
Additionally:
The final exported mesh always contains linear tetrahedral elements (C3D4), even when quadratic elements (C3D10) are explicitly requested.
Expected behavior
Changing hmax should:
1.Modify the characteristic element size.
2.Lead to a change in volumetric element count.
3.Result in different .inp file sizes.
Observed behavior
Varying hmax across a wide range (e.g. 0.15, 3, 50, 100) produces:
1.Identical .inp file sizes (≈ 17–18 MB)
2.Identical volumetric element counts in Abaqus
3.Abaqus query tool always reports the same number of elements regardless of hmax
4.Even when ELEMENT_ORDER = 2 is specified, the mesh consists only of C3D4 elements
Steps to reproduce the bug.
from pathlib import Path
import cadquery as cq
import pyvista as pv
from microgen import Tpms, Phase, Rve
from microgen.mesh import mesh_periodic
from microgen.remesh import remesh_keeping_periodicity_for_fem
from microgen.shape.surface_functions import gyroid
from microgen.operations import rescale
UNIT_CELL_SIZE = 4.0 # mm
DENSITY = 0.30
TPMS_RESOLUTION = 30
BASE_MESH_SIZE = 0.3 # topology / periodic pairing
ELEMENT_ORDER = 2 # 1=C3D4, 2=C3D10
HMAX = 0.15 # <-- varied in tests
# 1. Generate SHEET TPMS geometry
geometry = Tpms(
surface_function=gyroid,
density=DENSITY,
resolution=TPMS_RESOLUTION,
)
sheet_shape = geometry.generate(type_part="sheet")
sheet_shape = rescale(
sheet_shape,
(UNIT_CELL_SIZE, UNIT_CELL_SIZE, UNIT_CELL_SIZE)
)
phases = [Phase(shape=sheet_shape)]
rve = Rve(dim=(UNIT_CELL_SIZE, UNIT_CELL_SIZE, UNIT_CELL_SIZE))
# 2. Export STEP geometry
base_dir = Path(__file__).parent
step_file = base_dir / "gyroid.step"
cq.exporters.export(phases[0].shape, str(step_file))
# 3. Periodic meshing → VTK
vtk_file = base_dir / "gyroid_periodic.vtk"
mesh_periodic(
mesh_file=str(step_file),
rve=rve,
list_phases=phases,
order=ELEMENT_ORDER,
size=BASE_MESH_SIZE,
output_file=str(vtk_file),
)
# 4. Remesh while preserving periodicity
initial_mesh = pv.UnstructuredGrid(str(vtk_file))
remeshed_mesh = remesh_keeping_periodicity_for_fem(
initial_mesh,
hmax=HMAX,
)
# 5. Export FINAL Abaqus mesh
final_inp = base_dir / "gyroid_periodic_remeshed.inp"
remeshed_mesh.save(str(final_inp))### Summary
At present, changing hmax does not alter the final FEM mesh, preventing mesh refinement and convergence studies. Clarification on the intended usage of remesh_keeping_periodicity_for_fem, element order handling, and recommended periodic meshing workflows would be greatly appreciated.