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 ( const InputParameters &  params)

Definition at line 46 of file ContactSplit.C.

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

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

Definition at line 92 of file ContactSplit.C.

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

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

Definition at line 34 of file ContactSplit.h.

Referenced by ContactSplit(), and setup().

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

Definition at line 32 of file ContactSplit.h.

Referenced by ContactSplit(), and setup().

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

Definition at line 33 of file ContactSplit.h.

Referenced by ContactSplit(), and setup().

bool ContactSplit::_include_all_contact_nodes
protected

Definition at line 38 of file ContactSplit.h.

Referenced by setup().

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

Definition at line 37 of file ContactSplit.h.

Referenced by ContactSplit(), and setup().

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

Definition at line 35 of file ContactSplit.h.

Referenced by ContactSplit(), and setup().

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: