www.mooseframework.org
Public Member Functions | Protected Attributes | List of all members
ContactSplit Class Reference

Split-based preconditioner for contact problems. More...

#include <ContactSplit.h>

Inheritance diagram for ContactSplit:
[legend]

Public Member Functions

 ContactSplit (const InputParameters &params)
 
virtual void setup (const std::string &prefix="-") override
 

Protected Attributes

std::vector< std::string > _contact_master
 
std::vector< std::string > _contact_slave
 
std::vector< int > _contact_displaced
 
std::vector< std::string > _uncontact_master
 
std::vector< std::string > _uncontact_slave
 
std::vector< int > _uncontact_displaced
 
bool _include_all_contact_nodes
 

Detailed Description

Split-based preconditioner for contact problems.

Definition at line 24 of file ContactSplit.h.

Constructor & Destructor Documentation

◆ ContactSplit()

ContactSplit::ContactSplit ( const InputParameters &  params)

Definition at line 43 of file ContactSplit.C.

44  : Split(params),
45  _contact_master(getParam<std::vector<std::string>>("contact_master")),
46  _contact_slave(getParam<std::vector<std::string>>("contact_slave")),
47  _contact_displaced(getParam<std::vector<int>>("contact_displaced")),
48  _uncontact_master(getParam<std::vector<std::string>>("uncontact_master")),
49  _uncontact_slave(getParam<std::vector<std::string>>("uncontact_slave")),
50  _uncontact_displaced(getParam<std::vector<int>>("uncontact_displaced")),
51  _include_all_contact_nodes(getParam<bool>("include_all_contact_nodes"))
52 {
53  if (_contact_master.size() != _contact_slave.size())
54  {
55  std::ostringstream err;
56  err << "Master and slave contact lists must have matching sizes: " << _contact_master.size()
57  << " != " << _contact_slave.size();
58  mooseError(err.str());
59  }
60  if (_contact_displaced.size() && _contact_master.size() != _contact_displaced.size())
61  {
62  std::ostringstream err;
63  err << "Master and displaced contact lists must have matching sizes: " << _contact_master.size()
64  << " != " << _contact_displaced.size();
65  mooseError(err.str());
66  }
67  if (!_contact_displaced.size())
68  _contact_displaced.resize(_contact_master.size());
69 
70  if (_uncontact_master.size() != _uncontact_slave.size())
71  {
72  std::ostringstream err;
73  err << "Master and slave uncontact lists must have matching sizes: " << _uncontact_master.size()
74  << " != " << _uncontact_slave.size();
75  mooseError(err.str());
76  }
77  if (_uncontact_displaced.size() && _uncontact_master.size() != _uncontact_displaced.size())
78  {
79  std::ostringstream err;
80  err << "Master and displaced uncontact lists must have matching sizes: "
81  << _uncontact_master.size() << " != " << _uncontact_displaced.size();
82  mooseError(err.str());
83  }
84  if (!_uncontact_displaced.size())
86 }
std::vector< std::string > _contact_slave
Definition: ContactSplit.h:33
std::vector< std::string > _contact_master
Definition: ContactSplit.h:32
std::vector< std::string > _uncontact_master
Definition: ContactSplit.h:35
bool _include_all_contact_nodes
Definition: ContactSplit.h:38
std::vector< int > _uncontact_displaced
Definition: ContactSplit.h:37
std::vector< std::string > _uncontact_slave
Definition: ContactSplit.h:36
std::vector< int > _contact_displaced
Definition: ContactSplit.h:34

Member Function Documentation

◆ setup()

void ContactSplit::setup ( const std::string &  prefix = "-")
overridevirtual

Definition at line 89 of file ContactSplit.C.

