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 if (_num_phases != 1)
43 mooseError("The Dictator proclaims that the number of phases is ",
44 _dictator.numPhases(),
45 " whereas PorousFlow1PhaseP can only be used for 1-phase simulations. Be aware "
46 "that the Dictator has noted your mistake.");
47}
48
49template <bool is_ad>
50void
56
57template <bool is_ad>
58void
60{
61 // size stuff correctly and prepare the derivative matrices with zeroes
63
64 buildQpPPSS();
65
66 const auto ds = _pc_uo.dSaturation(_porepressure_var[_qp]);
67
68 if (!_nodal_material)
69 {
70 (*_gradp_qp)[_qp][0] = _gradp_qp_var[_qp];
71 (*_grads_qp)[_qp][0] = ds * _gradp_qp_var[_qp];
72 }
73
74 // _porepressure is only dependent on _porepressure, and its derivative is 1
75 if constexpr (!is_ad)
76 if (_dictator.isPorousFlowVariable(_porepressure_varnum))
77 {
78 // _porepressure is a PorousFlow variable
79 (*_dporepressure_dvar)[_qp][0][_p_var_num] = 1.0;
80 (*_dsaturation_dvar)[_qp][0][_p_var_num] = ds;
81
82 if (!_nodal_material)
83 {
84 (*_dgradp_qp_dgradv)[_qp][0][_p_var_num] = 1.0;
85 (*_dgrads_qp_dgradv)[_qp][0][_p_var_num] = ds;
86 (*_dgrads_qp_dv)[_qp][0][_p_var_num] =
87 _pc_uo.d2Saturation(_porepressure_var[_qp]) * _gradp_qp_var[_qp];
88 }
89 }
90}
91
92template <bool is_ad>
93void
95{
96 _porepressure[_qp][0] = _porepressure_var[_qp];
97 _saturation[_qp][0] = _pc_uo.saturation(_porepressure_var[_qp]);
98}
99
100template class PorousFlow1PhasePTempl<false>;
101template 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