Smith  0.1
Smith is an implicit thermal structural mechanics simulation code.
Public Member Functions | Protected Member Functions | List of all members
smith::ContactData Class Reference

This class stores all ContactInteractions for a problem, calls Tribol functions that act on all contact interactions, and agglomerates fields that exist over different ContactInteractions. More...

#include <contact_data.hpp>

Public Member Functions

 ContactData (const mfem::ParMesh &mesh)
 The constructor. More...
 
 ~ContactData ()
 Destructor to finalize Tribol.
 
void addContactInteraction (int interaction_id, const std::set< int > &bdry_attr_surf1, const std::set< int > &bdry_attr_surf2, ContactOptions contact_opts)
 Add another contact interaction. More...
 
void updateGaps (int cycle, double time, double &dt, std::optional< std::reference_wrapper< const mfem::Vector >> u_shape=std::nullopt, std::optional< std::reference_wrapper< const mfem::Vector >> u=std::nullopt, bool eval_jacobian=false)
 Updates only the gap contributions associated with contact. More...
 
void update (int cycle, double time, double &dt, std::optional< std::reference_wrapper< const mfem::Vector >> u_shape=std::nullopt, std::optional< std::reference_wrapper< const mfem::Vector >> u=std::nullopt, std::optional< std::reference_wrapper< const mfem::Vector >> p=std::nullopt)
 Updates the positions, forces, and Jacobian contributions associated with contact. More...
 
void reset ()
 Resets the contact pressures to zero.
 
FiniteElementDual forces () const
 Get the contact constraint residual (i.e. nodal forces) from all contact interactions. More...
 
mfem::HypreParVector mergedPressures () const
 Returns pressures from all contact interactions on the contact surface true degrees of freedom. More...
 
mfem::HypreParVector mergedGaps (bool zero_inactive=false) const
 Returns nodal gaps from all contact interactions on the contact surface true degrees of freedom. More...
 
std::unique_ptr< mfem::BlockOperator > mergedJacobian () const
 Returns a 2x2 block Jacobian on displacement/pressure true degrees of freedom from contact constraints. More...
 
void residualFunction (const mfem::Vector &u_shape, const mfem::Vector &u, mfem::Vector &r)
 Computes the residual including contact terms. More...
 
std::unique_ptr< mfem::BlockOperator > jacobianFunction (std::unique_ptr< mfem::HypreParMatrix > orig_J) const
 Computes the Jacobian including contact terms, given the non-contact Jacobian terms. More...
 
std::unique_ptr< mfem::HypreParMatrix > contactSubspaceTransferOperator ()
 Computes the subspace transfer operator. More...
 
bool haveContactInteractions () const
 Have there been contact interactions added? More...
 
bool haveLagrangeMultipliers () const
 Are any contact interactions enforced using Lagrange multipliers? More...
 
int numPressureDofs () const
 Get the number of Lagrange multiplier true degrees of freedom. More...
 

Protected Member Functions

void setPressures (const mfem::Vector &merged_pressures) const
 Set the pressure field. More...
 
void setDisplacements (const mfem::Vector &u_shape, const mfem::Vector &u)
 Update the current coordinates based on the new displacement field. More...
 

Detailed Description

This class stores all ContactInteractions for a problem, calls Tribol functions that act on all contact interactions, and agglomerates fields that exist over different ContactInteractions.

Definition at line 49 of file contact_data.hpp.

Constructor & Destructor Documentation

◆ ContactData()

smith::ContactData::ContactData ( const mfem::ParMesh &  mesh)

The constructor.

Parameters
meshThe volume mesh for the problem

Definition at line 455 of file contact_data.cpp.

Member Function Documentation

◆ addContactInteraction()

void smith::ContactData::addContactInteraction ( int  interaction_id,
const std::set< int > &  bdry_attr_surf1,
const std::set< int > &  bdry_attr_surf2,
ContactOptions  contact_opts 
)

Add another contact interaction.

Parameters
interaction_idUnique identifier for the ContactInteraction (used in Tribol)
bdry_attr_surf1MFEM boundary attributes for the first (mortar) surface
bdry_attr_surf2MFEM boundary attributes for the second (nonmortar) surface
contact_optsDefines contact method, enforcement, type, and penalty
Note
Interaction ids must be unique across the entire executable: Tribol uses interaction_id as the unique key for its coupling schemes, so reusing an id (even across different ContactData instances) is an error.

Definition at line 462 of file contact_data.cpp.

◆ contactSubspaceTransferOperator()

std::unique_ptr< mfem::HypreParMatrix > smith::ContactData::contactSubspaceTransferOperator ( )

Computes the subspace transfer operator.

Returns
Contact subspace transfer operator (mapping from contact_dofs to all displacement dofs)

Definition at line 530 of file contact_data.cpp.

◆ forces()

FiniteElementDual smith::ContactData::forces ( ) const

Get the contact constraint residual (i.e. nodal forces) from all contact interactions.

Returns
Nodal contact forces on the true DOFs
Precondition
update() must be called with the current configuration so the force contributions are up-to-date

Definition at line 484 of file contact_data.cpp.

◆ haveContactInteractions()

bool smith::ContactData::haveContactInteractions ( ) const
inline

Have there been contact interactions added?

Returns
true if contact interactions have been added
false if there are no contact interactions

Definition at line 198 of file contact_data.hpp.

◆ haveLagrangeMultipliers()

bool smith::ContactData::haveLagrangeMultipliers ( ) const
inline

Are any contact interactions enforced using Lagrange multipliers?

Returns
true: at least one contact interaction is using Lagrange multiplier enforcement
false: no contact interactions are using Lagrange multipliers

