23 "Manages the list of currently active nucleation sites and adds new "
24 "sites according to a predetermined list from a CSV file (use this with sync_times).");
27 "CSV file with (time, x, y, z) coordinates for nucleation events and optionally radius.");
28 params.
addRequiredParam<Real>(
"hold_time",
"Time to keep each nucleus active");
29 params.
addParam<Real>(
"tolerance", 1e-9,
"Tolerance for determining insertion time");
37 _hold_time(getParam<Real>(
"hold_time")),
38 _reader(getParam<FileName>(
"file")),
39 _history_pointer(declareRestartableData<unsigned
int>(
"history_pointer", 0)),
40 _tol(getParam<Real>(
"tolerance")),
41 _nucleation_rate(0.0),
42 _fixed_radius(isParamValid(
"radius")),
43 _radius(_fixed_radius ? getParam<Real>(
"radius") : 0)
50 const std::size_t rows = data[0].size();
53 bool found_time =
false;
59 for (std::size_t i = 0; i < names.size(); ++i)
62 if (data[i].size() != rows)
63 paramError(
"file",
"Mismatching column lengths in file");
65 if (names[i] ==
"time")
67 for (std::size_t j = 0; j < rows; ++j)
71 else if (names[i] ==
"x")
73 for (std::size_t j = 0; j < rows; ++j)
77 else if (names[i] ==
"y")
79 for (std::size_t j = 0; j < rows; ++j)
83 else if (names[i] ==
"z")
85 for (std::size_t j = 0; j < rows; ++j)
89 else if (names[i] ==
"r")
91 for (std::size_t j = 0; j < rows; ++j)
96 for (std::size_t j = 0; j < rows; ++j)
102 paramError(
"file",
"Missing 'time' column in file");
104 paramError(
"file",
"Missing 'x' column in file");
106 paramError(
"file",
"Missing 'y' column in file");
108 paramError(
"file",
"Missing 'z' column in file");
110 paramError(
"file",
"Missing 'r' column in file");
registerMooseObject("PhaseFieldApp", DiscreteNucleationFromFile)
void ErrorVector unsigned int
This UserObject manages the insertion and expiration of nuclei in the simulation domain.
static InputParameters validParams()
const Real _radius
hold the radius of the nucleus
MooseUtils::DelimitedFileReader _reader
CSV file to read.
bool _fixed_radius
Is a fixed radius or variable radius used?
void initialize() override
unsigned int & _history_pointer
index to the next nucleation event in the history
DiscreteNucleationFromFile(const InputParameters ¶meters)
NucleusList _nucleation_history
Total nucleation history read from file.
const Real _hold_time
Duration of time each nucleus is kept active after insertion.
const Real _tol
tolerance for determining insertion time
This UserObject manages the insertion and expiration of nuclei in the simulation domain it manages a ...
bool _update_required
is a map update required
NucleusChanges _changes_made
count the number of nucleus insertions and deletions
static InputParameters validParams()
NucleusList & _global_nucleus_list
the global list of all nuclei over all processors
virtual Real & time() const
void paramError(const std::string ¶m, Args... args) const
virtual unsigned int dimension() const
const std::vector< std::string > & getNames() const
const std::vector< std::vector< T > > & getData() const
virtual bool converged(const unsigned int sys_num)
unsigned int number() const
FEProblemBase & _fe_problem
A nucleus has an expiration time, a location, and a size.