12 #include "MooseUtils.h"
20 InputParameters params = validParams<GeneralPostprocessor>();
21 params.addClassDescription(
22 "Return a time step limit for nucleation event to be used by IterationAdaptiveDT");
23 params.addRequiredParam<Real>(
"dt_max",
24 "Time step to cut back to at the start of a nucleation event");
25 params.addRangeCheckedParam<Real>(
28 "p2nucleus > 0 & p2nucleus < 1",
29 "Maximum probability for more than one nucleus to appear during a time "
30 "step. This will limit the time step based on the total nucleation rate for "
31 "the domain to make sure the probability for two or more nuclei to appear "
32 "is always below the chosen number.");
33 params.addRequiredParam<UserObjectName>(
"inserter",
"DiscreteNucleationInserter user object");
38 : GeneralPostprocessor(parameters),
40 _dt_nucleation(getParam<Real>(
"dt_max")),
41 _changes_made(_inserter.getInsertionsAndDeletions()),
42 _rate(_inserter.getRate())
50 const Real p2n = getParam<Real>(
"p2nucleus");
55 Real lower_bound = 0.0;
60 for (
unsigned int i = 0; i < 100; ++i)
62 const Real p_upper = 1.0 - (1.0 + upper_bound) * std::exp(-upper_bound);
70 lower_bound = upper_bound;
75 for (
unsigned int i = 0; i < 100; ++i)
78 _max_lambda = (upper_bound - lower_bound) / 2.0 + lower_bound;
84 if (MooseUtils::absoluteFuzzyEqual(p, p2n))
106 return std::numeric_limits<Real>::max();