SimVascular / SimVascular/svVascularize
Meshes for large geometries too dense
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 19
- Forks
- 11
- Avg merge
- 1h 58m
- Merged PRs (30d)
- 19
Description
Description
When trying to generate a larger mesh (inlet diameter ~3 cm), the mesh element size did not increase accordingly, resulting in a very dense mesh with too many elements (even when I passed in an mesh size parameter (hsize) to use to set hmin and hmax for MMGS). I resolved the issue by increasing the hausd setting,
tube = remesh_surface(tube, hmin=hsize, hmax=hsize*2, noinsert = False, nomove = False, nosurf = False, hausd = 0.1, hgrad = -1.0,verbosity = 3)
but it would be nice to adjust this automatically based on vessel size.
Reproduction
Example of code that generates a too-dense mesh. Don't include hsize for standard, unmodified svVascularize.
import os
import pyvista as pv
from svv.domain.domain import Domain
from svv.tree.tree import Tree
from svv.simulation.simulation import Simulation
from svv.simulation.fluid.rom.zero_d.zerod_tree import export_0d_simulation
cube = Domain(pv.Cube(center=(0.0, 0.0, 0.0), x_length=45.0, y_length=45.0, z_length=45.0,))
cube.create()
cube.solve()
cube.build()
set_name = 'test_set'
geo_name = 't_1'
# Creating the Vascular Tree Object
tree = Tree()
tree.set_domain(cube)
tree.parameters.set("root_pressure", 2*1333.22) # in dyn/cm^2
tree.parameters.set("terminal_pressure", 1*1333.22) # in dyn/cm^2
tree.parameters.set("terminal_flow", 300) # in cm^3/s
tree.set_root()
tree.n_add(5)
# Wrap a generated tree in a Simulation container
sim = Simulation(tree, name=geo_name)
# Build CFD-ready meshes and identify boundary faces
sim.build_meshes(fluid=True, tissue=False, boundary_layer=True, hsize=0.3)
sim.extract_faces(crease_angle=60.0)
# Construct and write an svFSI configuration
sim.construct_3d_fluid_simulation()
sim.write_3d_fluid_simulation()
# Export a matching 0D model for fast hemodynamic studies
sim.write_0d_fluid_simulation()
Expected behavior
Element size would ideally scale proportionally to the geometry.
Additional context
No response
Code of Conduct
- I agree to follow this project's Code of Conduct and Contributing Guidelines
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the supplied Python example, starting at Simulation.build_meshes(..., hsize=0.3) and tracing the remesh_surface call and its MMGS settings. Determine how geometry or vessel size should influence hausd, hmin, and hmax, then verify that larger geometries produce proportionally larger elements without breaking the existing standard case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100