I am trying to implement inelastic contact between two faces that only partially overlap, here highlighted in blue and red:
Zooming out for context:
My code looks like this:
mpc = dolfinx_mpc.MultiPointConstraint(V)
for contact in boundary_conditions.get("contacts", []):
leader = contact["leader"]
follower = contact["follower"]
tolerance = contact.get("tolerance", 4e-1)
mpc.create_contact_inelastic_condition(
facet_tags,
contact["follower"],
contact["leader"],
eps2=tolerance,
)
mpc.finalize()
This crashes with:
mpc.create_contact_inelastic_condition(
File "/opt/homebrew/anaconda3/envs/project-backend/lib/python3.10/site-packages/dolfinx_mpc/multipointconstraint.py", line 461, in create_contact_inelastic_condition
mpc_data = dolfinx_mpc.cpp.mpc.create_contact_inelastic_condition(
RuntimeError: No masters found on contact surface (when executed in serial). Please make sure that the surfaces are in contact, or increase the tolerance eps2.
I believe this error gets raised here in ContactConstraint.h
if (!blocks_wo_local_collision.empty())
{
throw std::runtime_error(
"No masters found on contact surface (when executed in serial). "
"Please make sure that the surfaces are in contact, or increase "
"the "
"tolerance eps2.");
}
As far as I understand this is the intended behavior, as the API currently requires that every single follower DOF can be matched to a leader DOF.
That leads to my ask:
Would you be willing to modify create_contact_inelastic_condition
to take in an additional argument that permits partial matching? It could be something like allow_unmatched=False
which, if set to True
, would only throw an error if none of the follower DOFs find a match. Or maybe it would cause the function to never fail regardless of how many DOFs matched, it would just return a count of num_matched, num_unmatched
. Or perhaps it could return some kind of index of which DOFs matched and which didn’t, like [True, True, False, ... False]
.
Alternatively
Is there some mechanism for determining just the DOFs that will match ahead of time, and passing in just those DOFs as the leader and follower DOFS?
I could try to match them on my own, apply a facet tag to the matching ones, and pass those in, but it would not be guaranteed to behave identically to dolfinx_mpc
’s implementation, so I am hesitant to approach it that way.