yuanming-hu / taichi_mpm

High-performance moving least squares material point method (MLS-MPM) solver. (ACM Transactions on Graphics, SIGGRAPH 2018)
MIT License
2.34k stars 317 forks source link

Body swellings #38

Open durochat opened 4 years ago

durochat commented 4 years ago

Hi @yuanming-hu,

I'm trying to simulate the swelling of a rigid body, using a frame_update:

def frame_update(t, frame_dt):
    start_size = 0.56
    fact_swell = 1.08
    scale_curr = ((start_size + t * fact_swell) / L_adim,) * 3
    t_f = nt_swell * frame_dt

    if t <= t_f:
        mpm.add_particles(type='rigid',
                          scripted_position=tc.function13(position_body),
                          scripted_rotation=tc.function13(rotation_body),
                          scale=scale_curr,
                          delta_t=frame_dt,
                          codimensional=False,
                          mesh_fn=f_name_body)

The problem is that, for each scale of the body, I add particles but I can't remove them as I go along. So the particles accumulate, and there is a memory issue, that crashes the code at dt=12. Is there another way to swell a rigid body, or to remove particles (which follow a mesh) to free memory as the frame_update progresses?

Thank you very much for your help and this great code!

fengzekang commented 4 years ago

@durochat Hello, I am not good at your issue. But I want to ask help from you how to deal with the problem "No Module named 'dynamic' during installation. I just use command 'cmake ..' and 'make' in the build folder. But there is always the error. Thanks a lot. BTW, I am using mpm to do some simulation and I hope many discussion in the future.

durochat commented 4 years ago

@fengzekang please open a new issue corresponding to the problem you have.

durochat commented 4 years ago

Hi @yuanming-hu,

I'm trying to simulate the swelling of a rigid body, using a frame_update:

def frame_update(t, frame_dt):
    start_size = 0.56
    fact_swell = 1.08
    scale_curr = ((start_size + t * fact_swell) / L_adim,) * 3
    t_f = nt_swell * frame_dt

    if t <= t_f:
        mpm.add_particles(type='rigid',
                          scripted_position=tc.function13(position_body),
                          scripted_rotation=tc.function13(rotation_body),
                          scale=scale_curr,
                          delta_t=frame_dt,
                          codimensional=False,
                          mesh_fn=f_name_body)

The problem is that, for each scale of the body, I add particles but I can't remove them as I go along. So the particles accumulate, and there is a memory issue, that crashes the code at dt=12. Is there another way to swell a rigid body, or to remove particles (which follow a mesh) to free memory as the frame_update progresses?

Thank you very much for your help and this great code!