DiscreteNucleationTimeStep Class Reference

Returns a user defined timestep limit for the simulation step right after the introduction of a new nucleus and between nucleation events to control the probability of two or more nuclei appearing in one timestep. More...

#include <DiscreteNucleationTimeStep.h>

Inheritance diagram for DiscreteNucleationTimeStep:
[legend]

## Public Member Functions

DiscreteNucleationTimeStep (const InputParameters &parameters)

virtual void initialize () override

virtual void execute () override

virtual void finalize () override

virtual PostprocessorValue getValue () override

## Protected Attributes

const DiscreteNucleationInserterBase_inserter
UserObject that manages nucleus insertion and deletion. More...

const Real _dt_nucleation
User specified nucleation time step. More...

nucleus count changes performed by the inserter More...

const Real & _rate
total nucleation rate integrated over teh entire domain More...

Real _max_lambda
Maximum total event expectation value that is low enough so that the probability for more than one * nucleation event to occurr in a single timestep is below a user specified value. More...

## Detailed Description

Returns a user defined timestep limit for the simulation step right after the introduction of a new nucleus and between nucleation events to control the probability of two or more nuclei appearing in one timestep.

Definition at line 26 of file DiscreteNucleationTimeStep.h.

## ◆ DiscreteNucleationTimeStep()

 DiscreteNucleationTimeStep::DiscreteNucleationTimeStep ( const InputParameters & parameters )

Definition at line 37 of file DiscreteNucleationTimeStep.C.

38  : GeneralPostprocessor(parameters),
39  _inserter(getUserObject<DiscreteNucleationInserterBase>("inserter")),
40  _dt_nucleation(getParam<Real>("dt_max")),
43 {
44  //
45  // We do a bisection search because math is hard
46  // (i.e. probability function is not analytically invertible)
47  //
48
49  // this is the target value
50  const Real p2n = getParam<Real>("p2nucleus");
51
52  // initial guess
53  _max_lambda = 0.1;
54  Real upper_bound = _max_lambda;
55  Real lower_bound = 0.0;
56
57  // At this point we do not know a proper upper bound for a search interval
58  // so we grow our initial guess until we find it (we only allow for a finite
59  // number of iterations)
60  for (unsigned int i = 0; i < 100; ++i)
61  {
62  const Real p_upper = 1.0 - (1.0 + upper_bound) * std::exp(-upper_bound);
63
64  // we have found a lambda value that results in a p > p2n, this is the upper end of the interval
65  if (p_upper > p2n)
66  break;
67
68  // upper_bound is actually below our target lambda, set it as the new lower
69  // bound and double the upper_bound value
70  lower_bound = upper_bound;
71  upper_bound *= 2.0;
72  }
73
74  // now that we have an upper and a lower interval bounds we can do a proper bisection
75  for (unsigned int i = 0; i < 100; ++i)
76  {
77  // pick the middle of the current interval
78  _max_lambda = (upper_bound - lower_bound) / 2.0 + lower_bound;
79
80  // calculate new probability for 2 or more nuclei to appear
81  const Real p = 1.0 - (1.0 + _max_lambda) * std::exp(-_max_lambda);
82
83  // quit if we zeroed in on the target
84  if (MooseUtils::absoluteFuzzyEqual(p, p2n))
85  break;
86
87  // otherwise adjust interval bounds
88  else if (p > p2n)
89  upper_bound = _max_lambda;
90  else
91  lower_bound = _max_lambda;
92  }
93 }
Real _max_lambda
Maximum total event expectation value that is low enough so that the probability for more than one * ...
const Real _dt_nucleation
User specified nucleation time step.
nucleus count changes performed by the inserter
const Real & _rate
total nucleation rate integrated over teh entire domain
virtual const Real & getRate() const =0
const DiscreteNucleationInserterBase & _inserter
UserObject that manages nucleus insertion and deletion.
virtual const NucleusChanges & getInsertionsAndDeletions() const

## ◆ execute()

 virtual void DiscreteNucleationTimeStep::execute ( )
inlineoverridevirtual

Definition at line 32 of file DiscreteNucleationTimeStep.h.

32 {}

## ◆ finalize()

 virtual void DiscreteNucleationTimeStep::finalize ( )
inlineoverridevirtual

Definition at line 33 of file DiscreteNucleationTimeStep.h.

33 {}

## ◆ getValue()

 PostprocessorValue DiscreteNucleationTimeStep::getValue ( )
overridevirtual

Definition at line 96 of file DiscreteNucleationTimeStep.C.

97 {
98  // check if a nucleus insertion has occurred...
100  // and cut back time step for nucleus formation
101  return _dt_nucleation;
102
103  // otherwise check the total nucleation rate in the domain...
104  if (_rate == 0.0)
105  // ...and return no limit on the time step if the rate is zero...
106  return std::numeric_limits<Real>::max();
107  else
108  // ...or return the maximum time step that satisfies the bound on the 2+ nuclei probability
109  return _max_lambda / _rate;
110 }
Real _max_lambda
Maximum total event expectation value that is low enough so that the probability for more than one * ...
const Real _dt_nucleation
User specified nucleation time step.
nucleus count changes performed by the inserter
const Real & _rate
total nucleation rate integrated over teh entire domain

## ◆ initialize()

 virtual void DiscreteNucleationTimeStep::initialize ( )
inlineoverridevirtual

Definition at line 31 of file DiscreteNucleationTimeStep.h.

31 {}

## Member Data Documentation

protected

nucleus count changes performed by the inserter

Definition at line 44 of file DiscreteNucleationTimeStep.h.

Referenced by getValue().

## ◆ _dt_nucleation

 const Real DiscreteNucleationTimeStep::_dt_nucleation
protected

User specified nucleation time step.

Definition at line 41 of file DiscreteNucleationTimeStep.h.

Referenced by getValue().

## ◆ _inserter

 const DiscreteNucleationInserterBase& DiscreteNucleationTimeStep::_inserter
protected

UserObject that manages nucleus insertion and deletion.

Definition at line 38 of file DiscreteNucleationTimeStep.h.

## ◆ _max_lambda

 Real DiscreteNucleationTimeStep::_max_lambda
protected

Maximum total event expectation value that is low enough so that the probability for more than one * nucleation event to occurr in a single timestep is below a user specified value.

Definition at line 54 of file DiscreteNucleationTimeStep.h.

Referenced by DiscreteNucleationTimeStep(), and getValue().

## ◆ _rate

 const Real& DiscreteNucleationTimeStep::_rate
protected

total nucleation rate integrated over teh entire domain

Definition at line 47 of file DiscreteNucleationTimeStep.h.

Referenced by getValue().

The documentation for this class was generated from the following files: