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 
15 template <>
16 InputParameters
18 {
19  InputParameters params = validParams<Kernel>();
20  params.addClassDescription("Source term for non-conserved Langevin noise");
21  params.addRequiredParam<Real>("amplitude", "Amplitude"); // per sqrt(time)");
22  params.addParam<MaterialPropertyName>(
23  "multiplier",
24  1.0,
25  "Material property to multiply the random numbers with (defaults to 1.0 if omitted)");
26  return params;
27 }
28 LangevinNoise::LangevinNoise(const InputParameters & parameters)
29  : Kernel(parameters),
30  _amplitude(getParam<Real>("amplitude")),
31  _multiplier_prop(getMaterialProperty<Real>("multiplier"))
32 {
33 }
34 
35 void
37 {
38  unsigned int rseed = _t_step;
39  MooseRandom::seed(rseed);
40 }
41 
42 Real
44 {
45  return -_test[_i][_qp] * (2.0 * MooseRandom::rand() - 1.0) * _amplitude * _multiplier_prop[_qp];
46 }
LangevinNoise
Definition: LangevinNoise.h:20
LangevinNoise::_multiplier_prop
const MaterialProperty< Real > & _multiplier_prop
Definition: LangevinNoise.h:30
registerMooseObject
registerMooseObject("PhaseFieldApp", LangevinNoise)
LangevinNoise::residualSetup
virtual void residualSetup()
Definition: LangevinNoise.C:36
LangevinNoise::_amplitude
const Real _amplitude
Definition: LangevinNoise.h:29
LangevinNoise::computeQpResidual
virtual Real computeQpResidual()
Definition: LangevinNoise.C:43
LangevinNoise.h
LangevinNoise::LangevinNoise
LangevinNoise(const InputParameters &parameters)
Definition: LangevinNoise.C:28
validParams< LangevinNoise >
InputParameters validParams< LangevinNoise >()
Definition: LangevinNoise.C:17