Skip to content

Commit

Permalink
?
Browse files Browse the repository at this point in the history
  • Loading branch information
sellitforcache committed Feb 24, 2016
1 parent 8737744 commit 88c8d72
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
20 changes: 18 additions & 2 deletions pop_fission.cu
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ __global__ void pop_fission_kernel(unsigned N, cross_section_data* d_xsdata, par
// get tid
int tid = threadIdx.x+blockIdx.x*blockDim.x;

// declare shared variables
// declare shared variables
__shared__ unsigned n_isotopes;
__shared__ unsigned energy_grid_len;
__shared__ unsigned total_reaction_channels;
__shared__ float* energy_grid;
__shared__ dist_container* dist_scatter;
__shared__ dist_container* dist_energy;
__shared__ spatial_data* space;
Expand All @@ -21,6 +25,10 @@ __global__ void pop_fission_kernel(unsigned N, cross_section_data* d_xsdata, par

// have thread 0 of block copy all pointers and static info into shared memory
if (threadIdx.x == 0){
n_isotopes = d_xsdata[0].n_isotopes;
energy_grid_len = d_xsdata[0].energy_grid_len;
total_reaction_channels = d_xsdata[0].total_reaction_channels;
energy_grid = d_xsdata[0].energy_grid;
dist_scatter = d_xsdata[0].dist_scatter;
dist_energy = d_xsdata[0].dist_energy;
space = d_particles[0].space;
Expand Down Expand Up @@ -85,6 +93,14 @@ __global__ void pop_fission_kernel(unsigned N, cross_section_data* d_xsdata, par
unsigned this_law, this_len, this_intt, upper_len, lower_len, pre_index, pre_position;
float *this_var, *this_cdf, *this_pdf, *upper_var, *lower_var;

unsigned n_columns = n_isotopes + total_reaction_channels;
unsigned this_col = this_dex % n_columns;
unsigned this_row = (this_dex-this_col) / n_columns;
float E_of_index0 = energy_grid[this_row];
float E_of_index1 = energy_grid[this_row+1];

if(this_E < E_of_index0 | this_E > E_of_index1){printf("this %6.4E row %6.4E row+1 %6.4E \n",this_E,E_of_index0,E_of_index1);}

// load dist info
dist_data this_edist, this_sdist;
dist_data sdist_lower = dist_scatter[this_dex].lower[0];
Expand Down Expand Up @@ -113,7 +129,7 @@ __global__ void pop_fission_kernel(unsigned N, cross_section_data* d_xsdata, par
data_dex = position+k;

// check if this neutron is delayed or prompt
if ( get_rand(&rn) > beta ){
if ( get_rand(&rn) > -1 ){

// do individual stochastic mixing for this prompt neutron
// pick upper or lower edist via stochastic mixing
Expand Down
4 changes: 3 additions & 1 deletion scatter_level.cu
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ __global__ void scatter_level_kernel(unsigned N, unsigned starting_index, cross_
printf("law %u not yet implemented in level scttering!\n",this_law);
}

if(!isfinite(mu) | mu<-1.0 | mu>1.0){printf("MU MISSAMPLED IN LEVEL rxn %u: % 6.4E rn %12.10E E %6.4E erg %6.4E len %u tope %u array_index %u \n",this_rxn,mu,rn1,this_E,this_dist.erg,this_dist.len,this_tope,this_dex);}
if(!isfinite(mu)){printf("MU MISSAMPLED IN LEVEL rxn %u: % 6.4E rn %12.10E E %6.4E erg %6.4E len %u tope %u array_index %u \n",this_rxn,mu,rn1,this_E,this_dist.erg,this_dist.len,this_tope,this_dex);}
if(mu<-1.0){mu=-1.0;}
if(mu> 1.0){mu=1.0;}
}

// pre rotation directions
Expand Down
2 changes: 1 addition & 1 deletion whistory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1933,7 +1933,7 @@ void whistory::run(){
check_cuda(cudaPeekAtLastError());

// do safety check (if flagged)
safety_check( NUM_THREADS, Nrun, d_xsdata, d_particles, d_remap );
// safety_check( NUM_THREADS, Nrun, d_xsdata, d_particles, d_remap );

//if(RUN_FLAG==0){ //fixed source
// // pop secondaries back in
Expand Down

0 comments on commit 88c8d72

Please sign in to comment.