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 "PorousFlowThermalConductivityIdeal.h" 11 : 12 : registerMooseObject("PorousFlowApp", PorousFlowThermalConductivityIdeal); 13 : registerMooseObject("PorousFlowApp", ADPorousFlowThermalConductivityIdeal); 14 : 15 : template <bool is_ad> 16 : InputParameters 17 3128 : PorousFlowThermalConductivityIdealTempl<is_ad>::validParams() 18 : { 19 3128 : InputParameters params = PorousFlowThermalConductivityBaseTempl<is_ad>::validParams(); 20 6256 : params.addRequiredParam<RealTensorValue>( 21 : "dry_thermal_conductivity", 22 : "The thermal conductivity of the rock matrix when the aqueous saturation is zero"); 23 6256 : params.addParam<RealTensorValue>("wet_thermal_conductivity", 24 : "The thermal conductivity of the rock matrix when the aqueous " 25 : "saturation is unity. This defaults to " 26 : "dry_thermal_conductivity."); 27 6256 : params.addParam<Real>("exponent", 28 6256 : 1.0, 29 : "Exponent on saturation. Thermal conductivity = " 30 : "dry_thermal_conductivity + S^exponent * " 31 : "(wet_thermal_conductivity - dry_thermal_conductivity), " 32 : "where S is the aqueous saturation"); 33 6256 : params.addParam<unsigned>("aqueous_phase_number", 34 6256 : 0, 35 : "The phase number of the aqueous phase. In simulations without " 36 : "fluids, this parameter and the exponent parameter will not be " 37 : "used: only the dry_thermal_conductivity will be used."); 38 3128 : params.addClassDescription("This Material calculates rock-fluid combined thermal conductivity by " 39 : "using a weighted sum. Thermal conductivity = " 40 : "dry_thermal_conductivity + S^exponent * (wet_thermal_conductivity - " 41 : "dry_thermal_conductivity), where S is the aqueous saturation"); 42 3128 : return params; 43 0 : } 44 : 45 : template <bool is_ad> 46 2442 : PorousFlowThermalConductivityIdealTempl<is_ad>::PorousFlowThermalConductivityIdealTempl( 47 : const InputParameters & parameters) 48 : : PorousFlowThermalConductivityBaseTempl<is_ad>(parameters), 49 2442 : _la_dry(this->template getParam<RealTensorValue>("dry_thermal_conductivity")), 50 2442 : _wet_and_dry_differ(parameters.isParamValid("wet_thermal_conductivity")), 51 4884 : _la_wet(_wet_and_dry_differ 52 2442 : ? this->template getParam<RealTensorValue>("wet_thermal_conductivity") 53 6630 : : this->template getParam<RealTensorValue>("dry_thermal_conductivity")), 54 4884 : _exponent(this->template getParam<Real>("exponent")), 55 2442 : _aqueous_phase(_num_phases > 0), 56 4884 : _aqueous_phase_number(this->template getParam<unsigned>("aqueous_phase_number")), 57 4884 : _saturation_qp(_aqueous_phase 58 2442 : ? &this->template getGenericMaterialProperty<std::vector<Real>, is_ad>( 59 : "PorousFlow_saturation_qp") 60 : : nullptr), 61 4752 : _dsaturation_qp_dvar(_aqueous_phase && !is_ad 62 4455 : ? &this->template getMaterialProperty<std::vector<std::vector<Real>>>( 63 : "dPorousFlow_saturation_qp_dvar") 64 2442 : : nullptr) 65 : { 66 2442 : if (_aqueous_phase && (_aqueous_phase_number >= _num_phases)) 67 0 : mooseError("PorousFlowThermalConductivityIdeal: Your aqueous phase number, ", 68 0 : _aqueous_phase_number, 69 : " must not exceed the number of fluid phases in the system, which is ", 70 0 : _num_phases, 71 : "\n"); 72 2442 : } 73 : 74 : template <bool is_ad> 75 : void 76 4394091 : PorousFlowThermalConductivityIdealTempl<is_ad>::computeQpProperties() 77 : { 78 4394091 : _la_qp[_qp] = _la_dry; 79 4394091 : if (_aqueous_phase && _wet_and_dry_differ) 80 176860 : _la_qp[_qp] += 81 168670 : std::pow((*_saturation_qp)[_qp][_aqueous_phase_number], _exponent) * (_la_wet - _la_dry); 82 : 83 : if constexpr (!is_ad) 84 : { 85 4377711 : (*_dla_qp_dvar)[_qp].assign(_num_var, RealTensorValue()); 86 4377711 : if (_aqueous_phase && _wet_and_dry_differ) 87 378468 : for (const auto v : make_range(_num_var)) 88 298228 : (*_dla_qp_dvar)[_qp][v] = 89 298228 : _exponent * std::pow((*_saturation_qp)[_qp][_aqueous_phase_number], _exponent - 1.0) * 90 298228 : (*_dsaturation_qp_dvar)[_qp][_aqueous_phase_number][v] * (_la_wet - _la_dry); 91 : } 92 4394091 : } 93 : 94 : template class PorousFlowThermalConductivityIdealTempl<false>; 95 : template class PorousFlowThermalConductivityIdealTempl<true>;