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 17 of file ThermalContactAction.h.

Constructor & Destructor Documentation

◆ ThermalContactAction()

ThermalContactAction::ThermalContactAction ( const InputParameters &  params)

Definition at line 90 of file ThermalContactAction.C.

91  : Action(params),
92  _quadrature(getParam<bool>("quadrature")),
93  _order(getParam<MooseEnum>("order")),
94  _penetration_var_name(_quadrature ? "qpoint_penetration" : "penetration"),
95  _gap_value_name("paired_" + getParam<NonlinearVariableName>("variable")),
96  _gap_conductivity_name("paired_k_" + getParam<NonlinearVariableName>("variable"))
97 {
98 }
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 101 of file ThermalContactAction.C.

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

◆ addAuxKernels()

void ThermalContactAction::addAuxKernels ( )
protectedvirtual

Definition at line 118 of file ThermalContactAction.C.

Referenced by act().

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

◆ addAuxVariables()

void ThermalContactAction::addAuxVariables ( )
protectedvirtual

Definition at line 165 of file ThermalContactAction.C.

Referenced by act().

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

◆ addBCs()

void ThermalContactAction::addBCs ( )
protectedvirtual

Definition at line 187 of file ThermalContactAction.C.

Referenced by act().

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

◆ addDiracKernels()

void ThermalContactAction::addDiracKernels ( )
protectedvirtual

Definition at line 219 of file ThermalContactAction.C.

Referenced by act().

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

◆ addMaterials()

void ThermalContactAction::addMaterials ( )
protectedvirtual

Definition at line 239 of file ThermalContactAction.C.

Referenced by act().

240 {
241  if (getParam<std::string>("type") != "GapHeatTransfer")
242  return;
243 
244  const std::string object_type = "GapConductance";
245 
246  InputParameters params = _factory.getValidParams(object_type);
247  params.applyParameters(parameters(), {"variable"});
248 
249  params.set<std::vector<VariableName>>("variable") = {getParam<NonlinearVariableName>("variable")};
250  params.set<std::vector<BoundaryName>>("boundary") = {getParam<BoundaryName>("slave")};
251 
252  if (_quadrature)
253  {
254  params.set<BoundaryName>("paired_boundary") = getParam<BoundaryName>("master");
255  }
256  else
257  {
258  params.set<std::vector<VariableName>>("gap_temp") = {_gap_value_name};
259  params.set<std::vector<VariableName>>("gap_distance") = {"penetration"};
260  }
261 
262  _problem->addMaterial(object_type, name() + "_" + "gap_value", params);
263 
264  if (_quadrature)
265  {
266  params.set<BoundaryName>("paired_boundary") = getParam<BoundaryName>("slave");
267  params.set<std::vector<BoundaryName>>("boundary") = {getParam<BoundaryName>("master")};
268 
269  _problem->addMaterial(object_type, name() + "_" + "gap_value_master", params);
270  }
271 }
const std::string name
Definition: Setup.h:22
const AuxVariableName _gap_value_name

◆ addSlaveFluxVector()

void ThermalContactAction::addSlaveFluxVector ( )
protectedvirtual

Definition at line 274 of file ThermalContactAction.C.

Referenced by act().

275 {
276  _problem->getNonlinearSystemBase().addVector("slave_flux", false, GHOSTED);
277  _problem->getNonlinearSystemBase().zeroVectorForResidual("slave_flux");
278 
279  // It is risky to apply this optimization to contact problems
280  // since the problem configuration may be changed during Jacobian
281  // evaluation. We therefore turn it off for all contact problems so that
282  // PETSc-3.8.4 or higher will have the same behavior as PETSc-3.8.3 or older.
283  if (!_problem->isSNESMFReuseBaseSetbyUser())
284  _problem->setSNESMFReuseBase(false, false);
285 }

Member Data Documentation

◆ _gap_conductivity_name

const AuxVariableName ThermalContactAction::_gap_conductivity_name
protected

Definition at line 35 of file ThermalContactAction.h.

◆ _gap_value_name

const AuxVariableName ThermalContactAction::_gap_value_name
protected

Definition at line 34 of file ThermalContactAction.h.

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

◆ _order

const MooseEnum ThermalContactAction::_order
protected

Definition at line 32 of file ThermalContactAction.h.

◆ _penetration_var_name

const AuxVariableName ThermalContactAction::_penetration_var_name
protected

Definition at line 33 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: