https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PorousFlowThermalConductivityIdeal.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
14
15template <bool is_ad>
18{
20 params.addRequiredParam<RealTensorValue>(
21 "dry_thermal_conductivity",
22 "The thermal conductivity of the rock matrix when the aqueous saturation is zero");
23 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 params.addParam<Real>("exponent",
28 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 params.addParam<unsigned>("aqueous_phase_number",
34 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 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 return params;
43}
44
45template <bool is_ad>
47 const InputParameters & parameters)
48 : PorousFlowThermalConductivityBaseTempl<is_ad>(parameters),
49 _la_dry(this->template getParam<RealTensorValue>("dry_thermal_conductivity")),
50 _wet_and_dry_differ(parameters.isParamValid("wet_thermal_conductivity")),
51 _la_wet(_wet_and_dry_differ
52 ? this->template getParam<RealTensorValue>("wet_thermal_conductivity")
53 : this->template getParam<RealTensorValue>("dry_thermal_conductivity")),
54 _exponent(this->template getParam<Real>("exponent")),
55 _aqueous_phase(_num_phases > 0),
56 _aqueous_phase_number(this->template getParam<unsigned>("aqueous_phase_number")),
57 _saturation_qp(_aqueous_phase
58 ? &this->template getGenericMaterialProperty<std::vector<Real>, is_ad>(
59 "PorousFlow_saturation_qp")
60 : nullptr),
61 _dsaturation_qp_dvar(_aqueous_phase && !is_ad
62 ? &this->template getMaterialProperty<std::vector<std::vector<Real>>>(
63 "dPorousFlow_saturation_qp_dvar")
64 : nullptr)
65{
67 mooseError("PorousFlowThermalConductivityIdeal: Your aqueous phase number, ",
69 " must not exceed the number of fluid phases in the system, which is ",
71 "\n");
72}
73
74template <bool is_ad>
75void
77{
78 using std::pow;
79
80 _la_qp[_qp] = _la_dry;
81 if (_aqueous_phase && _wet_and_dry_differ)
82 _la_qp[_qp] +=
83 pow((*_saturation_qp)[_qp][_aqueous_phase_number], _exponent) * (_la_wet - _la_dry);
84
85 if constexpr (!is_ad)
86 {
87 (*_dla_qp_dvar)[_qp].assign(_num_var, RealTensorValue());
88 if (_aqueous_phase && _wet_and_dry_differ)
89 for (const auto v : make_range(_num_var))
90 (*_dla_qp_dvar)[_qp][v] =
91 _exponent * pow((*_saturation_qp)[_qp][_aqueous_phase_number], _exponent - 1.0) *
92 (*_dsaturation_qp_dvar)[_qp][_aqueous_phase_number][v] * (_la_wet - _la_dry);
93 }
94}
95
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
const double v
void mooseError(Args &&... args)
registerMooseObject("PorousFlowApp", PorousFlowThermalConductivityIdeal)
void addRequiredParam(const std::string &name, const std::string &doc_string)
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)
const unsigned int _num_phases
Number of phases.
Base class for materials that provide thermal conducitivity.
This material computes thermal conductivity for a PorousMedium - fluid system, by using Thermal condu...
const bool _aqueous_phase
Whether this is a fluid simulation.
const unsigned _aqueous_phase_number
Phase number of the aqueous phase.
PorousFlowThermalConductivityIdealTempl(const InputParameters &parameters)