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 "ADInterfaceJouleHeatingConstraint.h" 11 : 12 : registerMooseObject("HeatTransferApp", ADInterfaceJouleHeatingConstraint); 13 : 14 : InputParameters 15 228 : ADInterfaceJouleHeatingConstraint::validParams() 16 : { 17 228 : InputParameters params = ADMortarConstraint::validParams(); 18 228 : params.addClassDescription( 19 : "Joule heating model, for the case of a closed gap interface, to calculate the heat flux " 20 : "contribution created when an electric potential difference occurs across that interface."); 21 456 : params.addRequiredCoupledVar( 22 : "potential_lagrange_multiplier", 23 : "The name of the lagrange multiplier variable used in the calculation of the electrical " 24 : "potential mortar constrain calculation"); 25 456 : params.addRequiredParam<MaterialPropertyName>( 26 : "primary_electrical_conductivity", 27 : "The electrical conductivity of the primary surface solid material"); 28 456 : params.addRequiredParam<MaterialPropertyName>( 29 : "secondary_electrical_conductivity", 30 : "The electrical conductivity of the secondary surface solid material"); 31 456 : params.addParam<Real>("weighting_factor", 32 456 : 0.5, 33 : "Weight applied to divide the heat flux from Joule heating at the " 34 : "interface between the primary and secondary surfaces."); 35 228 : return params; 36 0 : } 37 : 38 114 : ADInterfaceJouleHeatingConstraint::ADInterfaceJouleHeatingConstraint( 39 114 : const InputParameters & parameters) 40 : : ADMortarConstraint(parameters), 41 114 : _lm_electrical_potential(adCoupledLowerValue("potential_lagrange_multiplier")), 42 228 : _primary_conductivity(getNeighborADMaterialProperty<Real>("primary_electrical_conductivity")), 43 228 : _secondary_conductivity(getADMaterialProperty<Real>("secondary_electrical_conductivity")), 44 342 : _weight_factor(getParam<Real>("weighting_factor")) 45 : { 46 114 : } 47 : 48 : ADReal 49 195680 : ADInterfaceJouleHeatingConstraint::computeQpResidual(Moose::MortarType mortar_type) 50 : { 51 : // calculate the harmonic means of the two material properties 52 195680 : const ADReal C_sum = _primary_conductivity[_qp] + _secondary_conductivity[_qp]; 53 195680 : const ADReal C_harmonic = 2.0 * _primary_conductivity[_qp] * _secondary_conductivity[_qp] / C_sum; 54 : 55 195680 : ADReal potential_flux_sq = _lm_electrical_potential[_qp] * _lm_electrical_potential[_qp]; 56 : ADReal q_electric = potential_flux_sq / C_harmonic; 57 : 58 195680 : switch (mortar_type) 59 : { 60 97840 : case Moose::MortarType::Primary: 61 : { 62 97840 : auto source = -q_electric * _weight_factor * _test_primary[_i][_qp]; 63 97840 : return source; 64 : } 65 : 66 97840 : case Moose::MortarType::Secondary: 67 : { 68 97840 : auto source = -q_electric * (1.0 - _weight_factor) * _test_secondary[_i][_qp]; 69 97840 : return source; 70 : } 71 : 72 0 : default: 73 0 : return 0; 74 : } 75 : }