Genesis icon indicating copy to clipboard operation
Genesis copied to clipboard

[Bug]: Mesh Explosion When Combining Myocardium and Blood in Scene

Open YaoHuanyu opened this issue 6 months ago • 0 comments
trafficstars

Bug Description

I'm experiencing an unusual "explosion" effect when adding both myocardium and blood meshes to the same scene. The components work fine individually, but when combined:

Myocardium mesh (red) shows explosive deformation Blood particles (green) appear normal The effect occurs immediately upon simulation start

Steps to Reproduce

Load myocardium mesh (left ventricle) Load blood mesh (left ventricular cavity) Add both to scene with respective materials Run simulation

The script triggering the bug

import genesis as gs
# Initialize settings
gs.init(seed=0, precision="32", logging_level="debug", backend=gs.gpu)
# Scene configuration
dt = 5e-4
scene = gs.Scene(
    sim_options=gs.options.SimOptions(
        substeps=10,
        gravity=(0, 0, 0),  # Disable gravity for cardiovascular simulation
        dt=dt,
    ),
    viewer_options=gs.options.ViewerOptions(
        camera_pos=(-0.5, 1., 0.8),
        camera_lookat=(0.0, 0.0, 0.5),
        camera_fov=40,
    ),
    sph_options=gs.options.SPHOptions(
        lower_bound=(-1.03, -1.03, -0.08),
        upper_bound=(1.03, 1.03, 1.0),
        particle_size=1e-2,
    ),
    mpm_options=gs.options.MPMOptions(
        dt=dt,
        lower_bound=(-1.5, -1.5, -0.08),
        upper_bound=(1.5, 1.5, 1.5),
    ),
    fem_options=gs.options.FEMOptions(
        dt=dt,
        damping=45.0,
    ),
    vis_options=gs.options.VisOptions(
        show_world_frame=True,
        visualize_sph_boundary=True,
        visualize_mpm_boundary=True,
    ),
)
# Material parameters
myocardium_params = {
    'E': 5e4,  # Young's modulus (Pa)
    'nu': 0.45,  # Poisson's ratio
    'rho': 1075.0,  # Density (kg/m^3)
    'model': "corotation",
    'sampler': 'pbs'
}
blood_params = {
    'rho': 1060.0,  # Blood density (kg/m^3)
    'stiffness': 1e4,
    'exponent': 4,
    'mu': 0.01,  # Viscosity (Pa·s)
    'gamma': 7.0,  # Surface tension
    'sampler': 'pbs'
}
# Create entities
# Left ventricular myocardium
heart_mesh = gs.morphs.Mesh(
    file="./LVmyocardium.obj",
    pos=(0.0, 0, 0.5),
    scale=0.001,
    decimate_aggressiveness=0,
)
myocardium_material = gs.materials.MPM.Muscle(**myocardium_params)
lv_myocardium = scene.add_entity(
    morph=heart_mesh,
    material=myocardium_material,
    surface=gs.surfaces.Default(color=(1, 0, 0, 0.9)),
)
# Left ventricular blood
lv_blood = scene.add_entity(
    morph=gs.morphs.Mesh(
        file="./LV.obj",
        pos=(0.0, 0, 0.5),
        scale=0.001,
    ),
    material=gs.materials.SPH.Liquid(**blood_params),
    surface=gs.surfaces.Default(
        color=(0.0, 0.9, 0.0, 0.8),
        vis_mode="particle",
    )
)
# Setup camera for recording
cam = scene.add_camera(
    pos=(-0.5, 1., 0.8),
    lookat=(0.0, 0.0, 0.5),
    fov=40,
    res=(1280, 720)
)
# Build and simulate
scene.build()
scene.reset()
cam.start_recording()
for i in range(200):
    scene.step()
    cam.render()
cam.stop_recording('cardiac_simulation.mp4')

Attached .obj files objs.zip

Expected Behavior

Realistic interaction between myocardium and blood, with:

Myocardium containing the blood Physically plausible deformation

Screenshots/Videos

https://github.com/user-attachments/assets/7a8e44bb-4e29-4b3c-a99d-5a0607570821

Relevant log output


Environment

  • OS: Ubuntu 22.04
  • GPU/CPU RTX A4000 / Intel(R) Core(TM) i9-10900K CPU @ 3.70GHZ
  • GPU-driver version (570.144)
  • CUDA / CUDA-toolkit version (12.4)

Release version or Commit ID

8ffd810d2f14bb91ad965ddbf285d96d794b857b

Additional Context

The myocardium mesh is properly repaired (checked with trimesh). The issue seems related to interaction between the two materials/solvers.

Could you please advise on:

  1. Proper setup for heart-blood interaction
  2. Potential causes of this explosion effect
  3. Recommended material parameters for cardiovascular simulation

Thank you for your help!

YaoHuanyu avatar May 07 '25 02:05 YaoHuanyu