https://mooseframework.inl.gov
Loading...
Searching...
No Matches
GapConductanceConstraint.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
11
13
16{
19 "Computes the residual and Jacobian contributions for the 'Lagrange Multiplier' "
20 "implementation of the thermal contact problem. For more information, see the "
21 "detailed description here: http://tinyurl.com/gmmhbe9");
22 params.addRequiredParam<Real>("k", "Gap conductance");
23 params.addParam<Real>("min_gap",
24 1e-6,
25 "The minimum gap distance allowed. This helps with preventing the heat "
26 "flux from going to infinity as the gap approaches zero.");
27 params.addCoupledVar("displacements", "Displacement variables");
28 return params;
29}
30
32 : ADMortarConstraint(parameters),
33 _k(getParam<Real>("k")),
34 _min_gap(getParam<Real>("min_gap")),
35 _disp_name(parameters.getVecMooseType("displacements")),
36 _n_disp(_disp_name.size()),
37 _disp_secondary(_n_disp),
38 _disp_primary(_n_disp)
39{
40 for (unsigned int i = 0; i < _n_disp; ++i)
41 {
42 auto & disp_var = _subproblem.getStandardVariable(_tid, _disp_name[i]);
43 _disp_secondary[i] = &disp_var.adSln();
44 _disp_primary[i] = &disp_var.adSlnNeighbor();
45 }
46}
47
50{
51 using std::max;
52
53 switch (mortar_type)
54 {
55 case Moose::MortarType::Primary:
56 return _lambda[_qp] * _test_primary[_i][_qp];
57 case Moose::MortarType::Secondary:
58 return -_lambda[_qp] * _test_secondary[_i][_qp];
59 case Moose::MortarType::Lower:
60 {
61 // we are creating an AD version of phys points primary and secondary here...
62 ADRealVectorValue ad_phys_points_primary = _phys_points_primary[_qp];
63 ADRealVectorValue ad_phys_points_secondary = _phys_points_secondary[_qp];
64
65 // ...which uses the derivative vector of the primary and secondary displacements as
66 // an approximation of the true phys points derivatives when the mesh is displacing
67 if (_displaced)
68 for (unsigned int i = 0; i < _n_disp; ++i)
69 {
70 ad_phys_points_primary(i).derivatives() = (*_disp_primary[i])[_qp].derivatives();
71 ad_phys_points_secondary(i).derivatives() = (*_disp_secondary[i])[_qp].derivatives();
72 }
73
74 auto l = max((ad_phys_points_primary - ad_phys_points_secondary) * _normals[_qp], _min_gap);
75 return (_lambda[_qp] - _k * (_u_primary[_qp] - _u_secondary[_qp]) / l) * _test[_i][_qp];
76 }
77
78 default:
79 return 0;
80 }
81}
DualNumber< Real, DNDerivativeType, true > ADReal
registerMooseObject("HeatTransferApp", GapConductanceConstraint)
const ADVariableValue & _u_secondary
const ADVariableValue & _lambda
const ADVariableValue & _u_primary
static InputParameters validParams()
unsigned int _qp
unsigned int _i
This Constraint implements thermal contact using a "gap conductance" model in which the flux is repre...
const std::vector< std::string > _disp_name
Displacement variables.
static InputParameters validParams()
const Real _k
Thermal conductivity of the gap medium (e.g. air).
GapConductanceConstraint(const InputParameters &parameters)
const Real _min_gap
Minimum gap distance allowed.
std::vector< const ADVariableValue * > _disp_primary
std::vector< const ADVariableValue * > _disp_secondary
virtual ADReal computeQpResidual(Moose::MortarType mortar_type) override
Computes the residual for the LM equation, lambda = (k/l)*(T^(1) - PT^(2)).
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void addCoupledVar(const std::string &name, const std::string &doc_string)
const ADTemplateVariableValue< OutputType > & adSln() const override
const VariableTestValue & _test_secondary
const VariableTestValue & _test
const VariableTestValue & _test_primary
const bool _displaced
const MooseArray< Point > & _phys_points_secondary
const MooseArray< Point > & _phys_points_primary
std::vector< Point > _normals
SubProblem & _subproblem
virtual MooseVariable & getStandardVariable(const THREAD_ID tid, const std::string &var_name)=0