www.mooseframework.org
GaussContForcing.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 #include "GaussContForcing.h"
8 
9 template <>
10 InputParameters
12 {
13  InputParameters params = validParams<Kernel>();
14  params.addParam<Real>("amplitude", 1.0, "Aplitude of the bell curve");
15  params.addParam<Real>("x_center", 4.0, "Center of the hump in the X direction");
16  params.addParam<Real>("y_center", 6.0, "Center of the hump in the Y direction");
17  params.addParam<Real>("z_center", 0.0, "Center of the hump in the Z direction");
18  params.addParam<Real>("x_spread", 1.0, "Spread of the curve in the x direction (sigma_x)");
19  params.addParam<Real>("y_spread", 1.0, "Spread of the curve in the y direction (sigma_y)");
20  params.addParam<Real>("z_spread", 1.0, "Spread of the curve in the z direction (sigma_z)");
21  return params;
22 }
23 
24 GaussContForcing::GaussContForcing(const InputParameters & parameters)
25  : Kernel(parameters),
26  _amplitude(getParam<Real>("amplitude")),
27  _x_center(getParam<Real>("x_center")),
28  _y_center(getParam<Real>("y_center")),
29  _z_center(getParam<Real>("z_center")),
30  _x_spread(getParam<Real>("x_spread")),
31  _y_spread(getParam<Real>("y_spread")),
32  _z_spread(getParam<Real>("z_spread")),
33  _x_min(_x_center - (3.0 * _x_spread)),
34  _x_max(_x_center + (3.0 * _x_spread)),
35  _y_min(_y_center - (3.0 * _y_spread)),
36  _y_max(_y_center + (3.0 * _y_spread)),
37  _z_min(_z_center - (3.0 * _z_spread)),
38  _z_max(_z_center + (3.0 * _z_spread))
39 {
40 }
41 
42 Real
44 {
45  Real x = _q_point[_qp](0);
46  Real y = _q_point[_qp](1);
47  Real z = _q_point[_qp](2);
48 
49  if (x >= _x_min && x <= _x_max && y >= _y_min && y <= _y_max && z >= _z_min && z <= _z_max)
50  return -_test[_i][_qp] * _amplitude *
51  std::exp(-(((x - _x_center) * (x - _x_center)) / (2.0 * _x_spread * _x_spread) +
52  ((y - _y_center) * (y - _y_center)) / (2.0 * _y_spread * _y_spread) +
53  ((z - _z_center) * (z - _z_center)) / (2.0 * _z_spread * _z_spread)));
54  else
55  return 0;
56 }
GaussContForcing(const InputParameters &parameters)
const Real _y_center
const Real _z_center
const Real _amplitude
const Real _x_spread
virtual Real computeQpResidual()
const Real _y_spread
InputParameters validParams< GaussContForcing >()
const Real _z_spread
const Real _x_center