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 123 : ElectrostaticContactCondition::validParams() 16 : { 17 123 : InputParameters params = ADInterfaceKernel::validParams(); 18 246 : params.addParam<MaterialPropertyName>( 19 : "primary_conductivity", "electrical_conductivity", "Conductivity on the primary block."); 20 246 : params.addParam<MaterialPropertyName>( 21 : "secondary_conductivity", "electrical_conductivity", "Conductivity on the secondary block."); 22 246 : params.addParam<MaterialPropertyName>( 23 : "mean_hardness", 24 : "mean_hardness", 25 : "Geometric mean of the hardness of each contacting material."); 26 246 : params.addParam<Real>("user_electrical_contact_conductance", 27 : "User-supplied electrical contact conductance coefficient."); 28 246 : params.addParam<FunctionName>("mechanical_pressure", 29 246 : 0.0, 30 : "Mechanical pressure uniformly applied at the contact surface area " 31 : "(Pressure = Force / Surface Area)."); 32 123 : 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 123 : return params; 37 0 : } 38 : 39 66 : ElectrostaticContactCondition::ElectrostaticContactCondition(const InputParameters & parameters) 40 : : ADInterfaceKernel(parameters), 41 66 : _conductivity_primary(getADMaterialProperty<Real>("primary_conductivity")), 42 132 : _conductivity_secondary(getNeighborADMaterialProperty<Real>("secondary_conductivity")), 43 66 : _mean_hardness(isParamValid("user_electrical_contact_conductance") 44 132 : ? getGenericZeroMaterialProperty<Real, true>("mean_hardness") 45 160 : : getADMaterialProperty<Real>("mean_hardness")), 46 66 : _mechanical_pressure(getFunction("mechanical_pressure")), 47 66 : _user_contact_conductance(isParamValid("user_electrical_contact_conductance") 48 104 : ? getParam<Real>("user_electrical_contact_conductance") 49 : : _real_zero), 50 66 : _alpha_electric(64.0), 51 66 : _beta_electric(0.35) 52 : { 53 66 : _conductance_was_set = parameters.isParamSetByUser("user_electrical_contact_conductance"); 54 66 : _mean_hardness_was_set = parameters.isParamSetByUser("mean_hardness"); 55 : 56 66 : 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 64 : } 64 : 65 : ADReal 66 7629016 : ElectrostaticContactCondition::computeQpResidual(Moose::DGResidualType type) 67 : { 68 : using std::pow; 69 : 70 7629016 : ADReal res = 0.0; 71 7629016 : ADReal contact_conductance = 0.0; 72 : 73 7629016 : ADReal mean_conductivity = 2 * _conductivity_primary[_qp] * _conductivity_secondary[_qp] / 74 7629016 : (_conductivity_primary[_qp] + _conductivity_secondary[_qp]); 75 : 76 7629016 : if (_conductance_was_set && !_mean_hardness_was_set) 77 3814400 : contact_conductance = _user_contact_conductance; 78 3814616 : else if (_mean_hardness_was_set && !_conductance_was_set) 79 : contact_conductance = 80 3814616 : _alpha_electric * mean_conductivity * 81 11443848 : pow((_mechanical_pressure.value(_t, _q_point[_qp]) / _mean_hardness[_qp]), _beta_electric); 82 : 83 7629016 : switch (type) 84 : { 85 3814508 : case Moose::Element: 86 11443524 : res = -contact_conductance * (_neighbor_value[_qp] - _u[_qp]) * _test[_i][_qp]; 87 3814508 : break; 88 : 89 3814508 : case Moose::Neighbor: 90 7629016 : res = _conductivity_primary[_qp] * _grad_u[_qp] * _normals[_qp] * _test_neighbor[_i][_qp]; 91 3814508 : break; 92 : } 93 : 94 7629016 : return res; 95 : }