move deletion of particles to pre_exchange method

deletion of particles requires a neighbor list rebuild and should always
be done in pre_exchange

force_reneighbor: 1 indicates that this fix might require neighbor list
rebuilds and adds the fix to a list that gets checked for that event
next_reneighbor: used in deciding whether or not to trigger rebuild in
the current time step
This commit is contained in:
danielque
2024-01-22 13:16:48 +01:00
parent 938258d714
commit 42263a1b8b
2 changed files with 13 additions and 0 deletions

View File

@ -148,6 +148,8 @@ FixCfdCouplingDeform::FixCfdCouplingDeform(LAMMPS *lmp, int narg, char **arg) :
vector_flag = 1;
size_vector = 3;
force_reneighbor = 1;
next_reneighbor = -1;
}
/* ---------------------------------------------------------------------- */
@ -202,6 +204,7 @@ int FixCfdCouplingDeform::setmask()
{
int mask = 0;
mask |= INITIAL_INTEGRATE;
mask |= PRE_EXCHANGE;
mask |= POST_FORCE;
return mask;
}
@ -266,6 +269,15 @@ void FixCfdCouplingDeform::initial_integrate(int)
// only delete group immediately after pull/push so that no latent heat is neglected
if (prev_time != fix_coupling_->latestpull("partDeformations")) return;
next_reneighbor = update->ntimestep;
}
/* ---------------------------------------------------------------------- */
void FixCfdCouplingDeform::pre_exchange()
{
if(next_reneighbor != update->ntimestep) return;
int *mask = atom->mask;
int nlocal = atom->nlocal;
int *type = atom->type;

View File

@ -41,6 +41,7 @@ class FixCfdCouplingDeform : public Fix {
int setmask();
void init();
void initial_integrate(int);
void pre_exchange();
void post_force(int);
double compute_vector(int n);