www.mooseframework.org
PorousFlowThermalConductivityFromPorosity.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 {
20  params.addRequiredParam<RealTensorValue>("lambda_s",
21  "The thermal conductivity of the solid matrix material");
22  params.addRequiredParam<RealTensorValue>("lambda_f",
23  "The thermal conductivity of the single fluid phase");
24  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  return params;
31 }
32 
33 template <bool is_ad>
36  : PorousFlowThermalConductivityBaseTempl<is_ad>(parameters),
37  _la_s(this->template getParam<RealTensorValue>("lambda_s")),
38  _la_f(this->template getParam<RealTensorValue>("lambda_f")),
39  _porosity_qp(this->template getGenericMaterialProperty<Real, is_ad>("PorousFlow_porosity_qp")),
40  _dporosity_qp_dvar(is_ad ? nullptr
41  : &this->template getMaterialProperty<std::vector<Real>>(
42  "dPorousFlow_porosity_qp_dvar"))
43 {
44  if (_num_phases != 1)
45  this->template paramError("fluid_phase",
46  "The Dictator proclaims that the number of phases is ",
47  _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 }
51 
52 template <bool is_ad>
53 void
55 {
56  _la_qp[_qp] = _la_s * (1.0 - _porosity_qp[_qp]) + _la_f * _porosity_qp[_qp];
57 
58  if constexpr (!is_ad)
59  {
60  (*_dla_qp_dvar)[_qp].assign(_num_var, RealTensorValue());
61  for (const auto v : make_range(_num_var))
62  (*_dla_qp_dvar)[_qp][v] = (_la_f - _la_s) * (*_dporosity_qp_dvar)[_qp][v];
63  }
64 }
65 
const unsigned int _num_phases
Number of phases.
void addRequiredParam(const std::string &name, const std::string &doc_string)
TensorValue< Real > RealTensorValue
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)
registerMooseObject("PorousFlowApp", PorousFlowThermalConductivityFromPorosity)
This Material calculates rock-fluid combined thermal conductivity for the single phase, fully saturated case by using a linear weighted average.