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 "PorousFlowThermalConductivityFromPorosity.h" 11 : 12 : registerMooseObject("PorousFlowApp", PorousFlowThermalConductivityFromPorosity); 13 : registerMooseObject("PorousFlowApp", ADPorousFlowThermalConductivityFromPorosity); 14 : 15 : template <bool is_ad> 16 : InputParameters 17 85 : PorousFlowThermalConductivityFromPorosityTempl<is_ad>::validParams() 18 : { 19 85 : InputParameters params = PorousFlowThermalConductivityBaseTempl<is_ad>::validParams(); 20 170 : params.addRequiredParam<RealTensorValue>("lambda_s", 21 : "The thermal conductivity of the solid matrix material"); 22 170 : params.addRequiredParam<RealTensorValue>("lambda_f", 23 : "The thermal conductivity of the single fluid phase"); 24 85 : params.addClassDescription("This Material calculates rock-fluid combined thermal conductivity " 25 : "for the single phase, fully saturated case by using a linear " 26 : "weighted average. " 27 : "Thermal conductivity = phi * lambda_f + (1 - phi) * lambda_s, " 28 : "where phi is porosity, and lambda_f, lambda_s are " 29 : "thermal conductivities of the fluid and solid (assumed constant)"); 30 85 : return params; 31 0 : } 32 : 33 : template <bool is_ad> 34 66 : PorousFlowThermalConductivityFromPorosityTempl< 35 : is_ad>::PorousFlowThermalConductivityFromPorosityTempl(const InputParameters & parameters) 36 : : PorousFlowThermalConductivityBaseTempl<is_ad>(parameters), 37 66 : _la_s(this->template getParam<RealTensorValue>("lambda_s")), 38 132 : _la_f(this->template getParam<RealTensorValue>("lambda_f")), 39 66 : _porosity_qp(this->template getGenericMaterialProperty<Real, is_ad>("PorousFlow_porosity_qp")), 40 66 : _dporosity_qp_dvar(is_ad ? nullptr 41 66 : : &this->template getMaterialProperty<std::vector<Real>>( 42 66 : "dPorousFlow_porosity_qp_dvar")) 43 : { 44 66 : if (_num_phases != 1) 45 0 : this->paramError("fluid_phase", 46 : "The Dictator proclaims that the number of phases is ", 47 0 : _dictator.numPhases(), 48 : " whereas this material can only be used for single phase " 49 : "simulations. Be aware that the Dictator has noted your mistake."); 50 66 : } 51 : 52 : template <bool is_ad> 53 : void 54 216 : PorousFlowThermalConductivityFromPorosityTempl<is_ad>::computeQpProperties() 55 : { 56 216 : _la_qp[_qp] = _la_s * (1.0 - _porosity_qp[_qp]) + _la_f * _porosity_qp[_qp]; 57 : 58 : if constexpr (!is_ad) 59 : { 60 216 : (*_dla_qp_dvar)[_qp].assign(_num_var, RealTensorValue()); 61 648 : for (const auto v : make_range(_num_var)) 62 432 : (*_dla_qp_dvar)[_qp][v] = (_la_f - _la_s) * (*_dporosity_qp_dvar)[_qp][v]; 63 : } 64 216 : } 65 : 66 : template class PorousFlowThermalConductivityFromPorosityTempl<false>; 67 : template class PorousFlowThermalConductivityFromPorosityTempl<true>;