Skip to content

Commit

Permalink
Address Ben's review
Browse files Browse the repository at this point in the history
  • Loading branch information
recuero committed Jun 8, 2023
1 parent e55405d commit 3333816
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 27 deletions.
9 changes: 5 additions & 4 deletions modules/contact/doc/content/source/actions/ContactAction.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ See the page documenting the syntax for that block for a description, example us

For node-to-segment mechanical contact, the action offers the possibility to automatically set up
mechanical contact pairs given a maximum distance between contacting boundary centroids.
To use that option, the user must set `automatic_pairing_method = CENTROID`.
The user can leverage this capability by providing `automatic_pairing_distance` and
`automatic_pairing_boundaries`. This is particularly useful when many feasible contact
interactions can take place in a periodically repeating pattern.

Alternatively, also for
node-to-segment, the user can choose to select a computation of proximity based on nodal
locations. In essence, for all boundaries provided by the user in `automatic_pairing_boundaries`,
the action will search for all nodes whose distance is less than `automatic_pairing_distance`. If so,
each nodal pair distance from different boundaries less than the `automatic_pairing_distance` distance
will create a contact pair. Repeated contact pairs are automatically eliminated. In order to
the action will search for all nodes whose distance is less than `automatic_pairing_distance`.
If so, each nodal pair distance from different boundaries less than the `automatic_pairing_distance`
distance will create a contact pair. Repeated contact pairs are automatically eliminated. In order to
activate this feature, in addition to `automatic_pairing_boundaries` and `automatic_pairing_distance`, the
user needs to set the boolean `automatic_pairing_node_proximity=true`.
user needs to set the input parameter `automatic_pairing_method = NODE`.
14 changes: 13 additions & 1 deletion modules/contact/include/actions/ContactAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ enum class ContactModel
{
FRICTIONLESS,
GLUED,
COULOMB,
COULOMB
};

enum class ContactFormulation
Expand All @@ -31,6 +31,12 @@ enum class ContactFormulation
MORTAR_PENALTY
};

enum class ProximityMethod
{
NODE,
CENTROID
};

/**
* Action class for creating constraints, kernels, and user objects necessary for mechanical
* contact.
Expand Down Expand Up @@ -71,6 +77,12 @@ class ContactAction : public Action
*/
static MooseEnum getSmoothingEnum();

/**
* Get proximity method for automatic pairing
* @return enum
*/
static MooseEnum getProximityMethod();

