13 #include "libmesh/utility.h" 23 "Wavelength cut off (set to about twice the interfacial width)");
26 "Number of random fourier series terms (this will result in non-periodic noise). Omit this " 27 "parameter to obtain a periodic noise distribution.");
28 params.
addParam<
unsigned int>(
"seed", 12455,
"Random number generator seed");
34 _lambda(getParam<
Real>(
"lambda")),
35 _fe_problem(*getCheckedPointerParam<
FEProblemBase *>(
"_fe_problem_base"))
38 rng.
seed(0, getParam<unsigned int>(
"seed"));
43 _series.resize(getParam<unsigned int>(
"num_terms"));
49 "If specifying the number of terms, supply a number greater than zero.");
75 if (!
mesh.isRegularOrthogonal())
76 mooseError(
"Periodic Fourier Noise requires a regular orthogonal mesh.");
82 const int xmax = rmax / dx;
83 const int ymax = rmax / dy;
85 const Real rmax2 = rmax * rmax;
86 for (
int x = 0;
x < xmax; ++
x)
87 for (
int y = -ymax;
y < ymax; ++
y)
92 if (
f.k.norm_sq() <= rmax2)
109 v +=
f.s * std::sin(p *
f.k) +
f.c * std::cos(p *
f.k);
118 v +=
f.s * std::sin(p *
f.k) +
f.c * std::cos(p *
f.k);
registerMooseObject("PhaseFieldApp", FourierNoise)
FEProblemBase & _fe_problem
FEProblem pointer for obtaining the current mesh.
void seed(std::size_t i, unsigned int seed)
const std::vector< double > y
DualNumber< Real, DNDerivativeType, true > ADReal
Real randNormal(std::size_t i, Real mean, Real sigma)
bool isParamValid(const std::string &name) const
virtual Real value(Real, const Point &p) const override
const Real _lambda
selected lower lengthscale for the noise cut-off
const std::vector< double > x
Real f(Real x)
Test function for Brents method.
static InputParameters validParams()
std::vector< SeriesItem > _series
Fourier series terms.
void paramError(const std::string ¶m, Args... args) const
FourierNoise(const InputParameters ¶meters)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::string v
Real _scale
amplitude factor
virtual MooseMesh & mesh() override
void mooseError(Args &&... args) const
Generate noise using random fourier series coefficients.
static InputParameters validParams()