www.mooseframework.org
PorousFlowThermalConductivityIdeal.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
15 template <bool is_ad>
18 {
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 
45 template <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 
74 template <bool is_ad>
75 void
77 {
78  _la_qp[_qp] = _la_dry;
79  if (_aqueous_phase && _wet_and_dry_differ)
80  _la_qp[_qp] +=
81  std::pow((*_saturation_qp)[_qp][_aqueous_phase_number], _exponent) * (_la_wet - _la_dry);
82 
83  if constexpr (!is_ad)
84  {
85  (*_dla_qp_dvar)[_qp].assign(_num_var, RealTensorValue());
86  if (_aqueous_phase && _wet_and_dry_differ)
87  for (const auto v : make_range(_num_var))
88  (*_dla_qp_dvar)[_qp][v] =
89  _exponent * std::pow((*_saturation_qp)[_qp][_aqueous_phase_number], _exponent - 1.0) *
90  (*_dsaturation_qp_dvar)[_qp][_aqueous_phase_number][v] * (_la_wet - _la_dry);
91  }
92 }
93 
const unsigned int _num_phases
Number of phases.
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void mooseError(Args &&... args)
const bool _aqueous_phase
Whether this is a fluid simulation.
void addRequiredParam(const std::string &name, const std::string &doc_string)
TensorValue< Real > RealTensorValue
registerMooseObject("PorousFlowApp", PorousFlowThermalConductivityIdeal)
PorousFlowThermalConductivityIdealTempl(const InputParameters &parameters)
This material computes thermal conductivity for a PorousMedium - fluid system, by using Thermal condu...
const unsigned _aqueous_phase_number
Phase number of the aqueous phase.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::string v
Definition: NS.h:82
Base class for materials that provide thermal conducitivity.
IntRange< T > make_range(T beg, T end)
void addClassDescription(const std::string &doc_string)
MooseUnits pow(const MooseUnits &, int)