Skip to content

Commit e9cf50b

Browse files
committed
time consistent seed approach
1 parent b3be206 commit e9cf50b

File tree

13 files changed

+276
-564
lines changed

13 files changed

+276
-564
lines changed

include/openmc/random_ray/flat_source_domain.h

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,22 +76,17 @@ class FlatSourceDomain {
7676

7777
//----------------------------------------------------------------------------
7878
// Methods for kinetic simulations
79-
virtual void update_single_neutron_source_td(SourceRegionHandle& srh);
8079
void compute_single_neutron_source_time_derivative(SourceRegionHandle& srh);
8180
void compute_single_scalar_flux_time_derivative_2(SourceRegionHandle& srh);
82-
virtual void update_all_neutron_sources_td();
8381

8482
void compute_single_delayed_fission_source(SourceRegionHandle& srh);
8583
void compute_single_precursors(SourceRegionHandle& srh);
8684
void compute_all_precursors();
8785

88-
void serialize_final_td_fluxes(vector<double>& flux_td);
89-
void serialize_final_td_sources(vector<double>& source_td);
9086
void serialize_final_precursors(vector<double>& precursors);
9187
void serialize_final_delayed_fission_source(
9288
vector<double>& delayed_fission_source);
9389

94-
void flux_td_swap();
9590
void precursors_swap();
9691
void accumulate_iteration_quantities();
9792
void normalize_final_quantities();
@@ -124,6 +119,9 @@ class FlatSourceDomain {
124119
//----------------------------------------------------------------------------
125120
// Public Data members
126121
double k_eff_ {1.0}; // Eigenvalue
122+
double
123+
fission_rate_; // The system's fission rate (per cm^3), in eigenvalue mode
124+
127125
bool mapped_all_tallies_ {false}; // If all source regions have been visited
128126

129127
int64_t n_external_source_regions_ {0}; // Total number of source regions with
@@ -200,13 +198,6 @@ class FlatSourceDomain {
200198
vector<double> chi_p_;
201199
vector<double> inverse_vbar_;
202200

203-
// Time-dependent cross section arrays for use with material density
204-
// timeseries
205-
vector<double> sigma_t_td_;
206-
vector<double> nu_sigma_f_td_;
207-
vector<double> sigma_f_td_;
208-
vector<double> sigma_s_td_;
209-
210201
protected:
211202
//----------------------------------------------------------------------------
212203
// Methods
@@ -229,9 +220,6 @@ class FlatSourceDomain {
229220
simulation_volume_; // Total physical volume of the simulation domain, as
230221
// defined by the 3D box of the random ray source
231222

232-
double
233-
fission_rate_; // The system's fission rate (per cm^3), in eigenvalue mode
234-
235223
// Volumes for each tally and bin/score combination. This intermediate data
236224
// structure is used when tallying quantities that must be normalized by
237225
// volume (i.e., flux). The vector is index by tally index, while the inner 2D

include/openmc/random_ray/random_ray.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ class RandomRay : public Particle {
7474

7575
//---------------------------------------------------------------------------
7676
// Public data members for kinetic simulations
77-
vector<float> angular_flux_td_;
78-
vector<float> angular_flux_td_prime_;
77+
vector<float> angular_flux_prime_;
7978

8079
private:
8180
//----------------------------------------------------------------------------
@@ -94,8 +93,7 @@ class RandomRay : public Particle {
9493

9594
//---------------------------------------------------------------------------
9695
// Private data members for kinetic simulations
97-
vector<double> delta_psi_td_;
98-
vector<double> delta_psi_td_prime_;
96+
vector<double> delta_psi_prime_;
9997

10098
}; // class RandomRay
10199

include/openmc/random_ray/random_ray_simulation.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ class RandomRaySimulation {
5252
// Number of delay groups
5353
int ndgroups_;
5454

55+
//----------------------------------------------------------------------------
56+
// Data Members for kinetic simulations
57+
58+
vector<double> static_k_eff_;
59+
vector<double> static_fission_rate_;
60+
5561
}; // class RandomRaySimulation
5662

5763
//============================================================================

include/openmc/random_ray/source_region.h

Lines changed: 2 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,6 @@ class SourceRegionHandle {
196196
//---------------------------------------------------------------------------
197197
// Public Data Members for kinetic simulations
198198

199-
// Energy group-wise 1D time-dependent arrays
200-
double* scalar_flux_td_old_;
201-
double* scalar_flux_td_new_;
202-
double* scalar_flux_td_final_;
203-
204-
double* source_td_;
205-
double* source_td_final_;
206-
207199
// Energy group-wise 1D time-derivative arrays
208200
double* source_time_derivative_;
209201
double* scalar_flux_time_derivative_2_;
@@ -351,30 +343,6 @@ class SourceRegionHandle {
351343

352344
//---------------------------------------------------------------------------
353345
// Public Accessors for kinetic simulations
354-
double& scalar_flux_td_old(int g) { return scalar_flux_td_old_[g]; }
355-
const double scalar_flux_td_old(int g) const
356-
{
357-
return scalar_flux_td_old_[g];
358-
}
359-
360-
double& scalar_flux_td_new(int g) { return scalar_flux_td_new_[g]; }
361-
const double scalar_flux_td_new(int g) const
362-
{
363-
return scalar_flux_td_new_[g];
364-
}
365-
366-
double& scalar_flux_td_final(int g) { return scalar_flux_td_final_[g]; }
367-
const double scalar_flux_td_final(int g) const
368-
{
369-
return scalar_flux_td_final_[g];
370-
}
371-
372-
double& source_td(int g) { return source_td_[g]; }
373-
const double source_td(int g) const { return source_td_[g]; }
374-
375-
double& source_td_final(int g) { return source_td_final_[g]; }
376-
const double source_td_final(int g) const { return source_td_final_[g]; }
377-
378346
double& source_time_derivative(int g) { return source_time_derivative_[g]; }
379347
const double source_time_derivative(int g) const
380348
{
@@ -531,23 +499,8 @@ class SourceRegion {
531499
// Public Data Members for kinetic simulations
532500

533501
// Energy group-wise 1D time-dependent arrrays
534-
vector<double> source_final_; //!< The total source accumulated over all
535-
//!< active iterations (used for SDP)
536-
vector<double> scalar_flux_td_old_; //!< The time-dependent scalar flux from
537-
//!< the previous iteration
538-
vector<double> scalar_flux_td_new_; //!< The time-dependent scalar flux from
539-
//!< the current iteration
540-
vector<double>
541-
scalar_flux_td_final_; //!< The time-dependent scalar flux accumulated over
542-
//!< all active iterations (used as the initial
543-
//!< condition for the next timestep)
544-
545-
vector<double>
546-
source_td_; //!< The total time-dependent source term (prompt
547-
//!< prompt fission + scattering + delayed emission)
548-
vector<double>
549-
source_td_final_; //!< The total time-dependent source accumulated over all
550-
//!< active iterations (used for SDP)
502+
vector<double> source_final_; //!< The total source accumulated over all
503+
//!< active iterations (used for SDP)
551504

552505
// Energy group-wise 1D derivative arrays
553506
vector<double> source_time_derivative_; //!< The time derivative of the
@@ -851,71 +804,6 @@ class SourceRegionContainer {
851804

852805
//---------------------------------------
853806
// For kinetic simulations
854-
855-
double& scalar_flux_td_old(int64_t sr, int g)
856-
{
857-
return scalar_flux_td_old_[index(sr, g)];
858-
}
859-
const double& scalar_flux_td_old(int64_t sr, int g) const
860-
{
861-
return scalar_flux_td_old_[index(sr, g)];
862-
}
863-
double& scalar_flux_td_old(int64_t se) { return scalar_flux_td_old_[se]; }
864-
const double& scalar_flux_td_old(int64_t se) const
865-
{
866-
return scalar_flux_td_old_[se];
867-
}
868-
869-
double& scalar_flux_td_new(int64_t sr, int g)
870-
{
871-
return scalar_flux_td_new_[index(sr, g)];
872-
}
873-
const double& scalar_flux_td_new(int64_t sr, int g) const
874-
{
875-
return scalar_flux_td_new_[index(sr, g)];
876-
}
877-
double& scalar_flux_td_new(int64_t se) { return scalar_flux_td_new_[se]; }
878-
const double& scalar_flux_td_new(int64_t se) const
879-
{
880-
return scalar_flux_td_new_[se];
881-
}
882-
883-
double& scalar_flux_td_final(int64_t sr, int g)
884-
{
885-
return scalar_flux_td_final_[index(sr, g)];
886-
}
887-
const double& scalar_flux_td_final(int64_t sr, int g) const
888-
{
889-
return scalar_flux_td_final_[index(sr, g)];
890-
}
891-
double& scalar_flux_td_final(int64_t se) { return scalar_flux_td_final_[se]; }
892-
const double& scalar_flux_td_final(int64_t se) const
893-
{
894-
return scalar_flux_td_final_[se];
895-
}
896-
897-
double& source_td(int64_t sr, int g) { return source_td_[index(sr, g)]; }
898-
const double& source_td(int64_t sr, int g) const
899-
{
900-
return source_td_[index(sr, g)];
901-
}
902-
double& source_td(int64_t se) { return source_td_[se]; }
903-
const double& source_td(int64_t se) const { return source_td_[se]; }
904-
905-
double& source_td_final(int64_t sr, int g)
906-
{
907-
return source_td_final_[index(sr, g)];
908-
}
909-
const double& source_td_final(int64_t sr, int g) const
910-
{
911-
return source_td_final_[index(sr, g)];
912-
}
913-
double& source_td_final(int64_t se) { return source_td_final_[se]; }
914-
const double& source_td_final(int64_t se) const
915-
{
916-
return source_td_final_[se];
917-
}
918-
919807
double& source_time_derivative(int64_t sr, int g)
920808
{
921809
return source_time_derivative_[index(sr, g)];
@@ -1137,7 +1025,6 @@ class SourceRegionContainer {
11371025
int& ndgroups() { return ndgroups_; }
11381026
const int ndgroups() const { return ndgroups_; }
11391027

1140-
void flux_td_swap();
11411028
void precursors_swap();
11421029
void time_step_reset();
11431030

@@ -1197,14 +1084,6 @@ class SourceRegionContainer {
11971084
//---------------------------------------------------------------------------
11981085
// Private Data Members for kinetic simulations
11991086

1200-
// SoA energy group-wise 2D time-dependent arrays flattened to 1D
1201-
vector<double> scalar_flux_td_old_;
1202-
vector<double> scalar_flux_td_new_;
1203-
vector<double> scalar_flux_td_final_;
1204-
1205-
vector<double> source_td_;
1206-
vector<double> source_td_final_;
1207-
12081087
// SoA energy group-wise 2D derivative arrays flattened to 1D
12091088
vector<double> source_time_derivative_;
12101089
vector<double> scalar_flux_time_derivative_2_;

include/openmc/simulation.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ extern bool
5656
// condition for a kinetic simulation
5757
extern int current_timestep; // !< current time step in kinetic simulation
5858
extern double current_time; // !< current time in kinetic simulation
59+
extern bool k_eff_correction; // !< flag to indicate if the simulation is meant
60+
// to correct batchwise k_effs
5961

6062
} // namespace simulation
6163

include/openmc/timer.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ extern Timer time_event_collision;
3333
extern Timer time_event_death;
3434
extern Timer time_update_src;
3535

36-
extern Timer time_update_bd_vectors_td;
37-
extern Timer time_update_src_td;
36+
extern Timer time_update_bd_vectors;
3837
extern Timer time_compute_precursors;
3938

4039
} // namespace simulation

0 commit comments

Comments
 (0)