/**
* Define parameters used by multiple contact objects
* @return InputParameters object populated with common parameters
Expand Down
27 changes: 20 additions & 7 deletions modules/contact/src/actions/ContactAction.C
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ ContactAction::validParams()
"'automatic_pairing_boundaries' parameter can be to generate a contact pair automatically. "
"Due to numerical error in the determination of the centroids, it is encouraged that "
"the user adds a tolerance to this distance (e.g. extra 10%) to make sure no suitable "
"contact pair is missed. If the 'automatic_pairing_node_proximity' option is chosen to be "
"true instead, this distance is recommended to be set to twice the minimum distance between "
"contact pair is missed. If the 'automatic_pairing_method = NODE' option is chosen instead, "
"this distance is recommended to be set to at least twice the minimum distance between "
"nodes of boundaries to be paired.");
params.addDeprecatedParam<MeshGeneratorName>(
"mesh",
Expand Down Expand Up @@ -187,9 +187,9 @@ ContactAction::validParams()
true,
"Whether to generate the mortar mesh from the action. Typically this will be the case, but "
"one may also want to reuse an existing lower-dimensional mesh prior to a restart.");
params.addParam<bool>("automatic_pairing_node_proximity",
false,
"Whether to generate automatic pairing using nodal proximity.");
params.addParam<MooseEnum>("automatic_pairing_method",
ContactAction::getProximityMethod(),
"The proximity method used for automatic pairing of boundaries.");
params.addParam<bool>(
"mortar_dynamics",
false,
Expand Down Expand Up @@ -231,6 +231,11 @@ ContactAction::ContactAction(const InputParameters & params)
"For automatic selection of contact pairs (for particular geometries) in contact "
"action, 'automatic_pairing_distance' needs to be provided.");

if (_automatic_pairing_boundaries.size() > 0 && !isParamValid("automatic_pairing_method"))
paramError("automatic_pairing_distance",
"For automatic selection of contact pairs (for particular geometries) in contact "
"action, 'automatic_pairing_method' needs to be provided.");

if (_automatic_pairing_boundaries.size() > 0 && _boundary_pairs.size() != 0)
paramError("automatic_pairing_boundaries",
"If a boundary list is provided, primary and secondary surfaces will be identified "
Expand Down Expand Up @@ -990,9 +995,11 @@ ContactAction::addNodeFaceContact()
{
if (_current_task == "post_mesh_prepared" && _automatic_pairing_boundaries.size() > 0)
{
if (getParam<bool>("automatic_pairing_node_proximity"))
if (getParam<MooseEnum>("automatic_pairing_method").getEnum<ProximityMethod>() ==
ProximityMethod::NODE)
createSidesetsFromNodeProximity();
else
else if (getParam<MooseEnum>("automatic_pairing_method").getEnum<ProximityMethod>() ==
ProximityMethod::CENTROID)
createSidesetPairsFromGeometry();
}

Expand Down Expand Up @@ -1333,6 +1340,12 @@ ContactAction::getModelEnum()
return MooseEnum("frictionless glued coulomb", "frictionless");
}

MooseEnum
ContactAction::getProximityMethod()
{
return MooseEnum("node centroid");
}

MooseEnum
ContactAction::getFormulationEnum()
{
Expand Down
29 changes: 14 additions & 15 deletions modules/contact/test/tests/multiple_contact_pairs/tests
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@
input = 'three_hexagons_coarse.i'
exodiff = 'three_hexagons_coarse_automatic_pair_reference_out.e'
cli_args = "Postprocessors/active='' Contact/contact_pressure/secondary='102 102 201' "
"Contact/contact_pressure/primary='201 301 301' "
"Outputs/hide=penetration "
"Contact/contact_pressure/primary='201 301 301' Outputs/hide=penetration "
"Outputs/file_base=three_hexagons_coarse_automatic_pair_reference_out"
requirement = 'The system shall assign and accumulate a single contact pressure auxiliary '
'variable for all contact pairs supplied to a single contact action object with a '
Expand All @@ -79,7 +78,7 @@
input = 'three_hexagons_coarse_automatic_pair.i'
exodiff = 'three_hexagons_coarse_automatic_pair_out.e'
cli_args = "Contact/contact_pressure/automatic_pairing_boundaries='102 201 301' "
"Outputs/hide=penetration "
"Contact/contact_pressure/automatic_pairing_method='CENTROID' Outputs/hide=penetration "
"Postprocessors/active=''"
requirement = 'The system shall be able to, if the user provides a reference distance, assign '
'primary-secondary contact pairs automatically.'
Expand All @@ -93,7 +92,7 @@
input = 'three_hexagons_coarse_automatic_pair.i'
exodiff = 'three_hexagons_coarse_automatic_pair_node_proximity_out.e'
cli_args = "Contact/contact_pressure/automatic_pairing_boundaries='102 201 301' "
"Contact/contact_pressure/automatic_pairing_node_proximity=true "
"Contact/contact_pressure/automatic_pairing_method=NODE "
"Contact/contact_pressure/automatic_pairing_distance=0.002001 "
"Outputs/file_base=three_hexagons_coarse_automatic_pair_node_proximity_out "
"Outputs/hide=penetration"
Expand All @@ -110,12 +109,12 @@
input = 'three_hexagons_coarse_automatic_pair.i'
exodiff = 'three_hexagons_coarse_automatic_pair_node_proximity_small_distance_out.e'
cli_args = "Contact/contact_pressure/automatic_pairing_boundaries='102 201 301' "
"Contact/contact_pressure/automatic_pairing_node_proximity=true "
"Contact/contact_pressure/automatic_pairing_method=NODE "
"Contact/contact_pressure/automatic_pairing_distance=0.0013 "
"Outputs/file_base=three_hexagons_coarse_automatic_pair_node_proximity_small_distance_out "
"Outputs/hide=penetration"
requirement = 'The system shall be able to, if the user provides a too-small reference distance, avoid assigning '
'primary-secondary contact pairs using proximity between nodes.'
"Outputs/file_base=three_hexagons_coarse_automatic_pair_node_proximity_small_distance_"
"out Outputs/hide=penetration"
requirement = 'The system shall be able to, if the user provides a too-small reference distance, '
'avoid assigning primary-secondary contact pairs using proximity between nodes.'
abs_zero = 1.0e-4
rel_err = 1.0e-4
allow_warnings = true
Expand All @@ -126,13 +125,13 @@
input = 'three_hexagons_coarse_automatic_pair.i'
exodiff = 'three_hexagons_coarse_automatic_pair_node_proximity_large_distance_out.e'
cli_args = "Contact/contact_pressure/automatic_pairing_boundaries='102 201 301' "
"Contact/contact_pressure/automatic_pairing_node_proximity=true "
"Contact/contact_pressure/automatic_pairing_method=NODE "
"Contact/contact_pressure/automatic_pairing_distance=4.0 "
"Outputs/file_base=three_hexagons_coarse_automatic_pair_node_proximity_large_distance_out "
"Outputs/hide=penetration"
requirement = 'The system shall be able to, if the user provides a very large reference distance, assign '
'primary-secondary contact pairs automatically using proximity between nodes that '
'belong to arbitrary boundaries.'
"Outputs/file_base=three_hexagons_coarse_automatic_pair_node_proximity_large_distance_"
"out Outputs/hide=penetration"
requirement = 'The system shall be able to, if the user provides a very large reference '
'distance, assign primary-secondary contact pairs automatically using proximity '
'between nodes that belong to arbitrary boundaries.'
abs_zero = 1.0e-4
rel_err = 1.0e-4
allow_warnings = true
Expand Down

0 comments on commit 3333816

Please sign in to comment.