Skip to content

Commit

Permalink
Fixed bug in plotting thermal flux using CPUSolver
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Boyd committed Oct 1, 2013
1 parent d7e6440 commit fa614a5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 15 deletions.
3 changes: 0 additions & 3 deletions openmoc/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,16 +507,13 @@ def plotFluxes(geometry, solver, energy_groups=[0], gridsize=250):
for index, group in enumerate(energy_groups):
fluxes[index,j,i] = solver.getFSRScalarFlux(fsr_id, group)


# Loop over all energy group and create a plot
for index, group in enumerate(energy_groups):

# Plot a 2D color map of the flat source regions
fig = plt.figure()
plt.imshow(np.flipud(fluxes[index,:,:]), \
extent=[xmin, xmax, ymin, ymax])
# plt.imshow(np.flipud(fluxes[index,:,:]),
# extent=[xmin, xmax, ymin, ymax])
plt.colorbar()
plt.title('Flat Source Region Scalar Flux in Group ' + str(group))
filename = directory + 'fsr-flux-group-' + str(group) + '.png'
Expand Down
10 changes: 5 additions & 5 deletions sample-input/benchmarks/c5g7/c5g7-gpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,10 @@

log.py_printf('NORMAL', 'Plotting data...')

plotter.plotTracks(track_generator)
plotter.plotMaterials(geometry, gridsize=500)
plotter.plotCells(geometry, gridsize=500)
plotter.plotFlatSourceRegions(geometry, gridsize=500)
plotter.plotFluxes(geometry, solver, energy_groups=[1,2,3,4,5,6,7])
#plotter.plotTracks(track_generator)
#plotter.plotMaterials(geometry, gridsize=500)
#plotter.plotCells(geometry, gridsize=500)
#plotter.plotFlatSourceRegions(geometry, gridsize=500)
#plotter.plotFluxes(geometry, solver, energy_groups=[1,2,3,4,5,6,7])

log.py_printf('TITLE', 'Finished')
10 changes: 5 additions & 5 deletions sample-input/benchmarks/c5g7/c5g7.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,10 @@

log.py_printf('NORMAL', 'Plotting data...')

plotter.plotTracks(track_generator)
plotter.plotMaterials(geometry, gridsize=500)
plotter.plotCells(geometry, gridsize=500)
plotter.plotFlatSourceRegions(geometry, gridsize=500)
plotter.plotFluxes(geometry, solver, energy_groups=[1,2,3,4,5,6,7])
#plotter.plotTracks(track_generator)
#plotter.plotMaterials(geometry, gridsize=500)
#plotter.plotCells(geometry, gridsize=500)
#plotter.plotFlatSourceRegions(geometry, gridsize=500)
#plotter.plotFluxes(geometry, solver, energy_groups=[1,2,3,4,5,6,7])

log.py_printf('TITLE', 'Finished')
2 changes: 1 addition & 1 deletion src/CPUSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ FP_PRECISION CPUSolver::getFSRScalarFlux(int fsr_id, int energy_group) {
"in energy group %d since energy groups are greater than 1",
fsr_id, energy_group);

return _scalar_flux(fsr_id,energy_group);
return _scalar_flux(fsr_id,energy_group-1);
}


Expand Down
2 changes: 1 addition & 1 deletion src/dev/gpu/GPUSolver.cu
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ FP_PRECISION GPUSolver::getFSRScalarFlux(int fsr_id, int energy_group) {

/* Copy the scalar flux for this FSR and energy group from the device */
FP_PRECISION fsr_scalar_flux;
int flux_index = fsr_id * _num_groups + energy_group - 1;
int flux_index = fsr_id * _num_groups + (energy_group - 1);
cudaMemcpy((void*)&fsr_scalar_flux, (void*)&_scalar_flux[flux_index],
sizeof(FP_PRECISION), cudaMemcpyDeviceToHost);

Expand Down

0 comments on commit fa614a5

Please sign in to comment.