www.mooseframework.org
PorousFlowSquarePulsePointSource.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 
11 
13 
14 template <>
15 InputParameters
17 {
18  InputParameters params = validParams<DiracKernel>();
19  params.addRequiredParam<Real>(
20  "mass_flux",
21  "The mass flux at this point in kg/s (positive is flux in, negative is flux out)");
22  params.addRequiredParam<Point>("point", "The x,y,z coordinates of the point source (sink)");
23  params.addParam<Real>(
24  "start_time", 0.0, "The time at which the source will start (Default is 0)");
25  params.addParam<Real>(
26  "end_time", 1.0e30, "The time at which the source will end (Default is 1e30)");
27  params.addClassDescription("Point source (or sink) that adds (removes) fluid at a constant mass "
28  "flux rate for times between the specified start and end times.");
29  return params;
30 }
31 
33  const InputParameters & parameters)
34  : DiracKernel(parameters),
35  _mass_flux(getParam<Real>("mass_flux")),
36  _p(getParam<Point>("point")),
37  _start_time(getParam<Real>("start_time")),
38  _end_time(getParam<Real>("end_time"))
39 {
40  // Sanity check to ensure that the end_time is greater than the start_time
41  if (_end_time <= _start_time)
42  mooseError(name(),
43  ": start time for PorousFlowSquarePulsePointSource is ",
45  " but it must be less than end time ",
46  _end_time);
47 }
48 
49 void
51 {
52  addPoint(_p, 0);
53 }
54 
55 Real
57 {
58  Real factor = 0.0;
59 
66  if (_t < _start_time || _t - _dt >= _end_time)
67  factor = 0.0;
68  else if (_t - _dt < _start_time)
69  {
70  if (_t <= _end_time)
71  factor = (_t - _start_time) / _dt;
72  else
73  factor = (_end_time - _start_time) / _dt;
74  }
75  else
76  {
77  if (_t <= _end_time)
78  factor = 1.0;
79  else
80  factor = (_end_time - (_t - _dt)) / _dt;
81  }
82 
83  // Negative sign to make a positive mass_flux in the input file a source
84  return -_test[_i][_qp] * factor * _mass_flux;
85 }
PorousFlowSquarePulsePointSource::PorousFlowSquarePulsePointSource
PorousFlowSquarePulsePointSource(const InputParameters &parameters)
Definition: PorousFlowSquarePulsePointSource.C:32
validParams< PorousFlowSquarePulsePointSource >
InputParameters validParams< PorousFlowSquarePulsePointSource >()
Definition: PorousFlowSquarePulsePointSource.C:16
PorousFlowSquarePulsePointSource::_p
const Point _p
The location of the point source (sink)
Definition: PorousFlowSquarePulsePointSource.h:37
PorousFlowSquarePulsePointSource.h
registerMooseObject
registerMooseObject("PorousFlowApp", PorousFlowSquarePulsePointSource)
PorousFlowSquarePulsePointSource::_mass_flux
const Real _mass_flux
The constant mass flux (kg/s)
Definition: PorousFlowSquarePulsePointSource.h:34
PorousFlowSquarePulsePointSource::_end_time
const Real _end_time
The time at which the point source (sink) stops operating.
Definition: PorousFlowSquarePulsePointSource.h:43
PorousFlowSquarePulsePointSource::computeQpResidual
virtual Real computeQpResidual() override
Definition: PorousFlowSquarePulsePointSource.C:56
PorousFlowSquarePulsePointSource::addPoints
virtual void addPoints() override
Definition: PorousFlowSquarePulsePointSource.C:50
name
const std::string name
Definition: Setup.h:21
PorousFlowSquarePulsePointSource
Point source (or sink) that adds (removes) fluid at a constant mass flux rate for times between the s...
Definition: PorousFlowSquarePulsePointSource.h:24
PorousFlowSquarePulsePointSource::_start_time
const Real _start_time
The time at which the point source (sink) starts operating.
Definition: PorousFlowSquarePulsePointSource.h:40