27 std::vector<double> default_lambdas = {
28 0.0124, 0.0304, 0.111, 0.301, 1.14, 3.01};
29 std::vector<double> default_betas = {
30 0.00021, 0.00142, 0.00127, 0.00257, 0.00075, 0.00027};
33 "precursor_lambdas", default_lambdas,
"An array of decay constants");
37 "An array of fractional delayed neutron fractions");
40 "gen_time", 1.0e-5,
"Neutron generation time [s]");
43 "initial_source", 1.0,
"Initial source strength [/s]");
46 "initial_population", 1.0,
"Initial neutron population");
49 "time_integration",
"implicit_euler",
"Time integration scheme to use");
52 auto time_intgl_list = AllowableRangeList::New(
53 {
"explicit_euler",
"implicit_euler",
"crank_nicolson"});
56 std::move(time_intgl_list));
59 AllowableRangeLowLimit::New(1.0e-12));
61 AllowableRangeLowLimit::New(0.0));
63 AllowableRangeLowLimit::New(0.0));
69 :
chi_physics::Solver(params.GetParamValue<std::string>(
"name")),
70 lambdas_(params.GetParamVectorValue<double>(
"precursor_lambdas")),
71 betas_(params.GetParamVectorValue<double>(
"precursor_betas")),
72 gen_time_(params.GetParamValue<double>(
"gen_time")),
73 rho_(params.GetParamValue<double>(
"initial_rho")),
74 source_strength_(params.GetParamValue<double>(
"initial_source")),
75 time_integration_(params.GetParamValue<std::string>(
"time_integration")),
76 num_precursors_(lambdas_.size())
80 std::stringstream outstr;
81 outstr <<
"lambdas = ";
87 std::stringstream outstr;
101 ": Number of precursors cannot be "
102 "deduced from precursor data because "
103 "the data lists are of different size.");
117 for (
size_t j = 1; j <= J; ++j)
132 const auto b_theta = -1.0 *
q_;
144 for (
auto& val : A_temp[0])
148 x_t_ = A_temp.Inverse() * b_temp;
161 physics_ev_pub.SolverStep(*
this);
162 physics_ev_pub.SolverAdvance(*
this);
185 const double inv_tau = theta * dt;
187 auto A_theta =
I_ - inv_tau *
A_;
188 auto b_theta =
x_t_ + inv_tau *
q_;
190 auto x_theta = A_theta.Inverse() * b_theta;
217 const auto param_name = params.
GetParamValue<std::string>(
"name");
219 if (param_name ==
"neutron_population")
221 else if (param_name ==
"population_next")
223 else if (param_name ==
"period")
225 else if (param_name ==
"rho")
227 else if (param_name ==
"solution")
229 else if (param_name ==
"time_integration")
231 else if (param_name ==
"time_next")
233 else if (param_name ==
"test_arb_info")
298 for (
const auto& param : params)
300 const std::string& param_name = param.Name();
301 if (param_name ==
"rho")
SetRho(param.GetValue<
double>());
#define ChiLogicalError(message)
#define ChiInvalidArgument(message)
LogStream Log(LOG_LVL level=LOG_0)
void AddParameter(ParameterBlock block)
T GetParamValue(const std::string ¶m_name) const
DynamicMatrix Inverse() const
void SetDiagonal(DynamicVector< NumberFormat > &V)
std::vector< NumberFormat > elements_
void Set(NumberFormat value)
std::string PrintStr() const
static PhysicsEventPublisher & GetInstance()
std::string TextName() const
static chi::InputParameters GetInputParameters()
std::shared_ptr< TimeStepper > timestepper_
virtual void SetProperties(const chi::ParameterBlock ¶ms)
void Initialize() override
TransientSolver(const chi::InputParameters ¶ms)
void SetProperties(const chi::ParameterBlock ¶ms) override
chi_math::DynamicMatrix< double > A_
double PopulationNew() const
std::vector< double > lambdas_
std::vector< double > betas_
std::string time_integration_
void SetRho(double value)
std::vector< double > SolutionNew() const
chi::ParameterBlock GetInfo(const chi::ParameterBlock ¶ms) const override
chi_math::DynamicVector< double > q_
chi_math::DynamicVector< double > x_tp1_
double PopulationPrev() const
chi_math::DynamicVector< double > x_t_
chi_math::DynamicMatrix< double > I_
static chi::InputParameters GetInputParameters()
std::vector< double > SolutionPrev() const
RegisterChiObject(prk, TransientSolver)