www.mooseframework.org
PorousFlowSquarePulsePointSource.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 
10 template <>
11 InputParameters
13 {
14  InputParameters params = validParams<DiracKernel>();
15  params.addRequiredParam<Real>(
16  "mass_flux",
17  "The mass flux at this point in kg/s (positive is flux in, negative is flux out)");
18  params.addRequiredParam<Point>("point", "The x,y,z coordinates of the point source (sink)");
19  params.addParam<Real>(
20  "start_time", 0.0, "The time at which the source will start (Default is 0)");
21  params.addParam<Real>(
22  "end_time", 1.0e30, "The time at which the source will end (Default is 1e30)");
23  params.addClassDescription("Point source (or sink) that adds (removes) fluid at a constant mass "
24  "flux rate for times between the specified start and end times.");
25  return params;
26 }
27 
29  const InputParameters & parameters)
30  : DiracKernel(parameters),
31  _mass_flux(getParam<Real>("mass_flux")),
32  _p(getParam<Point>("point")),
33  _start_time(getParam<Real>("start_time")),
34  _end_time(getParam<Real>("end_time"))
35 {
37  if (_end_time <= _start_time)
38  mooseError("Start time for PorousFlowSquarePulsePointSource is ",
40  " but it must be less than end time ",
41  _end_time);
42 }
43 
44 void
46 {
47  addPoint(_p, 0);
48 }
49 
50 Real
52 {
53  Real factor = 0.0;
54 
61  if (_t < _start_time || _t - _dt >= _end_time)
62  factor = 0.0;
63  else if (_t - _dt < _start_time)
64  {
65  if (_t <= _end_time)
66  factor = (_t - _start_time) / _dt;
67  else
68  factor = (_end_time - _start_time) / _dt;
69  }
70  else
71  {
72  if (_t <= _end_time)
73  factor = 1.0;
74  else
75  factor = (_end_time - (_t - _dt)) / _dt;
76  }
77 
79  return -_test[_i][_qp] * factor * _mass_flux;
80 }
const Real _end_time
The time at which the point source (sink) stops operating.
const Real _start_time
The time at which the point source (sink) starts operating.
const Real _mass_flux
The constant mass flux (kg/s)
InputParameters validParams< PorousFlowSquarePulsePointSource >()
const Point _p
The location of the point source (sink)
PorousFlowSquarePulsePointSource(const InputParameters &parameters)