www.mooseframework.org
LangevinNoise.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 "LangevinNoise.h"
11 #include "MooseRandom.h"
12 
13 registerMooseObject("PhaseFieldApp", LangevinNoise);
14 
17 {
19  params.addClassDescription("Source term for non-conserved Langevin noise");
20  params.addRequiredParam<Real>("amplitude", "Amplitude"); // per sqrt(time)");
21  params.addParam<MaterialPropertyName>(
22  "multiplier",
23  1.0,
24  "Material property to multiply the random numbers with (defaults to 1.0 if omitted)");
25  return params;
26 }
28  : Kernel(parameters),
29  _amplitude(getParam<Real>("amplitude")),
30  _multiplier_prop(getMaterialProperty<Real>("multiplier"))
31 {
32 }
33 
34 void
36 {
37  unsigned int rseed = _t_step;
38  MooseRandom::seed(rseed);
39 }
40 
41 Real
43 {
44  return -_test[_i][_qp] * (2.0 * MooseRandom::rand() - 1.0) * _amplitude * _multiplier_prop[_qp];
45 }
const Real _amplitude
Definition: LangevinNoise.h:27
virtual Real computeQpResidual()
Definition: LangevinNoise.C:42
static InputParameters validParams()
virtual void residualSetup()
Definition: LangevinNoise.C:35
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
LangevinNoise(const InputParameters &parameters)
Definition: LangevinNoise.C:27
const MaterialProperty< Real > & _multiplier_prop
Definition: LangevinNoise.h:28
void seed(std::size_t i, unsigned int seed)
registerMooseObject("PhaseFieldApp", LangevinNoise)
void addRequiredParam(const std::string &name, const std::string &doc_string)
int & _t_step
const VariableTestValue & _test
unsigned int _i
static InputParameters validParams()
Definition: LangevinNoise.C:16
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static Real rand()
void addClassDescription(const std::string &doc_string)
unsigned int _qp