www.mooseframework.org
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
MortarSegmentInfo Struct Reference

Holds xi^(1), xi^(2), and other data for a given mortar segment. More...

#include <MortarSegmentInfo.h>

Public Member Functions

 MortarSegmentInfo ()
 Constructor. More...
 
 MortarSegmentInfo (Real x1a, Real x1b, Real x2a, Real x2b)
 Construct a MortarSegmentInfo object with the given xi values. More...
 
void print () const
 Prints xi values and secondary/primary Elem ids. More...
 
bool isValid () const
 Returns true if the current segment is valid, false otherwise. More...
 
bool hasPrimary () const
 Returns true if this segment has a valid primary, false otherwise. More...
 

Public Attributes

Real xi1_a
 
Real xi1_b
 
Real xi2_a
 
Real xi2_b
 
const Elemsecondary_elem
 
const Elemprimary_elem
 

Static Public Attributes

static const Real invalid_xi = 99
 

Detailed Description

Holds xi^(1), xi^(2), and other data for a given mortar segment.

Definition at line 31 of file MortarSegmentInfo.h.

Constructor & Destructor Documentation

◆ MortarSegmentInfo() [1/2]

MortarSegmentInfo::MortarSegmentInfo ( )

Constructor.

The invalid_xi value means that the values have not been set. Valid values are in [-1,1]. xi1 values should always be valid for any segment, but one or both xi2 values can be uninitialized when the surfaces are not in contact.

Definition at line 20 of file MortarSegmentInfo.C.

21  : xi1_a(invalid_xi),
25  secondary_elem(nullptr),
26  primary_elem(nullptr)
27 {
28 }
static const Real invalid_xi
const Elem * primary_elem
const Elem * secondary_elem

◆ MortarSegmentInfo() [2/2]

MortarSegmentInfo::MortarSegmentInfo ( Real  x1a,
Real  x1b,
Real  x2a,
Real  x2b 
)

Construct a MortarSegmentInfo object with the given xi values.

Definition at line 30 of file MortarSegmentInfo.C.

31  : xi1_a(x1a), xi1_b(x1b), xi2_a(x2a), xi2_b(x2b), secondary_elem(nullptr), primary_elem(nullptr)
32 {
33 }
const Elem * primary_elem
const Elem * secondary_elem

Member Function Documentation

◆ hasPrimary()

bool MortarSegmentInfo::hasPrimary ( ) const

Returns true if this segment has a valid primary, false otherwise.

◆ isValid()

bool MortarSegmentInfo::isValid ( ) const

Returns true if the current segment is valid, false otherwise.

The segment can be "invalid" for a host of different reasons, see the list below.

Definition at line 47 of file MortarSegmentInfo.C.

48 {
49  bool b1 = (std::abs(xi1_a) < 1. + TOLERANCE) && (std::abs(xi1_b) < 1. + TOLERANCE);
50  bool b2 = (std::abs(xi2_a) < 1. + TOLERANCE) && (std::abs(xi2_b) < 1. + TOLERANCE);
51 
52  bool xi2a_unset = (std::abs(xi2_a - invalid_xi) < TOLERANCE);
53  bool xi2b_unset = (std::abs(xi2_b - invalid_xi) < TOLERANCE);
54 
55  bool xi2_set = !xi2a_unset && !xi2b_unset;
56 
57  // Both xi^(1) values must be set to have a valid segment.
58  if (!b1)
59  {
60  mooseError("xi1_a = ", xi1_a, ", xi1_b = ", xi1_b, ", one or both xi^(1) values were not set.");
61  return false;
62  }
63 
64  // We don't allow really short segments (this probably means
65  // something got screwed up and both xi^(1) values got the same
66  // value).
67  if (std::abs(xi1_a - xi1_b) < TOLERANCE)
68  {
69  mooseError("xi^(1) values too close together.");
70  return false;
71  }
72 
73  // Must have a valid secondary Elem to have a valid segment.
74  if (secondary_elem == nullptr)
75  {
76  mooseError("Secondary Elem was not set.");
77  return false;
78  }
79 
80  // Either *both* xi^(2) values should be unset or *neither* should be. Anything else is invalid.
81  if ((xi2a_unset && !xi2b_unset) || (!xi2a_unset && xi2b_unset))
82  {
83  mooseError("One xi^(2) value was set, the other was not set.");
84  return false;
85  }
86 
87  // If both xi^(2) values are unset, then primary_elem should be NULL.
88  if (!xi2_set && primary_elem != nullptr)
89  {
90  mooseError("Both xi^(2) are unset, therefore primary_elem should be NULL.");
91  return false;
92  }
93 
94  // On the other hand, if both xi^(2) values are unset, then make sure primary_elem is non-NULL.
95  if (xi2_set && primary_elem == nullptr)
96  {
97  mooseError("Both xi^(2) are set, the primary_elem cannot be NULL.");
98  return false;
99  }
100 
101  // If the xi^(2) values are valid, make sure they don't correspond
102  // to a really short segment, which probably means they got
103  // assigned the same value by accident.
104  if (xi2_set && (std::abs(xi2_a - xi2_b) < TOLERANCE))
105  {
106  mooseError("xi^(2) are too close together.");
107  return false;
108  }
109 
110  // If both xi^(2) values are set, they should be in the range.
111  if (xi2_set && !b2)
112  {
113  mooseError("xi^(2) are set, but they are not in the range [-1,1].");
114  return false;
115  }
116 
117  // If we made it here, we're valid.
118  return true;
119 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:284
static const Real invalid_xi
ADRealEigenVector< T, D, asd > abs(const ADRealEigenVector< T, D, asd > &)
const Elem * primary_elem
const Elem * secondary_elem

◆ print()

void MortarSegmentInfo::print ( ) const

Prints xi values and secondary/primary Elem ids.

Definition at line 36 of file MortarSegmentInfo.C.

37 {
38  Moose::out << "xi^(1)_a=" << xi1_a << ", xi^(1)_b=" << xi1_b << std::endl;
39  Moose::out << "xi^(2)_a=" << xi2_a << ", xi^(2)_b=" << xi2_b << std::endl;
40  if (secondary_elem)
41  Moose::out << "secondary_elem=" << secondary_elem->id() << std::endl;
42  if (primary_elem)
43  Moose::out << "primary_elem=" << primary_elem->id() << std::endl;
44 }
const Elem * primary_elem
dof_id_type id() const
const Elem * secondary_elem

Member Data Documentation

◆ invalid_xi

const Real MortarSegmentInfo::invalid_xi = 99
static

◆ primary_elem

const Elem* MortarSegmentInfo::primary_elem

◆ secondary_elem

const Elem* MortarSegmentInfo::secondary_elem

◆ xi1_a

Real MortarSegmentInfo::xi1_a

◆ xi1_b

Real MortarSegmentInfo::xi1_b

◆ xi2_a

Real MortarSegmentInfo::xi2_a

◆ xi2_b

Real MortarSegmentInfo::xi2_b

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