https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PorousFlow1PhaseP.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
10#include "PorousFlow1PhaseP.h"
12
15
16template <bool is_ad>
19{
21 params.addRequiredCoupledVar("porepressure",
22 "Variable that represents the porepressure of the single phase");
23 params.addRequiredParam<UserObjectName>("capillary_pressure",
24 "Name of the UserObject defining the capillary pressure");
25 params.addClassDescription("This Material is used for the partially saturated single-phase "
26 "situation where porepressure is the primary variable");
27 return params;
28}
29
30template <bool is_ad>
32 : PorousFlowVariableBaseTempl<is_ad>(parameters),
33 _porepressure_var(_nodal_material ? this->template coupledGenericDofValue<is_ad>("porepressure")
34 : this->template coupledGenericValue<is_ad>("porepressure")),
35 _gradp_qp_var(this->template coupledGenericGradient<is_ad>("porepressure")),
36 _porepressure_varnum(coupled("porepressure")),
37 _p_var_num(_dictator.isPorousFlowVariable(_porepressure_varnum)
38 ? _dictator.porousFlowVariableNum(_porepressure_varnum)
39 : 0),
40 _pc_uo(this->template getUserObject<PorousFlowCapillaryPressure>("capillary_pressure"))
41{
42 // These are read with coupledGenericDofValue when at_nodes = true, so they must be
43 // nodal (Lagrange) variables. See #33370.
44 if (this->_nodal_material)
45 this->checkNodalVariables({"porepressure"});
46 if (_num_phases != 1)
47 mooseError("The Dictator proclaims that the number of phases is ",
48 _dictator.numPhases(),
49 " whereas PorousFlow1PhaseP can only be used for 1-phase simulations. Be aware "
50 "that the Dictator has noted your mistake.");
51}
52
53template <bool is_ad>
54void
60
61template <bool is_ad>
62void
64{
65 // size stuff correctly and prepare the derivative matrices with zeroes
67
68 buildQpPPSS();
69
70 const auto ds = _pc_uo.dSaturation(_porepressure_var[_qp]);
71
72 if (!_nodal_material)
73 {
74 (*_gradp_qp)[_qp][0] = _gradp_qp_var[_qp];
75 (*_grads_qp)[_qp][0] = ds * _gradp_qp_var[_qp];
76 }
77
78 // _porepressure is only dependent on _porepressure, and its derivative is 1
79 if constexpr (!is_ad)
80 if (_dictator.isPorousFlowVariable(_porepressure_varnum))
81 {
82 // _porepressure is a PorousFlow variable
83 (*_dporepressure_dvar)[_qp][0][_p_var_num] = 1.0;
84 (*_dsaturation_dvar)[_qp][0][_p_var_num] = ds;
85
86 if (!_nodal_material)
87 {
88 (*_dgradp_qp_dgradv)[_qp][0][_p_var_num] = 1.0;
89 (*_dgrads_qp_dgradv)[_qp][0][_p_var_num] = ds;
90 (*_dgrads_qp_dv)[_qp][0][_p_var_num] =
91 _pc_uo.d2Saturation(_porepressure_var[_qp]) * _gradp_qp_var[_qp];
92 }
93 }
94}
95
96template <bool is_ad>
97void
99{
100 _porepressure[_qp][0] = _porepressure_var[_qp];
101 _saturation[_qp][0] = _pc_uo.saturation(_porepressure_var[_qp]);
102}
103
104template class PorousFlow1PhasePTempl<false>;
105template class PorousFlow1PhasePTempl<true>;
void mooseError(Args &&... args)
registerMooseObject("PorousFlowApp", PorousFlow1PhaseP)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
Material designed to calculate fluid phase porepressure and saturation for the single-phase situation...
PorousFlow1PhasePTempl(const InputParameters &parameters)
static InputParameters validParams()
virtual void initQpStatefulProperties() override
virtual void computeQpProperties() override
void buildQpPPSS()
Assemble std::vectors of porepressure, saturation and temperature at the quadpoints.
Base class for capillary pressure for multiphase flow in porous media.
Base class for thermophysical variable materials, which assemble materials for primary variables such...
virtual void computeQpProperties() override
const unsigned int _num_phases
Number of phases.
static InputParameters validParams()
virtual void initQpStatefulProperties() override