13 #define _USE_MATH_DEFINES 19 #include <unordered_map> 25 #define _num_groups (NGROUPS) 30 #define track_flux(pe) (track_flux[(pe)]) 34 #define track_out_flux(pe) (track_out_flux[(pe)]) 38 #define track_leakage(pe) (track_leakage[(pe)]) 66 int _track_message_size;
69 std::vector<std::vector<float> > _send_buffers;
72 std::vector<int> _send_buffers_index;
75 std::vector<std::vector<float> > _receive_buffers;
78 std::vector<std::vector<long> > _boundary_tracks;
81 std::vector<int> _send_size;
84 std::vector<int> _receive_size;
87 std::vector<std::vector<long> > _track_connections;
90 std::vector<std::vector<int> > _domain_connections;
93 std::vector<int> _neighbor_domains;
96 std::unordered_map<int, int> _neighbor_connections;
99 MPI_Request* _MPI_requests;
108 std::vector<long> _tracks_from_vacuum;
111 std::vector<std::vector<bool> > _track_flux_sent;
123 void setupMPIBuffers();
124 void deleteMPIBuffers();
125 void packBuffers(std::vector<long> &packing_indexes);
126 void transferAllInterfaceFluxes();
127 void printCycle(
long track_start,
int domain_start,
int length);
128 void boundaryFluxChecker();
131 void resetBoundaryFluxes();
153 void setFluxes(FP_PRECISION* in_fluxes,
int num_fluxes);
163 FP_PRECISION* fsr_flux);
171 void getFluxes(FP_PRECISION* out_fluxes,
int num_fluxes);
175 std::vector<double> dim2,
double offset,
void transferBoundaryFlux(Track *track, int azim_index, int polar_index, bool direction, float *track_flux)
Updates the boundary flux for a Track given boundary conditions.
Definition: CPUSolver.cpp:2385
This a subclass of the Solver class for multi-core CPUs using OpenMP multi-threading.
Definition: CPUSolver.h:54
void tallyCurrent(segment *curr_segment, int azim_index, int polar_index, float *track_flux, bool fwd)
Tallies the current contribution from this segment across the the appropriate CMFD mesh cell surface...
Definition: CPUSolver.cpp:2364
virtual void computeFSRSources(int iteration)
Computes the total source (fission, scattering, fixed) in each FSR.
Definition: CPUSolver.cpp:1771
virtual void initializeFSRs()
Initializes the FSR volumes and Materials array.
Definition: CPUSolver.cpp:231
void copyBoundaryFluxes()
Copies values from the start flux into the boundary flux array for both the "forward" and "reverse" d...
Definition: CPUSolver.cpp:453
virtual ~CPUSolver()
Destructor deletes array for OpenMP mutual exclusion locks for FSR scalar flux updates, and calls Solver parent class destructor to deletes arrays for fluxes and sources.
Definition: CPUSolver.cpp:34
virtual void initializeFluxArrays()
Allocates memory for Track boundary angular flux and leakage and FSR scalar flux arrays.
Definition: CPUSolver.cpp:252
omp_lock_t * _FSR_locks
Definition: CPUSolver.h:62
double computeResidual(residualType res_type)
Computes the residual between source/flux iterations.
Definition: CPUSolver.cpp:1940
The TrackGenerator is dedicated to generating and storing Tracks which cyclically wrap across the Geo...
Definition: TrackGenerator.h:36
void tallyScalarFlux(segment *curr_segment, int azim_index, int polar_index, FP_PRECISION *fsr_flux, float *track_flux)
Computes the contribution to the FSR scalar flux from a Track segment.
Definition: CPUSolver.cpp:2230
virtual void initializeSourceArrays()
Allocates memory for FSR source arrays.
Definition: CPUSolver.cpp:361
void initializeFixedSources()
Populates array of fixed sources assigned by FSR.
Definition: CPUSolver.cpp:398
void computeFSRFissionSources()
Computes the total fission source in each FSR.
Definition: CPUSolver.cpp:1857
Definition: CPUSolver.h:42
void computeKeff()
Compute from successive fission sources.
Definition: CPUSolver.cpp:2085
virtual void addSourceToScalarFlux()
Add the source term contribution in the transport equation to the FSR scalar flux.
Definition: CPUSolver.cpp:2433
void printNegativeSources(int iteration, int num_x, int num_y, int num_z)
A function that prints the number of FSRs with negative sources in the whole geometry subdivided by a...
Definition: CPUSolver.cpp:2849
virtual double normalizeFluxes()
Normalizes all FSR scalar fluxes and Track boundary angular fluxes to the total fission source (times...
Definition: CPUSolver.cpp:1692
Contains classes which extend the TraverseSegments class to apply algorithms to Tracks and possibly t...
void setFixedSourceByFSR(long fsr_id, int group, FP_PRECISION source)
Assign a fixed source for a flat source region and energy group.
Definition: CPUSolver.cpp:204
int getNumThreads()
Returns the number of shared memory OpenMP threads in use.
Definition: CPUSolver.cpp:45
A segment represents a line segment within a single flat source region along a track.
Definition: Track.h:27
void computeFSRFissionRates(double *fission_rates, long num_FSRs, bool nu=false)
Computes the volume-averaged, energy-integrated fission or nu-fission rate in each FSR and stores the...
Definition: CPUSolver.cpp:2650
virtual void stabilizeFlux()
Adjusts the scalar flux for transport stabilization.
Definition: CPUSolver.cpp:2561
int _num_threads
Definition: CPUSolver.h:59
void accumulateScalarFluxContribution(long fsr_id, FP_PRECISION weight, FP_PRECISION *fsr_flux)
Move the segment(s)' contributions to the scalar flux from the buffer to the global scalar flux array...
Definition: CPUSolver.cpp:2335
virtual void computeStabilizingFlux()
Computes the stabilizing flux for transport stabilization.
Definition: CPUSolver.cpp:2490
CPUSolver(TrackGenerator *track_generator=NULL)
Constructor initializes array pointers for Tracks and Materials.
Definition: CPUSolver.cpp:13
This is an abstract base class which different Solver subclasses implement for different architecture...
Definition: Solver.h:121
void getFluxes(FP_PRECISION *out_fluxes, int num_fluxes)
Fills an array with the scalar fluxes.
Definition: CPUSolver.cpp:66
void computeFSRScatterSources()
Computes the total scattering source in each FSR.
Definition: CPUSolver.cpp:1899
void storeFSRFluxes()
Stores the FSR scalar fluxes in the old scalar flux array.
Definition: CPUSolver.cpp:1678
void setNumThreads(int num_threads)
Sets the number of shared memory OpenMP threads to use (>0).
Definition: CPUSolver.cpp:132
void transportSweep()
This method performs one transport sweep of all azimuthal angles, Tracks, Track segments, polar angles and energy groups.
Definition: CPUSolver.cpp:2165
void printInputParamsSummary()
A function that prints a summary of the input parameters.
Definition: CPUSolver.cpp:2717
void tallyStartingCurrents()
Computes the total current impingent on boundary CMFD cells from starting angular fluxes...
Definition: CPUSolver.cpp:468
void printFluxesTemp()
A function that prints fsr fluxes in xy plane at z=middle.
Definition: CPUSolver.cpp:2812
A Track represents a characteristic line across the geometry.
Definition: Track.h:67
void printFSRFluxes(std::vector< double > dim1, std::vector< double > dim2, double offset, const char *plane)
A function that prints the source region fluxes on a 2D mesh grid.
Definition: CPUSolver.cpp:2734
virtual void flattenFSRFluxes(FP_PRECISION value)
Set the scalar flux for each FSR and energy group to some value.
Definition: CPUSolver.cpp:1648
#define track_flux(pe)
Definition: CPUSolver.h:30
residualType
The type of residual used for the convergence criterion.
Definition: Solver.h:86
void zeroTrackFluxes()
Zero each Track's boundary fluxes for each energy group (and polar angle in 2D) in the "forward" and ...
Definition: CPUSolver.cpp:433
void setFluxes(FP_PRECISION *in_fluxes, int num_fluxes)
Set the flux array for use in transport sweep source calculations.
Definition: CPUSolver.cpp:180
void flattenFSRFluxesChiSpectrum()
Set the scalar flux for each FSR to a chi spectrum.
Definition: CPUSolver.cpp:1661