https://mooseframework.inl.gov
GaussContForcing.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
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 
16 {
18  params.addParam<Real>("amplitude", 1.0, "Aplitude of the bell curve");
19  params.addParam<Real>("x_center", 4.0, "Center of the hump in the X direction");
20  params.addParam<Real>("y_center", 6.0, "Center of the hump in the Y direction");
21  params.addParam<Real>("z_center", 0.0, "Center of the hump in the Z direction");
22  params.addParam<Real>("x_spread", 1.0, "Spread of the curve in the x direction (sigma_x)");
23  params.addParam<Real>("y_spread", 1.0, "Spread of the curve in the y direction (sigma_y)");
24  params.addParam<Real>("z_spread", 1.0, "Spread of the curve in the z direction (sigma_z)");
25  return params;
26 }
27 
29  : Kernel(parameters),
30  _amplitude(getParam<Real>("amplitude")),
31  _x_center(getParam<Real>("x_center")),
32  _y_center(getParam<Real>("y_center")),
33  _z_center(getParam<Real>("z_center")),
34  _x_spread(getParam<Real>("x_spread")),
35  _y_spread(getParam<Real>("y_spread")),
36  _z_spread(getParam<Real>("z_spread")),
37  _x_min(_x_center - (3.0 * _x_spread)),
38  _x_max(_x_center + (3.0 * _x_spread)),
39  _y_min(_y_center - (3.0 * _y_spread)),
40  _y_max(_y_center + (3.0 * _y_spread)),
41  _z_min(_z_center - (3.0 * _z_spread)),
42  _z_max(_z_center + (3.0 * _z_spread))
43 {
44 }
45 
46 Real
48 {
49  Real x = _q_point[_qp](0);
50  Real y = _q_point[_qp](1);
51  Real z = _q_point[_qp](2);
52 
53  if (x >= _x_min && x <= _x_max && y >= _y_min && y <= _y_max && z >= _z_min && z <= _z_max)
54  return -_test[_i][_qp] * _amplitude *
55  std::exp(-(((x - _x_center) * (x - _x_center)) / (2.0 * _x_spread * _x_spread) +
56  ((y - _y_center) * (y - _y_center)) / (2.0 * _y_spread * _y_spread) +
57  ((z - _z_center) * (z - _z_center)) / (2.0 * _z_spread * _z_spread)));
58  else
59  return 0;
60 }
GaussContForcing(const InputParameters &parameters)
static InputParameters validParams()
static InputParameters validParams()
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
const std::vector< double > y
const Real _y_center
const Real _z_center
const Real _amplitude
const VariableTestValue & _test
const std::vector< double > x
Note: This class is duplicated from moose_test.
unsigned int _i
const Real _x_spread
virtual Real computeQpResidual()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Real _y_spread
registerMooseObject("PhaseFieldTestApp", GaussContForcing)
const Real _z_spread
const Real _x_center
const MooseArray< Point > & _q_point
unsigned int _qp