Line data Source code
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 : 10 : #include "ElectrostaticContactCondition.h" 11 : 12 : registerMooseObject("ElectromagneticsApp", ElectrostaticContactCondition); 13 : 14 : InputParameters 15 245 : ElectrostaticContactCondition::validParams() 16 : { 17 245 : InputParameters params = ADInterfaceKernel::validParams(); 18 490 : params.addParam<MaterialPropertyName>( 19 : "primary_conductivity", "electrical_conductivity", "Conductivity on the primary block."); 20 490 : params.addParam<MaterialPropertyName>( 21 : "secondary_conductivity", "electrical_conductivity", "Conductivity on the secondary block."); 22 490 : params.addParam<MaterialPropertyName>( 23 : "mean_hardness", 24 : "mean_hardness", 25 : "Geometric mean of the hardness of each contacting material."); 26 490 : params.addParam<Real>("user_electrical_contact_conductance", 27 : "User-supplied electrical contact conductance coefficient."); 28 490 : params.addParam<FunctionName>("mechanical_pressure", 29 490 : 0.0, 30 : "Mechanical pressure uniformly applied at the contact surface area " 31 : "(Pressure = Force / Surface Area)."); 32 245 : params.addClassDescription( 33 : "Interface condition that describes the current continuity and contact conductance across a " 34 : "boundary formed between two dissimilar materials (resulting in a potential discontinuity). " 35 : "Conductivity on each side of the boundary is defined via the material properties system."); 36 245 : return params; 37 0 : } 38 : 39 134 : ElectrostaticContactCondition::ElectrostaticContactCondition(const InputParameters & parameters) 40 : : ADInterfaceKernel(parameters), 41 134 : _conductivity_primary(getADMaterialProperty<Real>("primary_conductivity")), 42 268 : _conductivity_secondary(getNeighborADMaterialProperty<Real>("secondary_conductivity")), 43 134 : _mean_hardness(isParamValid("user_electrical_contact_conductance") 44 268 : ? getGenericZeroMaterialProperty<Real, true>("mean_hardness") 45 332 : : getADMaterialProperty<Real>("mean_hardness")), 46 134 : _mechanical_pressure(getFunction("mechanical_pressure")), 47 134 : _user_contact_conductance(isParamValid("user_electrical_contact_conductance") 48 204 : ? getParam<Real>("user_electrical_contact_conductance") 49 : : _real_zero), 50 134 : _alpha_electric(64.0), 51 134 : _beta_electric(0.35) 52 : { 53 134 : _conductance_was_set = parameters.isParamSetByUser("user_electrical_contact_conductance"); 54 134 : _mean_hardness_was_set = parameters.isParamSetByUser("mean_hardness"); 55 : 56 134 : if (_conductance_was_set && _mean_hardness_was_set) 57 2 : mooseError( 58 : "In ", 59 2 : _name, 60 : ", both user-supplied electrical contact conductance and mean hardness values (for " 61 : "calculating contact conductance) have been provided. Please only provide one or the " 62 : "other!"); 63 132 : } 64 : 65 : ADReal 66 9772484 : ElectrostaticContactCondition::computeQpResidual(Moose::DGResidualType type) 67 : { 68 : using std::pow; 69 : 70 9772484 : ADReal res = 0.0; 71 9772484 : ADReal contact_conductance = 0.0; 72 : 73 9772484 : ADReal mean_conductivity = 2 * _conductivity_primary[_qp] * _conductivity_secondary[_qp] / 74 9772484 : (_conductivity_primary[_qp] + _conductivity_secondary[_qp]); 75 : 76 9772484 : if (_conductance_was_set && !_mean_hardness_was_set) 77 4886400 : contact_conductance = _user_contact_conductance; 78 4886084 : else if (_mean_hardness_was_set && !_conductance_was_set) 79 : contact_conductance = 80 4886084 : _alpha_electric * mean_conductivity * 81 14658252 : pow((_mechanical_pressure.value(_t, _q_point[_qp]) / _mean_hardness[_qp]), _beta_electric); 82 : 83 9772484 : switch (type) 84 : { 85 4886242 : case Moose::Element: 86 14658726 : res = -contact_conductance * (_neighbor_value[_qp] - _u[_qp]) * _test[_i][_qp]; 87 4886242 : break; 88 : 89 4886242 : case Moose::Neighbor: 90 9772484 : res = _conductivity_primary[_qp] * _grad_u[_qp] * _normals[_qp] * _test_neighbor[_i][_qp]; 91 4886242 : break; 92 : } 93 : 94 9772484 : return res; 95 : }