20 "Applies a Robin (aquifer) boundary condition: flux = conductance * (P_model - "
21 "P_aquifer(z)), where P_aquifer is the far-field aquifer pressure. Using aquifer_head "
22 "automatically yields zero flux on any hydrostatic boundary whose model "
23 "head equals the aquifer head, even when the boundary has vertical extent. "
24 "FV analogue of PorousFlowAquiferBC.");
26 "The PorousFlowDictator UserObject");
27 params.
addParam<
unsigned int>(
"phase", 0,
"The fluid phase for this BC");
28 params.
addParam<
unsigned int>(
"fluid_component", 0,
"The fluid component for this BC");
31 "Gravitational acceleration vector (m/s^2), e.g. '0 0 -9.81'. "
32 "The elevation of the boundary cell is computed as the component of the "
33 "cell-centroid position vector in the direction opposite to gravity.");
34 params.
addParam<Real>(
"aquifer_head",
35 "Far-field hydraulic head of the aquifer (m above model datum). "
36 "P_aq(z) = rho * |g| * (aquifer_head - z), where rho is "
37 "the fluid density in the boundary cell. "
38 "Mutually exclusive with aquifer_pressure_at_datum.");
39 params.
addParam<Real>(
"aquifer_pressure_at_datum",
40 "Far-field aquifer pressure at datum_elevation (Pa). "
41 "P_aq(z) = aquifer_pressure_at_datum "
42 " + rho * |g| * (datum_elevation - z), where rho is "
43 "the fluid density in the boundary cell. "
44 "Mutually exclusive with aquifer_head.");
45 params.
addParam<Real>(
"datum_elevation",
47 "Elevation of the reference point for aquifer_pressure_at_datum (m).");
49 "aquifer_conductance",
50 "Conductance per unit boundary area (kg/(m^2*Pa*s)). "
51 "The mass flux leaving the domain is conductance * (P_model - P_aquifer). "
52 "Required when using the aquifer_head formulation. "
53 "Can be estimated as rho * k / (mu * L) where k is aquifer permeability (m^2), "
54 "mu is fluid viscosity (Pa.s), and L is the distance to the far-field (m).");
57 "aquifer_distance > 0",
58 "Distance from the boundary to the far-field aquifer (m). "
59 "Required when using the aquifer_pressure_at_datum formulation. "
60 "The conductance is computed internally as rho * k_nn / (mu * aquifer_distance), "
61 "where k_nn is the permeability projected onto the boundary normal, "
62 "rho is the fluid density, and mu is the fluid viscosity in the boundary cell.");
64 "aquifer_permeability",
65 "aquifer_permeability > 0",
66 "Permeability of the material between the boundary and the far-field aquifer (m^2), "
67 "used as k_nn in the conductance formula of the aquifer_pressure_at_datum formulation. "
68 "If not supplied, the boundary permeability projected onto the boundary normal is used, "
69 "which is appropriate when the aquifer is a continuation of the boundary material.");
76 _num_phases(_dictator.numPhases()),
77 _phase(getParam<unsigned
int>(
"phase")),
78 _fluid_component(getParam<unsigned
int>(
"fluid_component")),
79 _gravity(getParam<RealVectorValue>(
"gravity")),
81 _use_head_form(isParamValid(
"aquifer_head")),
82 _aquifer_head(_use_head_form ? getParam<Real>(
"aquifer_head") : 0.0),
83 _p_datum(!_use_head_form && isParamValid(
"aquifer_pressure_at_datum")
84 ? getParam<Real>(
"aquifer_pressure_at_datum")
86 _datum_elevation(getParam<Real>(
"datum_elevation")),
87 _conductance(_use_head_form && isParamValid(
"aquifer_conductance")
88 ? getParam<Real>(
"aquifer_conductance")
90 _aquifer_distance(!_use_head_form && isParamValid(
"aquifer_distance")
91 ? getParam<Real>(
"aquifer_distance")
93 _use_aquifer_perm(isParamValid(
"aquifer_permeability")),
94 _aquifer_permeability(_use_aquifer_perm ? getParam<Real>(
"aquifer_permeability") : 0.0),
95 _density(getADMaterialProperty<
std::vector<Real>>(
"PorousFlow_fluid_phase_density_qp")),
97 getNeighborADMaterialProperty<
std::vector<Real>>(
"PorousFlow_fluid_phase_density_qp")),
98 _viscosity(getADMaterialProperty<
std::vector<Real>>(
"PorousFlow_viscosity_qp")),
100 getNeighborADMaterialProperty<
std::vector<Real>>(
"PorousFlow_viscosity_qp")),
101 _relperm(getADMaterialProperty<
std::vector<Real>>(
"PorousFlow_relative_permeability_qp")),
103 getNeighborADMaterialProperty<
std::vector<Real>>(
"PorousFlow_relative_permeability_qp")),
105 getADMaterialProperty<
std::vector<
std::vector<Real>>>(
"PorousFlow_mass_frac_qp")),
106 _mass_fractions_neighbor(
107 getNeighborADMaterialProperty<
std::vector<
std::vector<Real>>>(
"PorousFlow_mass_frac_qp")),
108 _permeability(getADMaterialProperty<RealTensorValue>(
"PorousFlow_permeability_qp")),
109 _permeability_neighbor(
110 getNeighborADMaterialProperty<RealTensorValue>(
"PorousFlow_permeability_qp")),
111 _pressure(getADMaterialProperty<
std::vector<Real>>(
"PorousFlow_porepressure_qp")),
113 getNeighborADMaterialProperty<
std::vector<Real>>(
"PorousFlow_porepressure_qp"))
118 "The Dictator proclaims that the maximum fluid phase index in this simulation is ",
120 " whereas you have used ",
122 ". Remember that indexing starts at 0. The Dictator does not take such mistakes lightly.");
127 "The Dictator proclaims that the maximum fluid component index in this simulation is ",
129 " whereas you have used ",
131 ". Remember that indexing starts at 0.");
134 const bool has_pdat =
isParamValid(
"aquifer_pressure_at_datum");
136 if (has_head && has_pdat)
138 "Specify either aquifer_head or aquifer_pressure_at_datum, not both.");
140 if (!has_head && !has_pdat)
142 "Either aquifer_head or aquifer_pressure_at_datum must be specified.");
146 "This parameter must be specified when using the aquifer_head formulation.");
150 "This parameter must be specified when using the aquifer_pressure_at_datum "
155 "aquifer_permeability is only used with the aquifer_pressure_at_datum "
156 "formulation; with aquifer_head the conductance is supplied directly via "
157 "aquifer_conductance.");
163 const bool out_of_elem = (
_face_type == FaceInfo::VarFaceNeighbors::ELEM);
169 const Point & centroid =
171 const Real z = (
_g > 0.0) ? -centroid * (
_gravity /
_g) : 0.0;
205 const auto flux = massfrac * relperm * conductance * (
p - p_aq);
207 return out_of_elem ? flux : -flux;
DualNumber< Real, DNDerivativeType, true > ADReal
registerADMooseObject("PorousFlowApp", FVPorousFlowAquiferBC)
void ErrorVector unsigned int
const FaceInfo * _face_info
ADRealVectorValue _normal
FaceInfo::VarFaceNeighbors _face_type
static InputParameters validParams()
Robin (aquifer) boundary condition for finite-volume PorousFlow.
const Real _aquifer_head
Far-field hydraulic head [m] (head formulation only)
const ADMaterialProperty< std::vector< std::vector< Real > > > & _mass_fractions_neighbor
const ADMaterialProperty< RealTensorValue > & _permeability_neighbor
const ADMaterialProperty< std::vector< Real > > & _viscosity
Fluid viscosity.
const ADMaterialProperty< std::vector< Real > > & _relperm_neighbor
const ADMaterialProperty< std::vector< Real > > & _relperm
Relative permeability.
const Real _p_datum
Far-field pressure at datum_elevation [Pa] (pressure formulation only)
const ADMaterialProperty< RealTensorValue > & _permeability
Permeability.
const unsigned int _phase
Index of the fluid phase this BC applies to.
const PorousFlowDictator & _dictator
UserObject that holds information (number of phases, components, etc)
const unsigned int _num_phases
Number of fluid phases present.
const bool _use_aquifer_perm
True when the user supplied aquifer_permeability; false means the boundary k_nn is used.
const RealVectorValue _gravity
Gravitational acceleration vector [m/s^2].
const ADMaterialProperty< std::vector< Real > > & _density
Fluid density.
const ADMaterialProperty< std::vector< Real > > & _pressure
Fluid pressure.
static InputParameters validParams()
const bool _use_head_form
True when aquifer_head formulation is used; false for pressure-at-datum formulation.
const ADMaterialProperty< std::vector< Real > > & _pressure_neighbor
const Real _conductance
Conductance per unit boundary area [kg/(m^2 Pa s)] (head formulation only)
const Real _aquifer_permeability
User-supplied permeability of the material between boundary and aquifer [m^2].
FVPorousFlowAquiferBC(const InputParameters ¶ms)
const Real _datum_elevation
Reference elevation for pressure-at-datum formulation [m].
virtual ADReal computeQpResidual() override
const Real _aquifer_distance
Distance from boundary to far-field aquifer [m] (pressure formulation only)
const Real _g
Magnitude of gravity.
const ADMaterialProperty< std::vector< Real > > & _viscosity_neighbor
const ADMaterialProperty< std::vector< Real > > & _density_neighbor
const unsigned int _fluid_component
Index of the fluid component this BC applies to.
const ADMaterialProperty< std::vector< std::vector< Real > > > & _mass_fractions
Mass fraction of fluid components in fluid phases.
const Point & neighborCentroid() const
const Point & elemCentroid() const
void paramError(const std::string ¶m, Args... args) const
bool isParamValid(const std::string &name) const
This holds maps between the nonlinear variables used in a PorousFlow simulation and the variable numb...
unsigned int numComponents() const
The number of fluid components.