16#include <Source_Neutronique.h>
17#include <Probleme_base.h>
18#include <Milieu_base.h>
19#include <Champ_Uniforme.h>
20#include <Equation_base.h>
21#include <Schema_Temps_base.h>
37 EChaine ec(
"Champ_Uniforme 1 1");
43 param.lire_avec_accolades_depuis(is);
54 param.
ajouter(
"dt_impr",&dt_impr);
69 Cerr <<
"The number of groups N must be specified before lambda in " <<
que_suis_je() << finl;
73 for (
int i=0; i<N; i++) is>>lambda(i);
79 Cerr <<
"The number of groups N must be specified before beta in " <<
que_suis_je() << finl;
85 for (
int i=0; i<N; i++)
91 else if (mot==
"schema_temps")
95 if (nom_sch ==
"euler_explicite")
99 else if (nom_sch ==
"runge_kutta")
105 Cerr <<
"The keyword " << mot <<
" is not understood in " <<
que_suis_je() << finl;
113 Cerr <<
"Reading reactivity " << tmp << finl;
115 fct_tT.setString(tmp);
118 fct_tT.parseString();
120 else if (mot==
"repartition")
129 Cerr <<
"The number of groups N must be specified before the initial Ci values in " <<
que_suis_je() << finl;
134 for (
int i=0; i<N; i++)
146 fct_tT.setVar(
"t",t);
147 fct_tT.setVar(
"T",T);
148 return fct_tT.eval();
177 matA.resize(N+1,N+1);
179 for (
int i=1; i<N+1; i++)
181 matA(0,i) = lambda(i-1);
182 matA(i,i) = -lambda(i-1);
183 matA(i,0) = beta(i-1)/Tvie;
187 for (
int i=1; i<N+1; i++)
188 Un(i) = beta(i-1)*Un(0)/Tvie/lambda(i-1);
190 for (
int i=1; i<N+1; i++)
198void Source_Neutronique::mul(DoubleTab& m, DoubleVect& v, DoubleVect& resu)
201 resu(0) = m(0,0)*v(0);
202 for (
int i=1; i<N+1; i++)
204 resu(0)+= m(0,i)*v(i);
205 resu(i) = m(i,0)*v(0) + m(i,i)*v(i);
215 static const double a1 = 1./6.;
216 static const double a2 = 1./3.;
222 const double dt2 = dt/2.;
227 Unp1.ajoute(dt2, fn1);
230 mettre_a_jour_matA(temps_courant+dt2);
234 Unp1.ajoute(dt2, fn2);
239 Unp1.ajoute(dt, fn3);
242 mettre_a_jour_matA(temps_courant+dt);
245 Unp1.ajoute(a1*dt, fn4);
246 Unp1.ajoute(a2*dt, fn3);
247 Unp1.ajoute(a2*dt, fn2);
248 Unp1.ajoute(a1*dt, fn1);
255void Source_Neutronique::mettre_a_jour_matA(
double temps)
257 matA(0,0) = beta_som/Tvie*(
rho(temps,Tmoy)-1);
281 while (temps_courant<temps)
283 const double dt_stab = 0.8*Tvie/beta_som*std::max(std::fabs(
rho(temps_courant,Tmoy)-1),1.);
284 dt = std::min(dt_stab, temps-temps_courant);
285 (this->*faire_un_pas_de_temps)();
288 mettre_a_jour_matA(temps_courant);
300 SFichier fic(
"puissances.dat",ios::app);
302 for (
int i =0; i<N+1; i++)
316 static const double epsilon = 1.e-9;
327 modf(le_temps_courant/dt_impr + epsilon, &i);
328 modf((le_temps_courant-ddt)/dt_impr + epsilon, &j);
339 temps_courant = temps;
340 mettre_a_jour_matA(temps);
347 temps_courant = temps;
Class defining operators and methods for all reading operation in an input flow (file,...
A character string (Nom) in uppercase.
class Nom: a character string for naming TRUST objects.
const Nom & que_suis_je() const
Returns the string identifying the class.
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Helper class to factorize the readOn method of Objet_U classes.
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
void ajouter_non_std(const char *keyword, const Objet_U *value, Param::Nature nat=Param::OPTIONAL)
Register a keyword handled by Objet_U::lire_motcle_non_standard.
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
SFichier is to the C++ ofstream class what Sortie is to the C++ ostream class.
int nb_pas_dt_max_atteint() const
Returns 1 if (the number of time steps >= maximum number of time steps).
int temps_final_atteint() const
Returns 1 if the final time has been reached (or exceeded).
int nb_pas_dt() const
Returns the number of time steps performed.
int stationnaire_atteint() const
Base class for output streams.
void completer() override
Updates internal references of the Source_base object.
void aller_au_temps(double)
void faire_un_pas_de_temps_RK()
const Nom & nom_ssz() const
void faire_un_pas_de_temps_EE()
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
virtual double calculer_Tmoyenne()=0
virtual int limpr(double, double) const
void mettre_a_jour(double temps) override
DOES NOTHING - to override in derived classes.
virtual void imprimer(double) const
const Nom & repartition() const
void set_param(Param ¶m) const override
double rho(double, double)
Source_base A Source_base object is a term appearing on the right-hand side of an.
virtual void completer()
Updates internal references of the Source_base object.