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 1637 : PorousFlowThermalConductivityIdealTempl<is_ad>::validParams() 18 : { 19 1637 : InputParameters params = PorousFlowThermalConductivityBaseTempl<is_ad>::validParams(); 20 3274 : params.addRequiredParam<RealTensorValue>( 21 : "dry_thermal_conductivity", 22 : "The thermal conductivity of the rock matrix when the aqueous saturation is zero"); 23 3274 : 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 3274 : params.addParam<Real>("exponent", 28 3274 : 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 3274 : params.addParam<unsigned>("aqueous_phase_number", 34 3274 : 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 1637 : 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 1637 : return params; 43 0 : } 44 : 45 : template <bool is_ad> 46 1266 : PorousFlowThermalConductivityIdealTempl<is_ad>::PorousFlowThermalConductivityIdealTempl( 47 : const InputParameters & parameters) 48 : : PorousFlowThermalConductivityBaseTempl<is_ad>(parameters), 49 1266 : _la_dry(this->template getParam<RealTensorValue>("dry_thermal_conductivity")), 50 1266 : _wet_and_dry_differ(parameters.isParamValid("wet_thermal_conductivity")), 51 2532 : _la_wet(_wet_and_dry_differ 52 1266 : ? this->template getParam<RealTensorValue>("wet_thermal_conductivity") 53 3438 : : this->template getParam<RealTensorValue>("dry_thermal_conductivity")), 54 2532 : _exponent(this->template getParam<Real>("exponent")), 55 1266 : _aqueous_phase(_num_phases > 0), 56 2532 : _aqueous_phase_number(this->template getParam<unsigned>("aqueous_phase_number")), 57 2532 : _saturation_qp(_aqueous_phase 58 1266 : ? &this->template getGenericMaterialProperty<std::vector<Real>, is_ad>( 59 : "PorousFlow_saturation_qp") 60 : : nullptr), 61 2472 : _dsaturation_qp_dvar(_aqueous_phase && !is_ad 62 2331 : ? &this->template getMaterialProperty<std::vector<std::vector<Real>>>( 63 : "dPorousFlow_saturation_qp_dvar") 64 1266 : : nullptr) 65 : { 66 1266 : 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 1266 : } 73 : 74 : template <bool is_ad> 75 : void 76 3024187 : PorousFlowThermalConductivityIdealTempl<is_ad>::computeQpProperties() 77 : { 78 : using std::pow; 79 : 80 3024187 : _la_qp[_qp] = _la_dry; 81 3024187 : if (_aqueous_phase && _wet_and_dry_differ) 82 157884 : _la_qp[_qp] += 83 152394 : pow((*_saturation_qp)[_qp][_aqueous_phase_number], _exponent) * (_la_wet - _la_dry); 84 : 85 : if constexpr (!is_ad) 86 : { 87 3013207 : (*_dla_qp_dvar)[_qp].assign(_num_var, RealTensorValue()); 88 3013207 : if (_aqueous_phase && _wet_and_dry_differ) 89 336522 : for (const auto v : make_range(_num_var)) 90 263070 : (*_dla_qp_dvar)[_qp][v] = 91 263070 : _exponent * pow((*_saturation_qp)[_qp][_aqueous_phase_number], _exponent - 1.0) * 92 263070 : (*_dsaturation_qp_dvar)[_qp][_aqueous_phase_number][v] * (_la_wet - _la_dry); 93 : } 94 3024187 : } 95 : 96 : template class PorousFlowThermalConductivityIdealTempl<false>; 97 : template class PorousFlowThermalConductivityIdealTempl<true>;