11#include "libmesh/utility.h"
12#include "libmesh/dense_matrix.h"
13#include "libmesh/dense_vector.h"
30expMoments(
const Real s, std::array<Real, 3> &
mu)
34 const Real e = std::exp(-s);
35 mu[0] = -std::expm1(-s);
36 mu[1] = 1.0 - e * (1.0 + s);
37 mu[2] = 2.0 - e * (2.0 + s * (2.0 + s));
42 for (
unsigned int k = 0; k < 3; ++k)
45 Real term = s_power / (k + 1.0);
47 for (
unsigned int n = 1; n < 30 && term > 1.0E-17 * sum; ++n)
49 term *= s / (k + 1.0 + n);
52 mu[k] = std::exp(-s) * sum;
63 "thermal_opening_coeff",
64 "Change in porosity per unit heat content of the adjacent matrix. The heat content, "
65 "I = int (T - matrix_reference_temperature) dz, has units K.m, so when porosity represents "
66 "the aperture of a lower-dimensional fracture this coefficient has units 1/K. Porosity "
67 "changes by -thermal_opening_coeff * I, so cooling (I < 0) opens the fracture when this "
68 "coefficient is positive");
70 "matrix_thermal_diffusivity",
71 "matrix_thermal_diffusivity > 0",
72 "Thermal diffusivity of the matrix adjacent to the "
73 "fracture (thermal conductivity divided by "
74 "volumetric heat capacity), m^2/s. This is the diffusivity in the "
75 "direction normal to the fracture (or the matrix is "
76 "assumed isotropic), and it is assumed constant");
78 "matrix_reference_temperature",
79 "Undisturbed temperature of the matrix adjacent to the fracture. This should usually be a "
80 "linear-lagrange variable or a constant");
84 "Time at which the temperature at the fracture face first starts to change "
85 "(for instance, when injection begins). The matrix adjacent to the fracture "
86 "is at matrix_reference_temperature at this time, and the thermal-opening "
87 "term is zero before it");
90 "matrix_thickness > 0",
91 "Thickness of the matrix layer next to the fracture, for instance half the spacing between "
92 "parallel fractures. If given, the far side of the layer is insulated, so the heat content, "
93 "and hence the thermal opening, is bounded. If not given, the matrix is semi-infinite");
95 "This Material calculates porosity (usually the aperture of a lower-dimensional fracture) "
96 "using the PorousFlowPorosityLinear relationship plus a thermal-opening term proportional to "
97 "the heat content of the adjacent matrix, which is computed using the semi-analytic method "
98 "of Vinsome and Westerveld (1980)");
105 _thermal_opening_coeff(getParam<Real>(
"thermal_opening_coeff")),
106 _kappa(getParam<Real>(
"matrix_thermal_diffusivity")),
107 _T_matrix_ref(nodalOrQpValue(
"matrix_reference_temperature")),
108 _start_time(getParam<Real>(
"vw_start_time")),
109 _finite_thickness(isParamValid(
"matrix_thickness")),
110 _matrix_thickness(_finite_thickness ? getParam<Real>(
"matrix_thickness") : 0.0),
111 _theta(_nodal_material ? declareProperty<Real>(
"PorousFlow_vw_theta_nodal")
112 : declareProperty<Real>(
"PorousFlow_vw_theta_qp")),
113 _theta_old(_nodal_material ? getMaterialPropertyOld<Real>(
"PorousFlow_vw_theta_nodal")
114 : getMaterialPropertyOld<Real>(
"PorousFlow_vw_theta_qp")),
115 _heat_content(_nodal_material ? declareProperty<Real>(
"PorousFlow_vw_heat_content_nodal")
116 : declareProperty<Real>(
"PorousFlow_vw_heat_content_qp")),
117 _heat_content_old(_nodal_material
118 ? getMaterialPropertyOld<Real>(
"PorousFlow_vw_heat_content_nodal")
119 : getMaterialPropertyOld<Real>(
"PorousFlow_vw_heat_content_qp")),
120 _profile_matrix(3, 3),
133 mooseError(
"PorousFlowPorosityVinsomeWesterveld: a temperature Material is required");
150 const Real theta = (*_temperature)[_qp] -
_T_matrix_ref[_qp];
168 const Real
a =
_kappa * std::min(_dt, time);
173 const Real
d = 0.5 * std::sqrt(
_kappa * time);
174 const Real denom = 3.0 *
d *
d +
a;
180 const Real dp_dT = (
a /
d - Utility::pow<3>(
d) /
a) / denom;
181 dI_dT =
a * (1.0 /
d - dp_dT);
196 const Real
d = 0.5 * std::sqrt(
_kappa * time);
198 const Real time_step = std::min(_dt, time);
210 const Real ap = 4.0 * time_step / time;
211 const Real e = std::exp(-s);
213 const std::array<Real, 3> &
mu =
_mu;
221 m(1, 1) = -2.0 + e * (s - 2.0);
222 m(1, 2) = 2.0 + e * (2.0 + s * (s - 4.0));
224 m(2, 0) =
mu[0] * (1.0 - ap);
225 m(2, 1) =
mu[1] + ap * (
mu[0] + s * e);
226 m(2, 2) =
mu[2] - ap * s * e * (2.0 - s);
239 m.lu_solve(drhs, dx);
241 dI_dT =
d * (
mu[0] * dx(0) +
mu[1] * dx(1) +
mu[2] * dx(2));
246 for (
unsigned int pvar = 0; pvar <
_num_var; ++pvar)
const std::vector< double > x
void mooseError(Args &&... args)
registerMooseObject("PorousFlowApp", PorousFlowPorosityVinsomeWesterveld)
const unsigned int _num_var
Number of PorousFlow variables.
MaterialProperty< std::vector< Real > > *const _dporosity_dvar
d(porosity)/d(PorousFlow variable)
GenericMaterialProperty< Real, is_ad > & _porosity
Computed porosity at the nodes or quadpoints.
Material designed to provide the porosity in PorousFlow simulations porosity_ref + P_coeff * (P - P_r...
virtual void initQpStatefulProperties() override
static InputParameters validParams()
const MaterialProperty< std::vector< Real > > * _dtemperature_dvar
virtual void initialSetup() override
virtual void computeUnboundedPorosityQp()
Computes porosity and its derivatives at the current node or quadrature point, without applying the p...
const MaterialProperty< Real > * _temperature
Porosity (typically the aperture of a lower-dimensional fracture) given by the PorousFlowPorosityLine...
virtual void initialSetup() override
virtual void computeUnboundedPorosityQp() override
Computes porosity and its derivatives at the current node or quadrature point, without applying the p...
const VariableValue & _T_matrix_ref
Undisturbed (reference) matrix temperature.
const Real _kappa
Thermal diffusivity of the matrix in the direction normal to the fracture (m^2/s),...
const Real _matrix_thickness
Thickness of the matrix layer that contributes to the opening (used if _finite_thickness)
const Real _thermal_opening_coeff
Change of porosity per unit matrix heat content (units 1/K when porosity is an aperture)
DenseVector< Real > _profile_drhs
const MaterialProperty< Real > & _heat_content_old
Old value of the heat content.
const MaterialProperty< Real > & _theta_old
Old value of theta.
const Real _start_time
Time at which the matrix temperature profile is undisturbed.
DenseMatrix< Real > _profile_matrix
For a matrix layer of finite thickness: the linear system for the profile coefficients,...
const bool _finite_thickness
Whether only a layer of finite thickness next to the fracture contributes to the opening.
std::array< Real, 3 > _mu
For a matrix layer of finite thickness: the moments mu_k = int_0^s x^k exp(-x) dx (k = 0,...
static InputParameters validParams()
DenseVector< Real > _profile_dsol
DenseVector< Real > _profile_sol
virtual void initQpStatefulProperties() override
MaterialProperty< Real > & _theta
Temperature change at the fracture face, theta = T - T_matrix_ref.
DenseVector< Real > _profile_rhs
MaterialProperty< Real > & _heat_content
Heat content of the adjacent matrix, I = int (T - T_matrix_ref) dz.
PorousFlowPorosityVinsomeWesterveld(const InputParameters ¶meters)
void resize(const unsigned int new_m, const unsigned int new_n)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real