Definition at line 222 of file contact_data.hpp.

◆ jacobianFunction()

std::unique_ptr< mfem::BlockOperator > smith::ContactData::jacobianFunction ( std::unique_ptr< mfem::HypreParMatrix >  orig_J) const

Computes the Jacobian including contact terms, given the non-contact Jacobian terms.

Parameters
orig_JThe non-contact terms of the Jacobian, not including essential boundary conditions
Returns
Jacobian with contact terms, not including essential boundary conditions
Precondition
update() must be called with the current configuration so the Jacobian contributions are up-to-date

Definition at line 510 of file contact_data.cpp.

◆ mergedGaps()

mfem::HypreParVector smith::ContactData::mergedGaps ( bool  zero_inactive = false) const

Returns nodal gaps from all contact interactions on the contact surface true degrees of freedom.

The type of gap (normal or vector-valued) is set by the ContactType in the ContactOptions struct for the contact interaction. TiedNormal and Frictionless (the two type supported in Tribol) correspond to scalar gap normal. Only linear (order = 1) gap fields are supported.

Parameters
[in]zero_inactiveSets inactive t-dofs to zero gap
Returns
Nodal gap true degrees of freedom on each contact interaction (merged into one mfem::HypreParVector)
Precondition
update() must be called with the current configuration so the gap values are up-to-date

Definition at line 493 of file contact_data.cpp.

◆ mergedJacobian()

std::unique_ptr< mfem::BlockOperator > smith::ContactData::mergedJacobian ( ) const

Returns a 2x2 block Jacobian on displacement/pressure true degrees of freedom from contact constraints.

The element Jacobian contributions are computed upon calling update(). This method does MPI communication to move Jacobian contributions to the correct rank, then assembles the contributions. The pressure degrees of freedom for all contact interactions are merged into a single block.

Note
The blocks are owned by the BlockOperator
Returns
Pointer to block Jacobian (2x2 BlockOperator of HypreParMatrix)

Definition at line 498 of file contact_data.cpp.

◆ mergedPressures()

mfem::HypreParVector smith::ContactData::mergedPressures ( ) const

Returns pressures from all contact interactions on the contact surface true degrees of freedom.

The type of pressure (normal or vector-valued) is set by the ContactType in the ContactOptions struct for the contact interaction. TiedNormal and Frictionless (the two type supported in Tribol) correspond to scalar normal pressure. Only linear (order = 1) pressure fields are supported.

Returns
Pressure true degrees of freedom on each contact interaction (merged into one mfem::HypreParVector)

Definition at line 491 of file contact_data.cpp.

◆ numPressureDofs()

int smith::ContactData::numPressureDofs ( ) const
inline

Get the number of Lagrange multiplier true degrees of freedom.

Returns
Number of Lagrange multiplier true degrees of freedom

Definition at line 229 of file contact_data.hpp.

◆ residualFunction()

void smith::ContactData::residualFunction ( const mfem::Vector &  u_shape,
const mfem::Vector &  u,
mfem::Vector &  r 
)

Computes the residual including contact terms.

Parameters
[in]u_shapeShape displacement vector (size of [displacement] block)
[in]uSolution vector ([displacement; pressure] block vector)
[in,out]rResidual vector ([force; gap] block vector); takes in initialized residual force vector and adds contact contributions
Precondition
The current coordinates must be up-to-date
Note
This method calls update() to compute residual and Jacobian contributions based on the current configuration

Definition at line 505 of file contact_data.cpp.

◆ setDisplacements()

void smith::ContactData::setDisplacements ( const mfem::Vector &  u_shape,
const mfem::Vector &  u 
)
protected

Update the current coordinates based on the new displacement field.

Parameters
u_shapeShape displacement vector
uCurrent displacement dof values

Definition at line 525 of file contact_data.cpp.

◆ setPressures()

void smith::ContactData::setPressures ( const mfem::Vector &  merged_pressures) const
protected

Set the pressure field.

This sets Tribol's pressure degrees of freedom based on 1) the values in merged_pressure for Lagrange multiplier enforcement 2) the nodal gaps and penalty for penalty enforcement

Note
The nodal gaps must be up-to-date for penalty enforcement
Parameters
merged_pressuresCurrent pressure true dof values in a merged mfem::Vector

Definition at line 523 of file contact_data.cpp.

◆ update()

void smith::ContactData::update ( int  cycle,
double  time,
double &  dt,
std::optional< std::reference_wrapper< const mfem::Vector >>  u_shape = std::nullopt,
std::optional< std::reference_wrapper< const mfem::Vector >>  u = std::nullopt,
std::optional< std::reference_wrapper< const mfem::Vector >>  p = std::nullopt 
)

Updates the positions, forces, and Jacobian contributions associated with contact.

Parameters
cycleThe current simulation cycle
timeThe current time
dtThe timestep size to attempt
u_shapeOptional shape displacement vector
uOptional current displacement dof values
pOptional current pressure true dof values

Definition at line 477 of file contact_data.cpp.

◆ updateGaps()

void smith::ContactData::updateGaps ( int  cycle,
double  time,
double &  dt,
std::optional< std::reference_wrapper< const mfem::Vector >>  u_shape = std::nullopt,
std::optional< std::reference_wrapper< const mfem::Vector >>  u = std::nullopt,
bool  eval_jacobian = false 
)

Updates only the gap contributions associated with contact.

Parameters
cycleThe current simulation cycle
timeThe current time
dtThe timestep size to attempt
u_shapeOptional shape displacement vector
uOptional current displacement dof values
eval_jacobianWhether to also evaluate the Jacobian contributions (default false)

Definition at line 470 of file contact_data.cpp.


The documentation for this class was generated from the following files: