12 #define _USE_MATH_DEFINES 28 #define _scalar_flux(r,e) (_scalar_flux[(r)*_num_groups + (e)]) 31 #define _old_scalar_flux(r,e) (_old_scalar_flux[(r)*_num_groups + (e)]) 34 #define _reference_flux(r,e) (_reference_flux[(r)*_num_groups + (e)]) 37 #define reference_flux(r,e) (reference_flux[(r)*_num_groups + (e)]) 40 #define _stabilizing_flux(r,e) (_stabilizing_flux[(r)*_num_groups + (e)]) 44 #define _reduced_sources(r,e) (_reduced_sources[(r)*_num_groups + (e)]) 49 #define _boundary_flux(i,j,pe) (_boundary_flux[(i)*2*_fluxes_per_track \ 50 + (j)*_fluxes_per_track \ 52 #define _start_flux(i,j,pe) (_start_flux[(i)*2*_fluxes_per_track \ 53 + (j)*_fluxes_per_track \ 57 #define _fixed_sources(r,e) (_fixed_sources[(r)*_num_groups + (e)]) 61 #define fission_sources(r,e) (fission_sources[(r)*_num_groups + (e)]) 65 #define scatter_sources(r,e) (scatter_sources[(r)*_num_groups + (e)]) 270 double* _regionwise_scratch;
458 void loadFSRFluxes(std::string fname,
bool assign_k_eff=
false,
double tolerance=0.01);
460 double getFlux(
long fsr_id,
int group);
461 virtual void getFluxes(FP_PRECISION* out_fluxes,
int num_fluxes) = 0;
466 virtual void setFluxes(FP_PRECISION* in_fluxes,
int num_fluxes) = 0;
488 void computeFlux(
int max_iters=1000,
bool only_fixed_source=
true);
494 void printBGQMemory();
533 int reset_iteration);
542 _OTF_transport =
true;
int _fluxes_per_track
Definition: Solver.h:162
float * getBoundaryFlux(long track_id, bool fwd)
Returns the boundary flux array at the requested indexes.
Definition: Solver.h:522
void dumpFSRFluxes(std::string fname)
Prints scalar fluxes to a binary file.
Definition: Solver.cpp:1976
double getTotalTime()
Returns the total time to converge the source (seconds).
Definition: Solver.cpp:226
void useExponentialIntrinsic()
Informs the Solver to use the exponential intrinsic exp(...) function to compute the exponential in t...
Definition: Solver.cpp:581
bool _negative_fluxes_allowed
Definition: Solver.h:226
Represents a Cell inside of a Universe.
Definition: Cell.h:56
bool _verbose
Definition: Solver.h:210
double _initial_spectrum_thresh
Definition: Solver.h:217
void computeFlux(int max_iters=1000, bool only_fixed_source=true)
Computes the scalar flux distribution by performing a series of transport sweeps. ...
Definition: Solver.cpp:1327
Material ** _FSR_materials
Definition: Solver.h:141
void checkXS()
All material cross-sections in the geometry are checked for consistency.
Definition: Solver.cpp:970
void loadFSRFluxes(std::string fname, bool assign_k_eff=false, double tolerance=0.01)
Load scalar fluxes from a binary file.
Definition: Solver.cpp:2043
std::map< std::pair< int, int >, FP_PRECISION > _fix_src_FSR_map
Definition: Solver.h:273
virtual void initializeFixedSources()
Assigns fixed sources assigned by Cell, Material to FSRs.
Definition: Solver.cpp:1072
Cmfd * _cmfd
Definition: Solver.h:316
bool isUsingExponentialInterpolation()
Returns whether the Solver uses linear interpolation to compute exponentials.
Definition: Solver.cpp:276
segmentationType _segment_formation
Definition: Solver.h:238
FP_PRECISION * _reduced_sources
Definition: Solver.h:282
bool _correct_xs
Definition: Solver.h:203
long _num_FSRs
Definition: Solver.h:132
void printFissionRates(std::string fname, int nx, int ny, int nz)
Prints fission rates to a binary file.
Definition: Solver.cpp:1882
void setResidualByReference(std::string fname)
Sets residuals to be computed a error relative to a reference.
Definition: Solver.cpp:1966
Math constants and comparision tolerances.
std::string _source_type
Definition: Solver.h:319
Geometry * getGeometry()
Returns a pointer to the Geometry.
Definition: Solver.cpp:160
int _num_iterations
Definition: Solver.h:291
int _num_exp_evaluators_polar
Definition: Solver.h:310
void calculateInitialSpectrum(double threshold)
Performs a spectrum calculation to update the scalar fluxes.
Definition: Solver.cpp:1174
void initializeMaterials(solverMode mode)
Initializes the Material's production matrices.
Definition: Solver.cpp:780
int getNumIterations()
Returns the number of source iterations to converge the source.
Definition: Solver.cpp:217
bool _fixed_sources_on
Definition: Solver.h:200
bool _stabilize_transport
Definition: Solver.h:207
virtual void computeFSRSources(int iteration)=0
Computes the total source (fission, scattering, fixed) for each FSR and energy group.
virtual void computeFSRFissionSources()=0
Computes the total fission source for each FSR and energy group.
FP_PRECISION * _stabilizing_flux
Definition: Solver.h:263
void setSolverMode(solverMode solver_mode)
Choose between direct and adjoint mode.
Definition: Solver.cpp:592
virtual void zeroTrackFluxes()=0
Zero each Track's boundary fluxes for each energy group and polar angle in the "forward" and "reverse...
void setCheckXSLogLevel(logLevel log_level)
Determines which log level to set cross-section warnings.
Definition: Solver.cpp:685
int _num_materials
Definition: Solver.h:153
int _num_groups
Definition: Solver.h:129
bool _calculate_residuals_by_reference
Definition: Solver.h:223
virtual void printInputParamsSummary()
A function that prints a summary of the input parameters.
Definition: Solver.cpp:2233
bool _calculate_initial_spectrum
Definition: Solver.h:214
double getFlux(long fsr_id, int group)
Returns the scalar flux for some FSR and energy group.
Definition: Solver.cpp:296
virtual void setFixedSourceByFSR(long fsr_id, int group, double source)
Assign a fixed source for a flat source region and energy group.
Definition: Solver.cpp:477
void clearTimerSplits()
Deletes the Timer's timing entries for each timed code section code in the source convergence loop...
Definition: Solver.cpp:1719
Timer * _timer
Definition: Solver.h:313
The TrackGenerator is dedicated to generating and storing Tracks which cyclically wrap across the Geo...
Definition: TrackGenerator.h:36
void computeSource(int max_iters=1000, double k_eff=1.0, residualType res_type=TOTAL_SOURCE)
Computes the total source distribution by performing a series of transport sweep and source updates...
Definition: Solver.cpp:1434
virtual void flattenFSRFluxesChiSpectrum()=0
Set the scalar flux for each FSR to a chi spectrum.
bool _user_fluxes
Definition: Solver.h:197
virtual double computeResidual(residualType res_type)=0
Computes the residual between successive flux/source iterations.
double _converge_thresh
Definition: Solver.h:294
logLevel _xs_log_level
Definition: Solver.h:235
FP_PRECISION * _fixed_sources
Definition: Solver.h:266
double getFSRSource(long fsr_id, int group)
Returns the source for some energy group for a flat source region.
Definition: Solver.cpp:329
virtual double normalizeFluxes()=0
Normalizes all FSR scalar fluxes and Track boundary angular fluxes to the total fission source (times...
segmentationType
The types of Track segmentation supported by OpenMOC.
Definition: segmentation_type.h:15
virtual void computeFSRScatterSources()=0
Computes the total scattering source for each FSR and energy group.
TrackGenerator * _track_generator
Definition: Solver.h:147
solverMode _solver_mode
Definition: Solver.h:191
stabilizationType _stabilization_type
Definition: Solver.h:300
An object to track progress.
bool isUsingDoublePrecision()
Returns whether the solver is using double floating point precision.
Definition: Solver.cpp:262
virtual void initializeFluxArrays()=0
Initializes Track boundary angular flux and leakage and FSR scalar flux arrays.
void setInitialSpectrumCalculation(double threshold)
Instructs OpenMOC to perform an initial spectrum calculation.
Definition: Solver.cpp:674
double _stabilization_factor
Definition: Solver.h:297
std::string _reference_file
Definition: Solver.h:232
The arbitrary quadrature parent class.
Definition: Quadrature.h:76
void setRestartStatus(bool is_restart)
Informs the Solver that this is a 'restart' calculation and therefore k_eff, track angular and region...
Definition: Solver.cpp:605
void setFixedSourceByCell(Cell *cell, int group, double source)
Assign a fixed source for a Cell and energy group.
Definition: Solver.cpp:507
bool _keff_from_fission_rates
Definition: Solver.h:288
void setConvergenceThreshold(double threshold)
Sets the threshold for source/flux convergence.
Definition: Solver.cpp:459
bool _limit_xs
Definition: Solver.h:174
The master class containing references to all geometry-related objects - Surfaces, Cells, Universes and Lattices - and Materials.
Definition: Geometry.h:122
long _num_fissionable_FSRs
Definition: Solver.h:135
TrackGenerator * getTrackGenerator()
Returns a pointer to the TrackGenerator.
Definition: Solver.cpp:175
long _tot_num_tracks
Definition: Solver.h:241
std::map< std::pair< Material *, int >, FP_PRECISION > _fix_src_material_map
Definition: Solver.h:279
void fissionTransportSweep()
This method performs one transport sweep using the fission source.
Definition: Solver.cpp:1257
void setTrackGenerator(TrackGenerator *track_generator)
Sets the Solver's TrackGenerator with characteristic Tracks.
Definition: Solver.cpp:410
virtual void initializeSourceArrays()=0
Allocates memory for FSR source arrays.
std::vector< int > _limit_xs_materials
Definition: Solver.h:168
Material * _chi_spectrum_material
Definition: Solver.h:144
virtual void transportSweep()=0
This method performs one transport sweep of all azimuthal angles, Tracks, segments, polar angles and energy groups.
std::string _initial_FSR_fluxes_file
Definition: Solver.h:229
void limitXS()
Limits cross-sections so that there are no negative cross-sections.
Definition: Solver.cpp:937
void useExponentialInterpolation()
Informs the Solver to use linear interpolation to compute the exponential in the transport equation...
Definition: Solver.cpp:570
FP_PRECISION getMaxOpticalLength()
Get the maximum allowable optical length for a track segment.
Definition: Solver.cpp:253
void setOTFTransport()
Activate On-The-Fly transport, to OTF ray-trace and propagate the track angular fluxes at the same ti...
Definition: Solver.h:541
int *** _tracks_per_stack
Definition: Solver.h:183
int _reset_iteration
Definition: Solver.h:171
virtual void computeKeff()=0
Compute from total fission and absorption rates in each FSR and energy group.
virtual void storeFSRFluxes()=0
Stores the current scalar fluxes in the old scalar flux array.
virtual void initializeCmfd()
Initializes a Cmfd object for acceleration prior to source iteration.
Definition: Solver.cpp:1127
void loadInitialFSRFluxes(std::string fname)
Load the initial scalar flux distribution from a binary file.
Definition: Solver.cpp:2028
int _num_exp_evaluators_azim
Definition: Solver.h:307
bool _SOLVE_3D
Definition: Solver.h:187
void checkLimitXS(int iteration)
Checks to see if limited XS should be reset.
Definition: Solver.cpp:882
void initializeSolver(solverMode solver_mode)
Initializes most components of Solver. Mostly needed from the Python side.
Definition: Solver.cpp:1057
int getNumPolarAngles()
Returns the number of angles used for the polar quadrature.
Definition: Solver.cpp:208
void computeEigenvalue(int max_iters=1000, residualType res_type=FISSION_SOURCE)
Computes keff by performing a series of transport sweep and source updates.
Definition: Solver.cpp:1522
void allowNegativeFluxes(bool negative_fluxes_on)
Informs the Solver that this calculation may involve negative fluxes for computing higher eigenmodes ...
Definition: Solver.cpp:618
ExpEvaluator *** _exp_evaluators
Definition: Solver.h:304
void stabilizeTransport(double stabilization_factor, stabilizationType stabilization_type=DIAGONAL)
Directs OpenMOC to use the diagonal stabilizing correction to the source iteration transport sweep...
Definition: Solver.cpp:662
virtual void flattenFSRFluxes(FP_PRECISION value)=0
Set the scalar flux for each FSR and energy group to some value.
virtual void initializeExpEvaluators()
Initializes new ExpEvaluator object to compute exponentials.
Definition: Solver.cpp:702
This is a class for evaluating exponentials.
Definition: ExpEvaluator.h:29
FP_PRECISION * _scalar_flux
Definition: Solver.h:254
A class for Coarse Mesh Finite Difference (CMFD) acceleration.
Definition: Cmfd.h:51
FP_PRECISION getFSRVolume(long fsr_id)
Returns the calculated volume for a flat source region.
Definition: Solver.cpp:190
virtual void computeStabilizingFlux()=0
Computes the stabilizing flux for transport stabilization.
void setKeffFromNeutronBalance()
Sets computation method of k-eff from fission, absorption, and leakage rates rather than from fission...
Definition: Solver.cpp:1957
void setMaxOpticalLength(FP_PRECISION max_optical_length)
Set the maximum allowable optical length for a track segment.
Definition: Solver.cpp:545
The Material class represents a unique material and its relevant nuclear data (i.e., multigroup cross-sections) for neutron transport.
Definition: Material.h:51
double _k_eff
Definition: Solver.h:285
void scatterTransportSweep()
This method performs one transport sweep using the scatter source.
Definition: Solver.cpp:1268
FP_PRECISION * _FSR_volumes
Definition: Solver.h:138
int _num_polar
Definition: Solver.h:159
bool _is_restart
Definition: Solver.h:194
The TrackGenerator3D class.
float * _boundary_leakage
Definition: Solver.h:251
Solver(TrackGenerator *track_generator=NULL)
Constructor initializes an empty Solver class with array pointers set to NULL.
Definition: Solver.cpp:14
virtual void addSourceToScalarFlux()=0
Add the source term contribution in the transport equation to the FSR scalar flux.
void resetMaterials(solverMode mode)
Returns the Material data to its original state.
Definition: Solver.cpp:1238
virtual void stabilizeFlux()=0
Adjusts the scalar flux for transport stabilization.
std::map< std::pair< Cell *, int >, FP_PRECISION > _fix_src_cell_map
Definition: Solver.h:276
This is an abstract base class which different Solver subclasses implement for different architecture...
Definition: Solver.h:121
void countFissionableFSRs()
Counts the number of fissionable flat source regions.
Definition: Solver.cpp:865
std::vector< FP_PRECISION * > _groupwise_scratch
Definition: Solver.h:269
void log_printf(logLevel level, const char *format,...)
Print a formatted message to the console.
Definition: log.cpp:300
Track ** _tracks
Definition: Solver.h:165
void setVerboseIterationReport()
Sets the solver to print extra information for each iteration.
Definition: Solver.cpp:1727
void setExpPrecision(double precision)
Set the precision, or maximum allowable approximation error, of the the exponential interpolation tab...
Definition: Solver.cpp:559
Geometry * _geometry
Definition: Solver.h:150
The Quadrature abstract class and subclasses.
void printTimerReport()
Prints a report of the timing statistics to the console.
Definition: Solver.cpp:1736
std::map< int, Material * > _limit_materials
Definition: Solver.h:180
double getKeff()
Returns the converged eigenvalue .
Definition: Solver.cpp:235
int _num_azim
Definition: Solver.h:126
FP_PRECISION * _old_scalar_flux
Definition: Solver.h:257
virtual void computeFSRFissionRates(double *fission_rates, long num_FSRs, bool nu=false)=0
Computes the volume-weighted, energy integrated fission rate in each FSR and stores them in an array ...
FP_PRECISION * _reference_flux
Definition: Solver.h:260
bool _load_initial_FSR_fluxes
Definition: Solver.h:220
void setChiSpectrumMaterial(Material *material)
Sets the chi spectrum for use as an inital flux guess.
Definition: Solver.cpp:694
std::map< int, Material * > _original_materials
Definition: Solver.h:177
FP_PRECISION * getFluxesArray()
A function that returns the array of scalar fluxes.
Definition: Solver.cpp:1947
The Timer class is for timing and profiling regions of code.
Definition: Timer.h:40
float * _boundary_flux
Definition: Solver.h:246
Quadrature * _quad
Definition: Solver.h:156
void setGeometry(Geometry *geometry)
Sets the Geometry for the Solver.
Definition: Solver.cpp:385
stabilizationType
The type of stabilization to use on source iteration.
Definition: Solver.h:103
void setFixedSourceByMaterial(Material *material, int group, double source)
Assign a fixed source for a Material and energy group.
Definition: Solver.cpp:534
virtual void initializeFSRs()
Initializes the FSR volumes and Materials array.
Definition: Solver.cpp:803
A Track represents a characteristic line across the geometry.
Definition: Track.h:67
void correctXS()
Directs OpenMOC to correct unphysical cross-sections.
Definition: Solver.cpp:629
double getConvergenceThreshold()
Returns the threshold for source/flux convergence.
Definition: Solver.cpp:244
void setLimitingXSMaterials(std::vector< int > material_ids, int reset_iteration)
Instructs MOC to limit negative cross-sections for early iterations.
Definition: Solver.cpp:925
virtual ~Solver()
Destructor deletes arrays of boundary angular fluxes, scalar fluxes and sources for each FSR and ener...
Definition: Solver.cpp:98
residualType
The type of residual used for the convergence criterion.
Definition: Solver.h:86
bool is3D()
Returns whether the Solver is tackling a 3D problem.
Definition: Solver.cpp:285
solverMode
The solution mode used by the MOC solver.
Definition: Solver.h:72