https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ElectricalConductivity.C
Go to the documentation of this file.
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
11#include "libmesh/quadrature.h"
12#include "libmesh/utility.h"
13
16
17template <bool is_ad>
20{
22 params.addCoupledVar("temperature", 293.0, "Coupled variable for temperature.");
23 params.addParam<std::string>("base_name", "Material property base name.");
24 params.addParam<Real>("reference_resistivity",
25 1.68e-8,
26 "Electrical resistivity of the material at reference temperature "
27 "(default is copper resistivity in ohm-m).");
28 params.addParam<Real>("temperature_coefficient",
29 0.00386,
30 "Coefficient for calculating dependence of resistivity on temperature "
31 "(with copper as the default material).");
32 params.addParam<Real>("reference_temperature",
33 293.0,
34 "Reference temperature for Electrical resistivity in Kelvin.");
35 params.addClassDescription("Calculates resistivity and electrical conductivity as a function of "
36 "temperature, using copper for parameter defaults.");
37 return params;
38}
39
40template <bool is_ad>
42 : Material(parameters),
43 _ref_resis(getParam<Real>("reference_resistivity")),
44 _temp_coeff(getParam<Real>("temperature_coefficient")),
45 _ref_temp(getParam<Real>("reference_temperature")),
46 _has_temp(isCoupled("temperature")),
47 _T(_has_temp ? coupledGenericValue<is_ad>("temperature") : genericZeroValue<is_ad>()),
48 _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
49 _electric_conductivity(
50 declareGenericProperty<Real, is_ad>(_base_name + "electrical_conductivity")),
51 _delectric_conductivity_dT(declareProperty<Real>(_base_name + "electrical_conductivity_dT"))
52{
53}
54
55template <bool is_ad>
56void
58{
59 const auto & temp_qp = _T[_qp];
60
61 const auto resistivity = _ref_resis * (1.0 + _temp_coeff * (temp_qp - _ref_temp));
62 const Real dresistivity_dT = _ref_resis * _temp_coeff;
63 _electric_conductivity[_qp] = 1.0 / resistivity;
64 _delectric_conductivity_dT[_qp] =
65 -1.0 / Utility::pow<2>(MetaPhysicL::raw_value(resistivity)) * dresistivity_dT;
66}
67
registerMooseObject("HeatTransferApp", ElectricalConductivity)
Calculates resistivity and electrical conductivity as a function of temperature.
static InputParameters validParams()
ElectricalConductivityTempl(const InputParameters &parameters)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void addCoupledVar(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
auto raw_value(const Eigen::Map< T > &in)