www.mooseframework.org
PorousFlow1PhaseP.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
13 registerMooseObject("PorousFlowApp", PorousFlow1PhaseP);
14 
15 template <>
16 InputParameters
18 {
19  InputParameters params = validParams<PorousFlowVariableBase>();
20  params.addRequiredCoupledVar("porepressure",
21  "Variable that represents the porepressure of the single phase");
22  params.addRequiredParam<UserObjectName>("capillary_pressure",
23  "Name of the UserObject defining the capillary pressure");
24  params.addClassDescription("This Material is used for the fully saturated single-phase situation "
25  "where porepressure is the primary variable");
26  return params;
27 }
28 
29 PorousFlow1PhaseP::PorousFlow1PhaseP(const InputParameters & parameters)
30  : PorousFlowVariableBase(parameters),
31 
32  _porepressure_var(_nodal_material ? coupledDofValues("porepressure")
33  : coupledValue("porepressure")),
34  _gradp_qp_var(coupledGradient("porepressure")),
35  _porepressure_varnum(coupled("porepressure")),
36  _p_var_num(_dictator.isPorousFlowVariable(_porepressure_varnum)
37  ? _dictator.porousFlowVariableNum(_porepressure_varnum)
38  : 0),
39  _pc_uo(getUserObject<PorousFlowCapillaryPressure>("capillary_pressure"))
40 {
41  if (_num_phases != 1)
42  mooseError("The Dictator proclaims that the number of phases is ",
43  _dictator.numPhases(),
44  " whereas PorousFlow1PhaseP can only be used for 1-phase simulations. Be aware "
45  "that the Dictator has noted your mistake.");
46 }
47 
48 void
50 {
52  buildQpPPSS();
53 }
54 
55 void
57 {
58  // size stuff correctly and prepare the derivative matrices with zeroes
60 
61  buildQpPPSS();
62  const Real ds = _pc_uo.dSaturation(_porepressure_var[_qp]);
63 
64  if (!_nodal_material)
65  {
66  (*_gradp_qp)[_qp][0] = _gradp_qp_var[_qp];
67  (*_grads_qp)[_qp][0] = ds * _gradp_qp_var[_qp];
68  }
69 
70  // _porepressure is only dependent on _porepressure, and its derivative is 1
71  if (_dictator.isPorousFlowVariable(_porepressure_varnum))
72  {
73  // _porepressure is a PorousFlow variable
74  _dporepressure_dvar[_qp][0][_p_var_num] = 1.0;
75  _dsaturation_dvar[_qp][0][_p_var_num] = ds;
76  if (!_nodal_material)
77  {
78  (*_dgradp_qp_dgradv)[_qp][0][_p_var_num] = 1.0;
79  (*_dgrads_qp_dgradv)[_qp][0][_p_var_num] = ds;
80  (*_dgrads_qp_dv)[_qp][0][_p_var_num] =
82  }
83  }
84 }
85 
86 void
88 {
89  _porepressure[_qp][0] = _porepressure_var[_qp];
91 }
PorousFlowCapillaryPressure::dSaturation
Real dSaturation(Real pc, unsigned qp=0) const
Derivative of saturation wrt capillary pressure.
Definition: PorousFlowCapillaryPressure.C:103
PorousFlowVariableBase::computeQpProperties
virtual void computeQpProperties() override
Definition: PorousFlowVariableBase.C:74
PorousFlow1PhaseP::initQpStatefulProperties
virtual void initQpStatefulProperties() override
Definition: PorousFlow1PhaseP.C:49
PorousFlow1PhaseP::_gradp_qp_var
const VariableGradient & _gradp_qp_var
Gradient(_porepressure at quadpoints)
Definition: PorousFlow1PhaseP.h:42
PorousFlowCapillaryPressure
Base class for capillary pressure for multiphase flow in porous media.
Definition: PorousFlowCapillaryPressure.h:39
validParams< PorousFlow1PhaseP >
InputParameters validParams< PorousFlow1PhaseP >()
Definition: PorousFlow1PhaseP.C:17
PorousFlowVariableBase::_num_phases
const unsigned int _num_phases
Number of phases.
Definition: PorousFlowVariableBase.h:35
PorousFlowCapillaryPressure.h
PorousFlowVariableBase
Base class for thermophysical variable materials, which assemble materials for primary variables such...
Definition: PorousFlowVariableBase.h:25
PorousFlow1PhaseP::PorousFlow1PhaseP
PorousFlow1PhaseP(const InputParameters &parameters)
Definition: PorousFlow1PhaseP.C:29
PorousFlowVariableBase::_porepressure
MaterialProperty< std::vector< Real > > & _porepressure
Computed nodal or quadpoint values of porepressure of the phases.
Definition: PorousFlowVariableBase.h:44
registerMooseObject
registerMooseObject("PorousFlowApp", PorousFlow1PhaseP)
PorousFlowVariableBase::_dporepressure_dvar
MaterialProperty< std::vector< std::vector< Real > > > & _dporepressure_dvar
d(porepressure)/d(PorousFlow variable)
Definition: PorousFlowVariableBase.h:47
PorousFlow1PhaseP::computeQpProperties
virtual void computeQpProperties() override
Definition: PorousFlow1PhaseP.C:56
PorousFlow1PhaseP::_pc_uo
const PorousFlowCapillaryPressure & _pc_uo
Capillary pressure UserObject.
Definition: PorousFlow1PhaseP.h:48
PorousFlow1PhaseP.h
PorousFlow1PhaseP::_porepressure_varnum
const unsigned int _porepressure_varnum
Moose variable number of the porepressure.
Definition: PorousFlow1PhaseP.h:44
PorousFlowCapillaryPressure::d2Saturation
Real d2Saturation(Real pc, unsigned qp=0) const
Second derivative of saturation wrt capillary pressure.
Definition: PorousFlowCapillaryPressure.C:109
PorousFlow1PhaseP::_porepressure_var
const VariableValue & _porepressure_var
Nodal or quadpoint value of porepressure of the fluid phase.
Definition: PorousFlow1PhaseP.h:40
PorousFlowVariableBase::initQpStatefulProperties
virtual void initQpStatefulProperties() override
Definition: PorousFlowVariableBase.C:66
PorousFlowVariableBase::_saturation
MaterialProperty< std::vector< Real > > & _saturation
Computed nodal or qp saturation of the phases.
Definition: PorousFlowVariableBase.h:59
PorousFlow1PhaseP::buildQpPPSS
void buildQpPPSS()
Assemble std::vectors of porepressure, saturation and temperature at the quadpoints.
Definition: PorousFlow1PhaseP.C:87
PorousFlowCapillaryPressure::saturation
Real saturation(Real pc, unsigned qp=0) const
Saturation as a function of capillary pressure.
Definition: PorousFlowCapillaryPressure.C:97
PorousFlowVariableBase::_dsaturation_dvar
MaterialProperty< std::vector< std::vector< Real > > > & _dsaturation_dvar
d(saturation)/d(PorousFlow variable)
Definition: PorousFlowVariableBase.h:62
PorousFlow1PhaseP::_p_var_num
const unsigned int _p_var_num
The PorousFlow variable number of the porepressure.
Definition: PorousFlow1PhaseP.h:46
validParams< PorousFlowVariableBase >
InputParameters validParams< PorousFlowVariableBase >()
Definition: PorousFlowVariableBase.C:14
PorousFlow1PhaseP
Base material designed to calculate fluid phase porepressure and saturation for the single-phase situ...
Definition: PorousFlow1PhaseP.h:25