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