www.mooseframework.org
PorousFlowHalfCubicSink.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
9 #include "libmesh/utility.h"
10 
11 template <>
12 InputParameters
14 {
15  InputParameters params = validParams<PorousFlowSinkPTDefiner>();
16  params.addRequiredParam<Real>(
17  "max",
18  "Maximum of the cubic flux multiplier. Denote x = porepressure - center (or in the "
19  "case of a heat flux with no fluid, x = temperature - center). Then Flux out is "
20  "multiplied by (max/cutoff^3)*(2x + cutoff)(x - cutoff)^2 for cutoff < x < 0. Flux "
21  "out is multiplied by max for x >= 0. Flux out is multiplied by 0 for x <= cutoff.");
22  params.addRequiredParam<FunctionName>("cutoff",
23  "Cutoff of the cubic (measured in Pa (or K for "
24  "temperature BCs)). This needs to be less than "
25  "zero.");
26  params.addRequiredParam<Real>(
27  "center", "Center of the cubic flux multiplier (measured in Pa (or K for temperature BCs)).");
28  params.addClassDescription("Applies a flux sink to a boundary. The base flux defined by "
29  "PorousFlowSink is multiplied by a cubic.");
30  return params;
31 }
32 
33 PorousFlowHalfCubicSink::PorousFlowHalfCubicSink(const InputParameters & parameters)
34  : PorousFlowSinkPTDefiner(parameters),
35  _maximum(getParam<Real>("max")),
36  _cutoff(getFunction("cutoff")),
37  _center(getParam<Real>("center"))
38 {
39 }
40 
41 Real
43 {
44  const Real x = ptVar() - _center;
45 
46  if (x >= 0)
48 
49  const Real cutoff = _cutoff.value(_t, _q_point[_qp]);
50  if (x <= cutoff)
51  return 0.0;
52 
53  return PorousFlowSink::multiplier() * _maximum * (2 * x + cutoff) * (x - cutoff) * (x - cutoff) /
54  Utility::pow<3>(cutoff);
55 }
56 
57 Real
59 {
60  const Real x = ptVar() - _center;
61 
62  if (x >= 0)
64 
65  const Real cutoff = _cutoff.value(_t, _q_point[_qp]);
66  if (x <= cutoff)
67  return 0.0;
68 
69  const Real str =
70  _maximum * (2 * x + cutoff) * (x - cutoff) * (x - cutoff) / Utility::pow<3>(cutoff);
71  const Real deriv = _maximum * 6 * x * (x - cutoff) / Utility::pow<3>(cutoff);
72  return PorousFlowSink::dmultiplier_dvar(pvar) * str +
73  PorousFlowSink::multiplier() * deriv * dptVar(pvar);
74 }
const Real _maximum
maximum of the cubic sink
const Real _center
center of the cubic sink
Function & _cutoff
Denote x = porepressure - center. Then Flux out = (max/cutoff^3)*(2x + cutoff)(x - cutoff)^2 for cuto...
InputParameters validParams< PorousFlowSinkPTDefiner >()
virtual Real dmultiplier_dvar(unsigned int pvar) const override
d(multiplier)/d(Porous flow variable pvar)
Provides either a porepressure or a temperature to derived classes, depending on _involves_fluid defi...
virtual Real ptVar() const
Provides the variable value (either porepressure, or temperature, depending on _involves_fluid) ...
virtual Real dptVar(unsigned pvar) const
Provides the d(variable)/(d PorousFlow Variable pvar)
virtual Real multiplier() const override
The flux gets multiplied by this quantity.
virtual Real dmultiplier_dvar(unsigned int pvar) const
d(multiplier)/d(Porous flow variable pvar)
PorousFlowHalfCubicSink(const InputParameters &parameters)
InputParameters validParams< PorousFlowHalfCubicSink >()
virtual Real multiplier() const
The flux gets multiplied by this quantity.