LCOV - code coverage report
Current view: top level - src/interfacekernels - ElectrostaticContactCondition.C (source / functions) Hit Total Coverage
Test: idaholab/moose electromagnetics: #31405 (292dce) with base fef103 Lines: 46 47 97.9 %
Date: 2025-09-04 07:52:56 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          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     9773124 : ElectrostaticContactCondition::computeQpResidual(Moose::DGResidualType type)
      67             : {
      68     9773124 :   ADReal res = 0.0;
      69     9773124 :   ADReal contact_conductance = 0.0;
      70             : 
      71     9773124 :   ADReal mean_conductivity = 2 * _conductivity_primary[_qp] * _conductivity_secondary[_qp] /
      72     9773124 :                              (_conductivity_primary[_qp] + _conductivity_secondary[_qp]);
      73             : 
      74     9773124 :   if (_conductance_was_set && !_mean_hardness_was_set)
      75     4885760 :     contact_conductance = _user_contact_conductance;
      76     4887364 :   else if (_mean_hardness_was_set && !_conductance_was_set)
      77             :     contact_conductance =
      78     4887364 :         _alpha_electric * mean_conductivity *
      79    14662092 :         std::pow((_mechanical_pressure.value(_t, _q_point[_qp]) / _mean_hardness[_qp]),
      80     9774728 :                  _beta_electric);
      81             : 
      82     9773124 :   switch (type)
      83             :   {
      84     4886562 :     case Moose::Element:
      85    14659686 :       res = -contact_conductance * (_neighbor_value[_qp] - _u[_qp]) * _test[_i][_qp];
      86     4886562 :       break;
      87             : 
      88     4886562 :     case Moose::Neighbor:
      89     9773124 :       res = _conductivity_primary[_qp] * _grad_u[_qp] * _normals[_qp] * _test_neighbor[_i][_qp];
      90     4886562 :       break;
      91             :   }
      92             : 
      93     9773124 :   return res;
      94             : }

Generated by: LCOV version 1.14