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

#include <ThermalContactAction.h>

Inheritance diagram for ThermalContactAction:
[legend]

Public Member Functions

 ThermalContactAction (const InputParameters &params)
 
virtual void act () override
 

Protected Member Functions

virtual void addAuxKernels ()
 
virtual void addAuxVariables ()
 
virtual void addBCs ()
 
virtual void addDiracKernels ()
 
virtual void addMaterials ()
 
virtual void addSlaveFluxVector ()
 

Protected Attributes

const bool _quadrature
 
const MooseEnum _order
 
const AuxVariableName _penetration_var_name
 
const AuxVariableName _gap_value_name
 
const AuxVariableName _gap_conductivity_name
 

Detailed Description

Definition at line 16 of file ThermalContactAction.h.

Constructor & Destructor Documentation

◆ ThermalContactAction()

ThermalContactAction::ThermalContactAction ( const InputParameters &  params)

Definition at line 92 of file ThermalContactAction.C.

93  : Action(params),
94  _quadrature(getParam<bool>("quadrature")),
95  _order(getParam<MooseEnum>("order")),
96  _penetration_var_name(_quadrature ? "qpoint_penetration" : "penetration"),
97  _gap_value_name("paired_" + getParam<NonlinearVariableName>("variable")),
98  _gap_conductivity_name("paired_k_" + getParam<NonlinearVariableName>("variable"))
99 {
100 }
const AuxVariableName _gap_value_name
const AuxVariableName _gap_conductivity_name
const AuxVariableName _penetration_var_name

Member Function Documentation

◆ act()

void ThermalContactAction::act ( )
overridevirtual

Definition at line 103 of file ThermalContactAction.C.

104 {
105  if (_current_task == "add_aux_kernel")
106  addAuxKernels();
107  else if (_current_task == "add_aux_variable")
108  addAuxVariables();
109  else if (_current_task == "add_bc")
110  addBCs();
111  else if (_current_task == "add_dirac_kernel")
112  addDiracKernels();
113  else if (_current_task == "add_material")
114  addMaterials();
115  else if (_current_task == "add_slave_flux_vector")
117 }
virtual void addAuxVariables()
virtual void addSlaveFluxVector()
virtual void addDiracKernels()

◆ addAuxKernels()

void ThermalContactAction::addAuxKernels ( )
protectedvirtual

Definition at line 120 of file ThermalContactAction.C.

Referenced by act().

121 {
122  // Add gap aux kernel
123  {
124  InputParameters params = _factory.getValidParams(getParam<std::string>("gap_aux_type"));
125 
126  params.applySpecificParameters(parameters(),
127  {"tangential_tolerance",
128  "normal_smoothing_distance",
129  "normal_smoothing_method",
130  "order",
131  "warnings"});
132  params.set<AuxVariableName>("variable") = _gap_value_name;
133  params.set<ExecFlagEnum>("execute_on", true) = {EXEC_INITIAL, EXEC_LINEAR};
134  params.set<std::vector<BoundaryName>>("boundary") = {getParam<BoundaryName>("slave")};
135  params.set<BoundaryName>("paired_boundary") = getParam<BoundaryName>("master");
136  params.set<VariableName>("paired_variable") = getParam<NonlinearVariableName>("variable");
137 
138  _problem->addAuxKernel(getParam<std::string>("gap_aux_type"), "gap_value_" + name(), params);
139 
140  if (_quadrature)
141  {
142  params.set<std::vector<BoundaryName>>("boundary") = {getParam<BoundaryName>("master")};
143  params.set<BoundaryName>("paired_boundary") = getParam<BoundaryName>("slave");
144 
145  _problem->addAuxKernel(
146  getParam<std::string>("gap_aux_type"), "gap_value_master_" + name(), params);
147  }
148  }
149 
150  // Add penetration aux kernel
151  {
152  InputParameters params = _factory.getValidParams("PenetrationAux");
153 
154  params.applySpecificParameters(
155  parameters(),
156  {"tangential_tolerance", "normal_smoothing_distance", "normal_smoothing_method", "order"});
157  params.set<AuxVariableName>("variable") = _penetration_var_name;
158  params.set<ExecFlagEnum>("execute_on", true) = {EXEC_INITIAL, EXEC_LINEAR};
159  params.set<std::vector<BoundaryName>>("boundary") = {getParam<BoundaryName>("slave")};
160  params.set<BoundaryName>("paired_boundary") = getParam<BoundaryName>("master");
161 
162  _problem->addAuxKernel("PenetrationAux", "penetration_" + name(), params);
163  }
164 }
const std::string name
Definition: Setup.h:21
const AuxVariableName _gap_value_name
const AuxVariableName _penetration_var_name

