https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PorousFlowMatrixInternalEnergy.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<Real>("specific_heat_capacity",
21 "Specific heat capacity of the rock grains (J/kg/K).");
22 params.addRequiredParam<Real>("density", "Density of the rock grains");
23 params.addPrivateParam<std::string>("pf_material_type", "matrix_internal_energy");
24 params.addClassDescription("This Material calculates the internal energy of solid rock grains, "
25 "which is specific_heat_capacity * density * temperature. Kernels "
26 "multiply this by (1 - porosity) to find the energy density of the "
27 "porous rock in a rock-fluid system");
28 return params;
29}
30
31template <bool is_ad>
33 const InputParameters & parameters)
34 : PorousFlowMaterialVectorBase(parameters),
35 _cp(getParam<Real>("specific_heat_capacity")),
36 _density(getParam<Real>("density")),
37 _heat_cap(_cp * _density),
38 _temperature(getGenericMaterialProperty<Real, is_ad>(
39 _dictator.isFV() ? "PorousFlow_temperature_qp" : "PorousFlow_temperature_nodal")),
40 _dtemperature_dvar(
41 is_ad ? nullptr
42 : &getMaterialProperty<std::vector<Real>>("dPorousFlow_temperature_nodal_dvar")),
43 _energy(declareGenericProperty<Real, is_ad>("PorousFlow_matrix_internal_energy_nodal")),
44 _denergy_dvar(is_ad ? nullptr
45 : &declareProperty<std::vector<Real>>(
46 "dPorousFlow_matrix_internal_energy_nodal_dvar"))
47{
48}
49
50template <bool is_ad>
51void
53{
54 _energy[_qp] = _heat_cap * _temperature[_qp];
55}
56
57template <bool is_ad>
58void
60{
61 _energy[_qp] = _heat_cap * _temperature[_qp];
62
63 if constexpr (!is_ad)
64 {
65 (*_denergy_dvar)[_qp].assign(_num_var, 0.0);
66 for (unsigned v = 0; v < _num_var; ++v)
67 (*_denergy_dvar)[_qp][v] = _heat_cap * (*_dtemperature_dvar)[_qp][v];
68 }
69}
70
const double v
registerMooseObject("PorousFlowApp", PorousFlowMatrixInternalEnergy)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addPrivateParam(const std::string &name, const T &value)
void addClassDescription(const std::string &doc_string)
Base class for all PorousFlow vector materials.
This material computes internal energy (J/m^3) for a rock matrix assuming constant grain density,...
PorousFlowMatrixInternalEnergyTempl(const InputParameters &parameters)