90 {
91  // A reference to the PetscOptions
92  Moose::PetscSupport::PetscOptions & po = _fe_problem.getPetscOptions();
93  // prefix
94  std::string dmprefix = prefix + "dm_moose_", opt, val;
95 
96  // contacts options
97  if (_contact_master.size())
98  {
99  opt = dmprefix + "ncontacts";
100  {
101  std::ostringstream oval;
102  oval << _contact_master.size();
103  val = oval.str();
104  }
105  // push back PETSc options
106  if (val == "")
107  po.flags.push_back(opt);
108  else
109  {
110  po.inames.push_back(opt);
111  po.values.push_back(val);
112  }
113  for (unsigned int j = 0; j < _contact_master.size(); ++j)
114  {
115  std::ostringstream oopt;
116  oopt << dmprefix << "contact_" << j;
117  opt = oopt.str();
118  val = _contact_master[j] + "," + _contact_slave[j];
119  // push back PETSc options
120  if (val == "")
121  po.flags.push_back(opt);
122  else
123  {
124  po.inames.push_back(opt);
125  po.values.push_back(val);
126  }
127  if (_contact_displaced[j])
128  {
129  opt = opt + "_displaced";
130  val = "yes";
131  // push back PETSc options
132  if (val == "")
133  po.flags.push_back(opt);
134  else
135  {
136  po.inames.push_back(opt);
137  po.values.push_back(val);
138  }
139  }
140  }
141  }
142  // uncontacts options
143  if (_uncontact_master.size())
144  {
145  opt = dmprefix + "nuncontacts";
146  {
147  std::ostringstream oval;
148  oval << _uncontact_master.size();
149  val = oval.str();
150  }
151  // push back PETSc options
152  if (val == "")
153  po.flags.push_back(opt);
154  else
155  {
156  po.inames.push_back(opt);
157  po.values.push_back(val);
158  }
159  for (unsigned int j = 0; j < _uncontact_master.size(); ++j)
160  {
161  std::ostringstream oopt;
162  oopt << dmprefix << "uncontact_" << j;
163  opt = oopt.str();
164  val = _uncontact_master[j] + "," + _uncontact_slave[j];
165  // push back PETSc options
166  if (val == "")
167  po.flags.push_back(opt);
168  else
169  {
170  po.inames.push_back(opt);
171  po.values.push_back(val);
172  }
173  if (_uncontact_displaced[j])
174  {
175  opt = opt + "_displaced";
176  val = "yes";
177  // push back PETSc options
178  if (val == "")
179  po.flags.push_back(opt);
180  else
181  {
182  po.inames.push_back(opt);
183  po.values.push_back(val);
184  }
185  }
186  }
187  }
188 
189  // Whether to include all nodes on the contact surfaces
190  // into the contact subsolver
191  opt = dmprefix + "includeAllContactNodes";
193  val = "yes";
194  else
195  val = "no";
196  po.inames.push_back(opt);
197  po.values.push_back(val);
198  Split::setup(prefix);
199 }
std::vector< std::string > _contact_slave
Definition: ContactSplit.h:33
std::vector< std::string > _contact_master
Definition: ContactSplit.h:32
std::vector< std::string > _uncontact_master
Definition: ContactSplit.h:35
bool _include_all_contact_nodes
Definition: ContactSplit.h:38
std::vector< int > _uncontact_displaced
Definition: ContactSplit.h:37
std::vector< std::string > _uncontact_slave
Definition: ContactSplit.h:36
std::vector< int > _contact_displaced
Definition: ContactSplit.h:34

Member Data Documentation

◆ _contact_displaced

std::vector<int> ContactSplit::_contact_displaced
protected

Definition at line 34 of file ContactSplit.h.

Referenced by ContactSplit(), and setup().

◆ _contact_master

std::vector<std::string> ContactSplit::_contact_master
protected

Definition at line 32 of file ContactSplit.h.

Referenced by ContactSplit(), and setup().

◆ _contact_slave

std::vector<std::string> ContactSplit::_contact_slave
protected

Definition at line 33 of file ContactSplit.h.

Referenced by ContactSplit(), and setup().

◆ _include_all_contact_nodes

bool ContactSplit::_include_all_contact_nodes
protected

Definition at line 38 of file ContactSplit.h.

Referenced by setup().

◆ _uncontact_displaced

std::vector<int> ContactSplit::_uncontact_displaced
protected

Definition at line 37 of file ContactSplit.h.

Referenced by ContactSplit(), and setup().

◆ _uncontact_master

std::vector<std::string> ContactSplit::_uncontact_master
protected

Definition at line 35 of file ContactSplit.h.

Referenced by ContactSplit(), and setup().

◆ _uncontact_slave

std::vector<std::string> ContactSplit::_uncontact_slave
protected

Definition at line 36 of file ContactSplit.h.

Referenced by ContactSplit(), and setup().


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