◆ addAuxVariables()

void ThermalContactAction::addAuxVariables ( )
protectedvirtual

Definition at line 167 of file ThermalContactAction.C.

Referenced by act().

168 {
169  // We need to add variables only once per variable name. However, we don't know how many unique
170  // variable names we will have. So, we'll always add them.
171 
172  MooseEnum order = getParam<MooseEnum>("order");
173  std::string family = "LAGRANGE";
174 
175  if (_quadrature)
176  {
177  order = "CONSTANT";
178  family = "MONOMIAL";
179  }
180 
181  _problem->addAuxVariable(_penetration_var_name,
182  FEType(order, Utility::string_to_enum<FEFamily>(family)));
183 
184  _problem->addAuxVariable(_gap_value_name,
185  FEType(order, Utility::string_to_enum<FEFamily>(family)));
186 }
const AuxVariableName _gap_value_name
const AuxVariableName _penetration_var_name

◆ addBCs()

void ThermalContactAction::addBCs ( )
protectedvirtual

Definition at line 189 of file ThermalContactAction.C.

Referenced by act().

190 {
191  const std::string object_name = getParam<std::string>("type");
192  InputParameters params = _factory.getValidParams(object_name);
193  params.applyParameters(parameters());
194 
195  if (_quadrature)
196  {
197  params.set<BoundaryName>("paired_boundary") = getParam<BoundaryName>("master");
198  params.set<bool>("use_displaced_mesh") = true;
199  }
200  else
201  {
202  params.set<std::vector<VariableName>>("gap_distance") = {"penetration"};
203  params.set<std::vector<VariableName>>("gap_temp") = {_gap_value_name};
204  }
205 
206  params.set<std::vector<BoundaryName>>("boundary") = {getParam<BoundaryName>("slave")};
207 
208  _problem->addBoundaryCondition(object_name, "gap_bc_" + name(), params);
209 
210  if (_quadrature)
211  {
212  // Swap master and slave for this one
213  params.set<std::vector<BoundaryName>>("boundary") = {getParam<BoundaryName>("master")};
214  params.set<BoundaryName>("paired_boundary") = getParam<BoundaryName>("slave");
215 
216  _problem->addBoundaryCondition(object_name, "gap_bc_master_" + name(), params);
217  }
218 }
const std::string name
Definition: Setup.h:21
const AuxVariableName _gap_value_name

◆ addDiracKernels()

void ThermalContactAction::addDiracKernels ( )
protectedvirtual

Definition at line 221 of file ThermalContactAction.C.

Referenced by act().

222 {
223  if (_quadrature)
224  return;
225 
226  const std::string object_name = "GapHeatPointSourceMaster";
227  InputParameters params = _factory.getValidParams(object_name);
228  params.applySpecificParameters(parameters(),
229  {"tangential_tolerance",
230  "normal_smoothing_distance",
231  "normal_smoothing_method",
232  "order",
233  "slave",
234  "variable"});
235  params.set<BoundaryName>("boundary") = getParam<BoundaryName>("master");
236 
237  _problem->addDiracKernel(object_name, object_name + "_" + name(), params);
238 }
const std::string name
Definition: Setup.h:21

◆ addMaterials()

void ThermalContactAction::addMaterials ( )
protectedvirtual

Definition at line 241 of file ThermalContactAction.C.

Referenced by act().

