https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PorousFlowHalfCubicSink.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
11#include "libmesh/utility.h"
12
14
17{
19 params.addRequiredParam<Real>(
20 "max",
21 "Maximum of the cubic flux multiplier. Denote x = porepressure - center (or in the "
22 "case of a heat flux with no fluid, x = temperature - center). Then Flux out is "
23 "multiplied by (max/cutoff^3)*(2x + cutoff)(x - cutoff)^2 for cutoff < x < 0. Flux "
24 "out is multiplied by max for x >= 0. Flux out is multiplied by 0 for x <= cutoff.");
25 params.addRequiredParam<FunctionName>("cutoff",
26 "Cutoff of the cubic (measured in Pa (or K for "
27 "temperature BCs)). This needs to be less than "
28 "zero.");
29 params.addRequiredParam<Real>(
30 "center", "Center of the cubic flux multiplier (measured in Pa (or K for temperature BCs)).");
31 params.addClassDescription("Applies a flux sink to a boundary. The base flux defined by "
32 "PorousFlowSink is multiplied by a cubic.");
33 return params;
34}
35
37 : PorousFlowSinkPTDefiner(parameters),
38 _maximum(getParam<Real>("max")),
39 _cutoff(getFunction("cutoff")),
40 _center(getParam<Real>("center"))
41{
42}
43
44Real
46{
47 const Real x = ptVar() - _center;
48
49 if (x >= 0)
51
52 const Real cutoff = _cutoff.value(_t, _q_point[_qp]);
53 if (x <= cutoff)
54 return 0.0;
55
56 return PorousFlowSink::multiplier() * _maximum * (2 * x + cutoff) * (x - cutoff) * (x - cutoff) /
57 Utility::pow<3>(cutoff);
58}
59
60Real
62{
63 const Real x = ptVar() - _center;
64
65 if (x >= 0)
67
68 const Real cutoff = _cutoff.value(_t, _q_point[_qp]);
69 if (x <= cutoff)
70 return 0.0;
71
72 const Real str =
73 _maximum * (2 * x + cutoff) * (x - cutoff) * (x - cutoff) / Utility::pow<3>(cutoff);
74 const Real deriv = _maximum * 6 * x * (x - cutoff) / Utility::pow<3>(cutoff);
75 return PorousFlowSink::dmultiplier_dvar(pvar) * str +
76 PorousFlowSink::multiplier() * deriv * dptVar(pvar);
77}
const std::vector< double > x
registerMooseObject("PorousFlowApp", PorousFlowHalfCubicSink)
virtual Real value(Real t, const Point &p) const
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
unsigned int _qp
const MooseArray< Point > & _q_point
Applies a flux sink to a boundary.
static InputParameters validParams()
virtual Real dmultiplier_dvar(unsigned int pvar) const override
d(multiplier)/d(Porous flow variable pvar)
const Real _maximum
Maximum of the cubic sink.
PorousFlowHalfCubicSink(const InputParameters &parameters)
const Real _center
Center of the cubic sink.
const Function & _cutoff
Denote x = porepressure - center. Then Flux out = (max/cutoff^3)*(2x + cutoff)(x - cutoff)^2 for cuto...
virtual Real multiplier() const override
The flux gets multiplied by this quantity.
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)
static InputParameters validParams()
virtual Real dptVar(unsigned pvar) const
Provides the d(variable)/(d PorousFlow Variable pvar)
virtual Real dmultiplier_dvar(unsigned int pvar) const
d(multiplier)/d(Porous flow variable pvar)
virtual Real multiplier() const
The flux gets multiplied by this quantity.