www.mooseframework.org
RichardsHalfGaussianSinkFlux.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 // This post processor returns the mass due to a half-gaussian sink flux from the boundary of a
11 // volume.
12 //
14 #include "Function.h"
15 
17 
20 {
22  params.addRequiredParam<Real>("max",
23  "Maximum of the flux (measured in kg.m^-2.s^-1). Flux out "
24  "= max*exp((-0.5*(p - centre)/sd)^2) for p<centre, and Flux "
25  "out = max for p>centre. Note, to make this a source "
26  "rather than a sink, let max<0");
27  params.addRequiredParam<Real>("sd",
28  "Standard deviation of the Gaussian (measured in Pa). Flux "
29  "out = max*exp((-0.5*(p - centre)/sd)^2) for p<centre, and "
30  "Flux out = max for p>centre.");
31  params.addRequiredParam<Real>("centre",
32  "Centre of the Gaussian (measured in Pa). Flux out = "
33  "max*exp((-0.5*(p - centre)/sd)^2) for p<centre, and "
34  "Flux out = max for p>centre.");
35  params.addParam<FunctionName>(
36  "multiplying_fcn",
37  1.0,
38  "The flux will be multiplied by this spatially-and-temporally varying function.");
39  params.addRequiredParam<UserObjectName>(
40  "richardsVarNames_UO", "The UserObject that holds the list of Richards variable names.");
41  return params;
42 }
43 
46  _feproblem(dynamic_cast<FEProblemBase &>(_subproblem)),
47  _maximum(getParam<Real>("max")),
48  _sd(getParam<Real>("sd")),
49  _centre(getParam<Real>("centre")),
50  _richards_name_UO(getUserObject<RichardsVarNames>("richardsVarNames_UO")),
51  _pvar(_richards_name_UO.richards_var_num(coupled("variable"))),
52  _m_func(getFunction("multiplying_fcn")),
53  _pp(getMaterialProperty<std::vector<Real>>("porepressure"))
54 {
55 }
56 
57 Real
59 {
60  if (_pp[_qp][_pvar] >= _centre)
61  return _maximum * _dt * _m_func.value(_t, _q_point[_qp]);
62  else
63  return _maximum * exp(-0.5 * std::pow((_pp[_qp][_pvar] - _centre) / _sd, 2)) * _dt *
65 }
auto exp(const T &)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static InputParameters validParams()
const MooseArray< Point > & _q_point
This holds maps between pressure_var or pressure_var, sat_var used in RichardsMaterial and kernels...
Real _maximum
flux out = max*exp((-0.5*(p - centre)/sd)^2) for p<centre, and flux out = max otherwise ...
Postprocessor that records the mass flux from porespace to a half-gaussian sink.
void addRequiredParam(const std::string &name, const std::string &doc_string)
RichardsHalfGaussianSinkFlux(const InputParameters &parameters)
registerMooseObject("RichardsApp", RichardsHalfGaussianSinkFlux)
const Function & _m_func
the multiplier function
const MaterialProperty< std::vector< Real > > & _pp
porepressure (or porepressure vector for multiphase problems)
Real _centre
flux out = max*exp((-0.5*(p - centre)/sd)^2) for p<centre, and flux out = max otherwise ...
unsigned int _pvar
the index of this variable in the list of Richards variables held by _richards_name_UO.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual Real value(Real t, const Point &p) const
MooseUnits pow(const MooseUnits &, int)
Real _sd
flux out = max*exp((-0.5*(p - centre)/sd)^2) for p<centre, and flux out = max otherwise ...