www.mooseframework.org
RichardsPiecewiseLinearSink.h
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 #pragma once
11 
12 #include "IntegratedBC.h"
13 #include "LinearInterpolation.h"
14 #include "Function.h"
15 #include "RichardsVarNames.h"
16 #include "RichardsDensity.h"
17 #include "RichardsRelPerm.h"
18 #include "RichardsSeff.h"
19 
20 // Forward Declarations
22 
23 template <>
25 
39 class RichardsPiecewiseLinearSink : public IntegratedBC
40 {
41 public:
42  RichardsPiecewiseLinearSink(const InputParameters & parameters);
43 
44 protected:
45  virtual void computeResidual() override;
46 
47  virtual Real computeQpResidual() override;
48 
49  virtual void computeJacobian() override;
50 
51  virtual Real computeQpJacobian() override;
52 
53  virtual void computeJacobianBlock(MooseVariableFEBase & jvar) override;
54  using IntegratedBC::computeJacobianBlock;
55 
56  virtual Real computeQpOffDiagJacobian(unsigned int jvar) override;
57 
60 
63 
66 
68  LinearInterpolation _sink_func;
69 
71  const Function & _m_func;
72 
75 
77  unsigned int _num_p;
78 
80  unsigned int _pvar;
81 
84 
87 
90 
92  const PostprocessorValue & _area_pp;
93 
95  unsigned int _num_nodes;
96 
101  std::vector<Real> _nodal_density;
102 
107  std::vector<std::vector<Real>> _dnodal_density_dv;
108 
113  std::vector<Real> _nodal_relperm;
114 
119  std::vector<std::vector<Real>> _dnodal_relperm_dv;
120 
122  const MaterialProperty<std::vector<Real>> & _pp;
123 
125  const MaterialProperty<std::vector<std::vector<Real>>> & _dpp_dv;
126 
128  const MaterialProperty<std::vector<Real>> & _viscosity;
129 
131  const MaterialProperty<RealTensorValue> & _permeability;
132 
137  const MaterialProperty<std::vector<std::vector<Real>>> & _dseff_dv;
138 
140  const MaterialProperty<std::vector<Real>> & _rel_perm;
141 
143  const MaterialProperty<std::vector<std::vector<Real>>> & _drel_perm_dv;
144 
146  const MaterialProperty<std::vector<Real>> & _density;
147 
149  const MaterialProperty<std::vector<std::vector<Real>>> & _ddensity_dv;
150 
159  std::vector<const VariableValue *> _ps_at_nodes;
160 
162  void prepareNodalValues();
163 
165  Real jac(unsigned int wrt_num);
166 };
RichardsPiecewiseLinearSink::_dnodal_density_dv
std::vector< std::vector< Real > > _dnodal_density_dv
d(_nodal_density)/d(variable_ph) (variable_ph is the variable for phase=ph) These are used in the jac...
Definition: RichardsPiecewiseLinearSink.h:107
RichardsPiecewiseLinearSink::_pvar
unsigned int _pvar
the moose internal variable number corresponding to the porepressure of this sink flux
Definition: RichardsPiecewiseLinearSink.h:80
RichardsPiecewiseLinearSink::_density
const MaterialProperty< std::vector< Real > > & _density
fluid density (only the _pvar component is used)
Definition: RichardsPiecewiseLinearSink.h:146
RichardsRelPerm
Base class for Richards relative permeability classes that provide relative permeability as a functio...
Definition: RichardsRelPerm.h:23
RichardsPiecewiseLinearSink::_seff_UO
const RichardsSeff * _seff_UO
user object defining the effective saturation. Only used if _fully_upwind = true
Definition: RichardsPiecewiseLinearSink.h:86
RichardsVarNames
This holds maps between pressure_var or pressure_var, sat_var used in RichardsMaterial and kernels,...
Definition: RichardsVarNames.h:25
RichardsSeff
Base class for effective saturation as a function of porepressure(s) The functions seff,...
Definition: RichardsSeff.h:23
RichardsPiecewiseLinearSink::computeQpOffDiagJacobian
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
Definition: RichardsPiecewiseLinearSink.C:252
RichardsPiecewiseLinearSink::_area_pp
const PostprocessorValue & _area_pp
area postprocessor. if given then all bare_fluxes are divided by this quantity
Definition: RichardsPiecewiseLinearSink.h:92
RichardsPiecewiseLinearSink::_dpp_dv
const MaterialProperty< std::vector< std::vector< Real > > > & _dpp_dv
d(porepressure_i)/d(variable_j)
Definition: RichardsPiecewiseLinearSink.h:125
RichardsPiecewiseLinearSink::_use_mobility
bool _use_mobility
whether to multiply the sink flux by permeability*density/viscosity
Definition: RichardsPiecewiseLinearSink.h:59
validParams< RichardsPiecewiseLinearSink >
InputParameters validParams< RichardsPiecewiseLinearSink >()
Definition: RichardsPiecewiseLinearSink.C:22
RichardsPiecewiseLinearSink::prepareNodalValues
void prepareNodalValues()
calculates the nodal values of pressure, mobility, and derivatives thereof
Definition: RichardsPiecewiseLinearSink.C:133
RichardsPiecewiseLinearSink::_pp
const MaterialProperty< std::vector< Real > > & _pp
porepressure values (only the _pvar component is used)
Definition: RichardsPiecewiseLinearSink.h:122
RichardsPiecewiseLinearSink::_dnodal_relperm_dv
std::vector< std::vector< Real > > _dnodal_relperm_dv
d(_nodal_relperm)/d(variable_ph) (variable_ph is the variable for phase=ph) These are used in the jac...
Definition: RichardsPiecewiseLinearSink.h:119
RichardsPiecewiseLinearSink::computeQpResidual
virtual Real computeQpResidual() override
Definition: RichardsPiecewiseLinearSink.C:184
RichardsPiecewiseLinearSink::_num_p
unsigned int _num_p
number of richards variables
Definition: RichardsPiecewiseLinearSink.h:77
RichardsVarNames.h
RichardsPiecewiseLinearSink::_viscosity
const MaterialProperty< std::vector< Real > > & _viscosity
viscosity (only the _pvar component is used)
Definition: RichardsPiecewiseLinearSink.h:128
RichardsPiecewiseLinearSink::_dseff_dv
const MaterialProperty< std::vector< std::vector< Real > > > & _dseff_dv
derivative of effective saturation wrt variables only _dseff_dv[_pvar][i] is used for i being all var...
Definition: RichardsPiecewiseLinearSink.h:137
RichardsPiecewiseLinearSink::jac
Real jac(unsigned int wrt_num)
derivative of residual wrt the wrt_num Richards variable
Definition: RichardsPiecewiseLinearSink.C:261
RichardsPiecewiseLinearSink::_num_nodes
unsigned int _num_nodes
number of nodes in this element. Only used if _fully_upwind = true
Definition: RichardsPiecewiseLinearSink.h:95
RichardsPiecewiseLinearSink::computeQpJacobian
virtual Real computeQpJacobian() override
Definition: RichardsPiecewiseLinearSink.C:238
RichardsPiecewiseLinearSink::_sink_func
LinearInterpolation _sink_func
piecewise-linear function of porepressure (this defines the strength of the sink)
Definition: RichardsPiecewiseLinearSink.h:68
RichardsPiecewiseLinearSink::_drel_perm_dv
const MaterialProperty< std::vector< std::vector< Real > > > & _drel_perm_dv
d(relperm_i)/d(variable_j)
Definition: RichardsPiecewiseLinearSink.h:143
RichardsPiecewiseLinearSink::_nodal_density
std::vector< Real > _nodal_density
nodal values of fluid density These are used if _fully_upwind = true
Definition: RichardsPiecewiseLinearSink.h:101
RichardsPiecewiseLinearSink::computeResidual
virtual void computeResidual() override
Definition: RichardsPiecewiseLinearSink.C:176
RichardsSeff.h
RichardsPiecewiseLinearSink::_use_relperm
bool _use_relperm
whether to multiply the sink flux by relative permeability
Definition: RichardsPiecewiseLinearSink.h:62
RichardsPiecewiseLinearSink::_density_UO
const RichardsDensity * _density_UO
user object defining the density. Only used if _fully_upwind = true
Definition: RichardsPiecewiseLinearSink.h:83
RichardsDensity
Base class for fluid density as a function of porepressure The functions density, ddensity and d2dens...
Definition: RichardsDensity.h:24
RichardsRelPerm.h
RichardsPiecewiseLinearSink::_nodal_relperm
std::vector< Real > _nodal_relperm
nodal values of relative permeability These are used if _fully_upwind = true
Definition: RichardsPiecewiseLinearSink.h:113
RichardsPiecewiseLinearSink::_m_func
const Function & _m_func
sink flux gets multiplied by this function
Definition: RichardsPiecewiseLinearSink.h:71
RichardsPiecewiseLinearSink::_ps_at_nodes
std::vector< const VariableValue * > _ps_at_nodes
Holds the values of pressures at all the nodes of the element Only used if _fully_upwind = true Eg: _...
Definition: RichardsPiecewiseLinearSink.h:159
RichardsDensity.h
RichardsPiecewiseLinearSink::_permeability
const MaterialProperty< RealTensorValue > & _permeability
permeability
Definition: RichardsPiecewiseLinearSink.h:131
RichardsPiecewiseLinearSink::computeJacobianBlock
virtual void computeJacobianBlock(MooseVariableFEBase &jvar) override
Definition: RichardsPiecewiseLinearSink.C:244
RichardsPiecewiseLinearSink::_rel_perm
const MaterialProperty< std::vector< Real > > & _rel_perm
relative permeability (only the _pvar component is used)
Definition: RichardsPiecewiseLinearSink.h:140
RichardsPiecewiseLinearSink
Applies a flux sink to a boundary The sink is a piecewise linear function of porepressure (the "varia...
Definition: RichardsPiecewiseLinearSink.h:39
RichardsPiecewiseLinearSink::computeJacobian
virtual void computeJacobian() override
Definition: RichardsPiecewiseLinearSink.C:230
RichardsPiecewiseLinearSink::_ddensity_dv
const MaterialProperty< std::vector< std::vector< Real > > > & _ddensity_dv
d(density_i)/d(variable_j)
Definition: RichardsPiecewiseLinearSink.h:149
RichardsPiecewiseLinearSink::_relperm_UO
const RichardsRelPerm * _relperm_UO
user object defining the relative permeability. Only used if _fully_upwind = true
Definition: RichardsPiecewiseLinearSink.h:89
RichardsPiecewiseLinearSink::_fully_upwind
bool _fully_upwind
whether to use full upwinding
Definition: RichardsPiecewiseLinearSink.h:65
RichardsPiecewiseLinearSink::_richards_name_UO
const RichardsVarNames & _richards_name_UO
holds info about the names and values of richards variable in the simulation
Definition: RichardsPiecewiseLinearSink.h:74
RichardsPiecewiseLinearSink::RichardsPiecewiseLinearSink
RichardsPiecewiseLinearSink(const InputParameters &parameters)
Definition: RichardsPiecewiseLinearSink.C:78