LCOV - code coverage report
Current view: top level - src/interfacekernels - ThermalContactCondition.C (source / functions) Hit Total Coverage
Test: idaholab/malamute: 0e4c8a Lines: 80 81 98.8 %
Date: 2025-08-02 07:01:39 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /****************************************************************************/
       2             : /*                        DO NOT MODIFY THIS HEADER                         */
       3             : /*                                                                          */
       4             : /* MALAMUTE: MOOSE Application Library for Advanced Manufacturing UTilitiEs */
       5             : /*                                                                          */
       6             : /*           Copyright 2021 - 2024, Battelle Energy Alliance, LLC           */
       7             : /*                           ALL RIGHTS RESERVED                            */
       8             : /****************************************************************************/
       9             : 
      10             : #include "ThermalContactCondition.h"
      11             : 
      12             : registerMooseObject("MalamuteApp", ThermalContactCondition);
      13             : 
      14             : InputParameters
      15         104 : ThermalContactCondition::validParams()
      16             : {
      17         104 :   InputParameters params = ADInterfaceKernel::validParams();
      18         208 :   params.addParam<MaterialPropertyName>("primary_thermal_conductivity",
      19             :                                         "thermal_conductivity",
      20             :                                         "Thermal conductivity on the primary block.");
      21         208 :   params.addParam<MaterialPropertyName>("secondary_thermal_conductivity",
      22             :                                         "thermal_conductivity",
      23             :                                         "Thermal conductivity on the secondary block.");
      24         208 :   params.addParam<MaterialPropertyName>("primary_electrical_conductivity",
      25             :                                         "electrical_conductivity",
      26             :                                         "Electrical conductivity on the primary block.");
      27         208 :   params.addParam<MaterialPropertyName>("secondary_electrical_conductivity",
      28             :                                         "electrical_conductivity",
      29             :                                         "Electrical conductivity on the secondary block.");
      30         208 :   params.addParam<FunctionName>("user_thermal_contact_conductance",
      31         208 :                                 0.0,
      32             :                                 "User-provided thermal contact conductance coefficient.");
      33         208 :   params.addParam<FunctionName>("user_electrical_contact_conductance",
      34         208 :                                 0.0,
      35             :                                 "User-provided electrical contact conductance coefficient.");
      36         208 :   params.addRequiredCoupledVar("primary_potential",
      37             :                                "Electrostatic potential on the primary block.");
      38         208 :   params.addRequiredCoupledVar("secondary_potential",
      39             :                                "Electrostatic potential on the secondary block.");
      40         208 :   params.addParam<Real>("splitting_factor", 0.5, "Splitting factor of the Joule heating source.");
      41         208 :   params.addParam<MaterialPropertyName>(
      42             :       "mean_hardness",
      43             :       "mean_hardness",
      44             :       "Geometric mean of the hardness of each contacting material.");
      45         208 :   params.addParam<FunctionName>("mechanical_pressure",
      46         208 :                                 0.0,
      47             :                                 "Mechanical pressure uniformly applied at the contact surface area "
      48             :                                 "(Pressure = Force / Surface Area).");
      49         104 :   params.addClassDescription(
      50             :       "Interface condition that describes the thermal contact resistance across a boundary formed "
      51             :       "between two dissimilar materials (resulting in a temperature discontinuity) under the "
      52             :       "influence of an electrostatic potential, as described in Cincotti, et al (DOI: "
      53             :       "10.1002/aic.11102). Thermal conductivity on each side of the boundary is defined via the "
      54             :       "material properties system.");
      55         104 :   return params;
      56           0 : }
      57             : 
      58          52 : ThermalContactCondition::ThermalContactCondition(const InputParameters & parameters)
      59             :   : ADInterfaceKernel(parameters),
      60          52 :     _thermal_conductivity_primary(getADMaterialProperty<Real>("primary_thermal_conductivity")),
      61          52 :     _thermal_conductivity_secondary(
      62          52 :         getNeighborADMaterialProperty<Real>("secondary_thermal_conductivity")),
      63          52 :     _electrical_conductivity_primary(
      64          52 :         getADMaterialProperty<Real>("primary_electrical_conductivity")),
      65          52 :     _electrical_conductivity_secondary(
      66          52 :         getNeighborADMaterialProperty<Real>("secondary_electrical_conductivity")),
      67          52 :     _user_thermal_contact_conductance(getFunction("user_thermal_contact_conductance")),
      68          52 :     _user_electrical_contact_conductance(getFunction("user_electrical_contact_conductance")),
      69          52 :     _potential_primary(adCoupledValue("primary_potential")),
      70          52 :     _secondary_potential_var(getVar("secondary_potential", 0)),
      71          52 :     _potential_secondary(_secondary_potential_var->adSlnNeighbor()),
      72         104 :     _splitting_factor(getParam<Real>("splitting_factor")),
      73          52 :     _mean_hardness(isParamValid("user_thermal_contact_conductance")
      74         104 :                        ? getGenericZeroMaterialProperty<Real, true>("mean_hardness")
      75          52 :                    : isParamValid("user_electrical_contact_conductance")
      76          52 :                        ? getGenericZeroMaterialProperty<Real, true>("mean_hardness")
      77          52 :                        : getADMaterialProperty<Real>("mean_hardness")),
      78          52 :     _mechanical_pressure(getFunction("mechanical_pressure")),
      79          52 :     _alpha_thermal(22810.0),
      80          52 :     _beta_thermal(1.08),
      81          52 :     _alpha_electric(64.0),
      82          52 :     _beta_electric(0.35)
      83             : {
      84          52 :   _electrical_conductance_was_set =
      85          52 :       parameters.isParamSetByUser("user_electrical_contact_conductance");
      86          52 :   _thermal_conductance_was_set = parameters.isParamSetByUser("user_thermal_contact_conductance");
      87          52 :   _mean_hardness_was_set = parameters.isParamSetByUser("mean_hardness");
      88          52 : }
      89             : 
      90             : ADReal
      91      422481 : ThermalContactCondition::computeQpResidual(Moose::DGResidualType type)
      92             : {
      93      422481 :   ADReal thermal_contact_conductance = 0.0;
      94      422481 :   ADReal electrical_contact_conductance = 0.0;
      95             : 
      96      422481 :   if (_electrical_conductance_was_set && _thermal_conductance_was_set && !_mean_hardness_was_set)
      97             :   {
      98       13200 :     thermal_contact_conductance = _user_thermal_contact_conductance.value(_t, _q_point[_qp]);
      99       13200 :     electrical_contact_conductance = _user_electrical_contact_conductance.value(_t, _q_point[_qp]);
     100             :   }
     101      409281 :   else if (_mean_hardness_was_set && !_thermal_conductance_was_set &&
     102             :            !_electrical_conductance_was_set)
     103             :   {
     104             :     ADReal mean_thermal_conductivity =
     105      409280 :         2 * _thermal_conductivity_primary[_qp] * _thermal_conductivity_secondary[_qp] /
     106      409280 :         (_thermal_conductivity_primary[_qp] + _thermal_conductivity_secondary[_qp]);
     107             : 
     108             :     ADReal mean_electrical_conductivity =
     109      409280 :         2 * _electrical_conductivity_primary[_qp] * _electrical_conductivity_secondary[_qp] /
     110      409280 :         (_electrical_conductivity_primary[_qp] + _electrical_conductivity_secondary[_qp]);
     111             : 
     112             :     thermal_contact_conductance =
     113      409280 :         _alpha_thermal * mean_thermal_conductivity *
     114      818560 :         std::pow((_mechanical_pressure.value(_t, _q_point[_qp]) / _mean_hardness[_qp]),
     115      818560 :                  _beta_thermal);
     116             : 
     117             :     electrical_contact_conductance =
     118      409280 :         _alpha_electric * mean_electrical_conductivity *
     119      818560 :         std::pow((_mechanical_pressure.value(_t, _q_point[_qp]) / _mean_hardness[_qp]),
     120      818560 :                  _beta_electric);
     121      409280 :   }
     122             :   else
     123             :   {
     124           1 :     mooseError(
     125             :         "In ",
     126           1 :         _name,
     127             :         ", both user-supplied thermal/electrical conductances and mean hardness values (for "
     128             :         "calculating contact conductances) have been provided. Please only provide one or the "
     129             :         "other!");
     130             :   }
     131             : 
     132      422480 :   ADReal potential_diff = _potential_primary[_qp] - _potential_secondary[_qp];
     133             : 
     134             :   ADReal q_electric_primary =
     135      422480 :       _splitting_factor * electrical_contact_conductance * potential_diff * potential_diff;
     136             : 
     137             :   ADReal q_electric_secondary =
     138      422480 :       (1 - _splitting_factor) * electrical_contact_conductance * potential_diff * potential_diff;
     139             : 
     140      422480 :   ADReal q_temperature = thermal_contact_conductance * (_u[_qp] - _neighbor_value[_qp]);
     141             : 
     142      422480 :   ADReal res = 0.0;
     143             : 
     144      422480 :   switch (type)
     145             :   {
     146      211240 :     case Moose::Element:
     147      422480 :       res = (q_temperature - q_electric_primary) * _test[_i][_qp];
     148      211240 :       break;
     149             : 
     150      211240 :     case Moose::Neighbor:
     151      633720 :       res = -(q_temperature + q_electric_secondary) * _test_neighbor[_i][_qp];
     152      211240 :       break;
     153             :   }
     154             : 
     155      422480 :   return res;
     156             : }

Generated by: LCOV version 1.14