242 {
243  if (getParam<std::string>("type") != "GapHeatTransfer")
244  return;
245 
246  if (parameters().isParamSetByUser("gap_conductance"))
247  {
248  if (parameters().isParamSetByUser("gap_conductivity") ||
249  parameters().isParamSetByUser("gap_conductivity_function"))
250  mooseError(
251  "Cannot specify both gap_conductance and gap_conductivity or gap_conductivity_function");
252 
253  const std::string object_type = "GapConductanceConstant";
254  InputParameters params = _factory.getValidParams(object_type);
255  params.applyParameters(parameters());
256  params.set<std::vector<BoundaryName>>("boundary") = {getParam<BoundaryName>("slave")};
257  _problem->addMaterial(object_type, name() + "_" + "gap_value", params);
258 
259  if (_quadrature)
260  {
261  params.set<std::vector<BoundaryName>>("boundary") = {getParam<BoundaryName>("master")};
262  _problem->addMaterial(object_type, name() + "_" + "gap_value_master", params);
263  }
264  }
265  else
266  {
267  const std::string object_type = "GapConductance";
268 
269  InputParameters params = _factory.getValidParams(object_type);
270  params.applyParameters(parameters(), {"variable"});
271 
272  params.set<std::vector<VariableName>>("variable") = {
273  getParam<NonlinearVariableName>("variable")};
274  params.set<std::vector<BoundaryName>>("boundary") = {getParam<BoundaryName>("slave")};
275 
276  if (_quadrature)
277  {
278  params.set<BoundaryName>("paired_boundary") = getParam<BoundaryName>("master");
279  }
280  else
281  {
282  params.set<std::vector<VariableName>>("gap_temp") = {_gap_value_name};
283  params.set<std::vector<VariableName>>("gap_distance") = {"penetration"};
284  }
285 
286  _problem->addMaterial(object_type, name() + "_" + "gap_value", params);
287 
288  if (_quadrature)
289  {
290  params.set<BoundaryName>("paired_boundary") = getParam<BoundaryName>("slave");
291  params.set<std::vector<BoundaryName>>("boundary") = {getParam<BoundaryName>("master")};
292 
293  _problem->addMaterial(object_type, name() + "_" + "gap_value_master", params);
294  }
295  }
296 }
const std::string name
Definition: Setup.h:21
const AuxVariableName _gap_value_name

◆ addSlaveFluxVector()

void ThermalContactAction::addSlaveFluxVector ( )
protectedvirtual

Definition at line 299 of file ThermalContactAction.C.

Referenced by act().

300 {
301  _problem->getNonlinearSystemBase().addVector("slave_flux", false, GHOSTED);
302  _problem->getNonlinearSystemBase().zeroVectorForResidual("slave_flux");
303 
304  // It is risky to apply this optimization to contact problems
305  // since the problem configuration may be changed during Jacobian
306  // evaluation. We therefore turn it off for all contact problems so that
307  // PETSc-3.8.4 or higher will have the same behavior as PETSc-3.8.3 or older.
308  if (!_problem->isSNESMFReuseBaseSetbyUser())
309  _problem->setSNESMFReuseBase(false, false);
310 }

Member Data Documentation

◆ _gap_conductivity_name

const AuxVariableName ThermalContactAction::_gap_conductivity_name
protected

Definition at line 34 of file ThermalContactAction.h.

◆ _gap_value_name

const AuxVariableName ThermalContactAction::_gap_value_name
protected

Definition at line 33 of file ThermalContactAction.h.

Referenced by addAuxKernels(), addAuxVariables(), addBCs(), and addMaterials().

◆ _order

const MooseEnum ThermalContactAction::_order
protected

Definition at line 31 of file ThermalContactAction.h.

◆ _penetration_var_name

const AuxVariableName ThermalContactAction::_penetration_var_name
protected

Definition at line 32 of file ThermalContactAction.h.

Referenced by addAuxKernels(), and addAuxVariables().

◆ _quadrature

const bool ThermalContactAction::_quadrature
protected

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