Commit d947f3d6 authored by Jonathan Lambrechts's avatar Jonathan Lambrechts
Browse files

save/restore Contacts

parent b277ec34
Pipeline #5651 passed with stage
in 2 minutes and 9 seconds
......@@ -360,6 +360,12 @@ class ParticleProblem :
self._lib.particleProblemSetUseQueue(self._p, c_int(use_queue))
def _save_contacts(self):
self._lib.particleProblemSaveContacts(self._p)
def _restore_contacts(self):
self._lib.particleProblemRestoreContacts(self._p)
def load_msh_boundaries(self, filename, tags, shift=None,material="default") :
"""Load the numerical domain and set the physical boundaries the particles cannot go through.
......
......@@ -31,7 +31,9 @@ def predictor_corrector_iterate(fluid, particles, dt, min_nsub=1, contact_tol=1e
fluid.implicit_euler(dt)
sf1 = np.copy(fluid.solution())
f0 = np.copy(fluid.compute_node_force(dt))
particles._save_contacts()
_advance_particles(particles,f0,dt,min_nsub,contact_tol)
particles._restore_contacts()
# Keep same contact forces and positions while giving to the fluid the predicted solid velocities to compute the correction
particles.position()[:,:] = pp0
particles.contact_forces()[:,:] = cp0
......
......@@ -1443,12 +1443,12 @@ int particleProblemNMaterial(const ParticleProblem *p) {
}
//todo improve
void saveContacts(ParticleProblem *p) {
void particleProblemSaveContacts(ParticleProblem *p) {
vectorFree(p->savedContacts);
p->savedContacts = vectorDup(p->contacts);
}
void restoreContacts(ParticleProblem *p) {
void particleProblemRestoreContacts(ParticleProblem *p) {
vectorFree(p->contacts);
p->contacts = p->savedContacts;
p->savedContacts = NULL;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment