add non-contact force with wall

Submitted by gelinhan on Thu, 12/14/2017 - 01:11

Hi,

I am trying to implement a non-contact force with walls in LIGGGHTS (e.g. lubrication force). I have noticed that in fix_wall_gran.cpp, deltan is used to calculate the overlap with wall and restricted to < 0. My plan is to use the deltan as the separation distance when it is > 0. The following are the relative codes in fix_wall_gran.cpp (from line 987 to 1009, I add my lines after that.) Is it feasible to do so?

if(deltan <= 0 || (radius && deltan < contactDistanceMultiplier*radius[iPart]))
{

if(!atom->shapetype_flag && fix_contact && ! fix_contact->handleContact(iPart,idTri,sidata.contact_history,intersectflag,7 == barysign)) continue;

if(vMeshC && !atom->shapetype_flag)
{
for(int i = 0; i < 3; i++)
v_wall[i] = (bary[0]*vMesh[iTri][0][i] + bary[1]*vMesh[iTri][1][i] + bary[2]*vMesh[iTri][2][i]);
}

if(!sidata.is_non_spherical || atom->superquadric_flag)
sidata.deltan = -deltan;
sidata.delta[0] = -delta[0];
sidata.delta[1] = -delta[1];
sidata.delta[2] = -delta[2];
if(impl)
impl->compute_force(this, sidata, intersectflag,v_wall,FixMesh_list_[iMesh],iMesh,mesh,iTri);
else
{
sidata.r = r0_ - sidata.deltan;
compute_force(sidata, v_wall); // LEGACY CODE (SPH)
}
}

/==========my lines=============/
else if (deltan > 0) {

if(!atom->shapetype_flag && fix_contact && ! fix_contact->handleContact(iPart,idTri,sidata.contact_history,intersectflag,7 == barysign)) continue;

if(vMeshC && !atom->shapetype_flag)
{
for(int i = 0; i < 3; i++)
v_wall[i] = (bary[0]*vMesh[iTri][0][i] + bary[1]*vMesh[iTri][1][i] + bary[2]*vMesh[iTri][2][i]);
}

sidata.deltan = deltan;
sidata.delta[0] = -delta[0];
sidata.delta[1] = -delta[1];
sidata.delta[2] = -delta[2];
intersectflag = false;
if(impl)
impl->compute_force(this, sidata, intersectflag,v_wall,FixMesh_list_[iMesh],iMesh,mesh,iTri);
}

Regards,
Linhan

Daniel Queteschiner | Thu, 12/14/2017 - 09:56

There is no need for this modification, just set contactDistanceMultiplier appropriately (via neigh_modify contact_distance_factor in the input script, see manual) and the condition
deltan < contactDistanceMultiplier*radius[iPart]
will take care of non-contact cases up to the resulting distance.
Just make sure that your contact model implements surfacesClose correctly.

gelinhan | Thu, 12/14/2017 - 12:05

Thank you so much for the hint.

Cheers,
Linhan

arnom's picture

arnom | Thu, 12/14/2017 - 12:21

I strongly suggest that you do not use the neigh_modify command as this can cause unwanted side effects. A cleaner solution is to use
neighbor->register_contact_dist_factor(your_contact_distance_factor);

You can see an example in cohesion_model_easo_capillary_viscous.h.

DCS team member & LIGGGHTS(R) core developer