@@ -761,7 +761,7 @@ namespace DRO {
761761 V[0 ] = 0 ;
762762 V[1 ] = 0 ;
763763 V[2 ] = 0 ;
764- Real n = 0 ;
764+ Real n_sum = 0 ;
765765 # pragma omp parallel
766766 {
767767 Real thread_nvx_sum = 0.0 ;
@@ -773,20 +773,20 @@ namespace DRO {
773773 const Realf* block_data = cell->get_data (popID);
774774
775775 # pragma omp for
776- for (vmesh::LocalID lid =0 ; lid <cell->get_number_of_velocity_blocks (popID); ++lid ) {
776+ for (vmesh::LocalID n =0 ; n <cell->get_number_of_velocity_blocks (popID); ++n ) {
777777 // Get the volume of a velocity cell
778778 const Real DV3
779- = parameters[lid * BlockParams::N_VELOCITY_BLOCK_PARAMS + BlockParams::DVX]
780- * parameters[lid * BlockParams::N_VELOCITY_BLOCK_PARAMS + BlockParams::DVY]
781- * parameters[lid * BlockParams::N_VELOCITY_BLOCK_PARAMS + BlockParams::DVZ];
779+ = parameters[n * BlockParams::N_VELOCITY_BLOCK_PARAMS + BlockParams::DVX]
780+ * parameters[n * BlockParams::N_VELOCITY_BLOCK_PARAMS + BlockParams::DVY]
781+ * parameters[n * BlockParams::N_VELOCITY_BLOCK_PARAMS + BlockParams::DVZ];
782782 // Get the velocity cell indices of the cells that are a part of the nonthermal population
783783 vector< array<uint, 3 > > vCellIndices;
784784 vCellIndices.clear ();
785785 // Save indices to the std::vector
786786 if ( calculateNonthermal == true ) {
787- getNonthermalVelocityCellIndices (¶meters[lid * BlockParams::N_VELOCITY_BLOCK_PARAMS], vCellIndices, popID);
787+ getNonthermalVelocityCellIndices (¶meters[n * BlockParams::N_VELOCITY_BLOCK_PARAMS], vCellIndices, popID);
788788 } else {
789- getThermalVelocityCellIndices (¶meters[lid * BlockParams::N_VELOCITY_BLOCK_PARAMS], vCellIndices, popID);
789+ getThermalVelocityCellIndices (¶meters[n * BlockParams::N_VELOCITY_BLOCK_PARAMS], vCellIndices, popID);
790790 }
791791 // We have now fetched all of the needed velocity cell indices, so now go through them:
792792 for ( vector< array<uint, 3 > >::const_iterator it = vCellIndices.begin (); it != vCellIndices.end (); ++it ) {
@@ -796,14 +796,14 @@ namespace DRO {
796796 const uint j = indices[1 ];
797797 const uint k = indices[2 ];
798798 // Get the coordinates of the velocity cell (e.g. VX = block_vx_min_coordinates + (velocity_cell_indice_x+0.5)*length_of_velocity_cell_in_x_direction)
799- const Real VX = parameters[lid * BlockParams::N_VELOCITY_BLOCK_PARAMS + BlockParams::VXCRD] + (i + HALF) * parameters[lid * BlockParams::N_VELOCITY_BLOCK_PARAMS + BlockParams::DVX];
800- const Real VY = parameters[lid * BlockParams::N_VELOCITY_BLOCK_PARAMS + BlockParams::VYCRD] + (j + HALF) * parameters[lid * BlockParams::N_VELOCITY_BLOCK_PARAMS + BlockParams::DVY];
801- const Real VZ = parameters[lid * BlockParams::N_VELOCITY_BLOCK_PARAMS + BlockParams::VZCRD] + (k + HALF) * parameters[lid * BlockParams::N_VELOCITY_BLOCK_PARAMS + BlockParams::DVZ];
799+ const Real VX = parameters[n * BlockParams::N_VELOCITY_BLOCK_PARAMS + BlockParams::VXCRD] + (i + HALF) * parameters[n * BlockParams::N_VELOCITY_BLOCK_PARAMS + BlockParams::DVX];
800+ const Real VY = parameters[n * BlockParams::N_VELOCITY_BLOCK_PARAMS + BlockParams::VYCRD] + (j + HALF) * parameters[n * BlockParams::N_VELOCITY_BLOCK_PARAMS + BlockParams::DVY];
801+ const Real VZ = parameters[n * BlockParams::N_VELOCITY_BLOCK_PARAMS + BlockParams::VZCRD] + (k + HALF) * parameters[n * BlockParams::N_VELOCITY_BLOCK_PARAMS + BlockParams::DVZ];
802802 // Add the value of the coordinates and multiply by the AVGS value of the velocity cell and the volume of the velocity cell
803- thread_nvx_sum += block_data[lid * SIZE_VELBLOCK + cellIndex (i,j,k)]*VX*DV3;
804- thread_nvy_sum += block_data[lid * SIZE_VELBLOCK + cellIndex (i,j,k)]*VY*DV3;
805- thread_nvz_sum += block_data[lid * SIZE_VELBLOCK + cellIndex (i,j,k)]*VZ*DV3;
806- thread_n_sum += block_data[lid * SIZE_VELBLOCK + cellIndex (i,j,k)]*DV3;
803+ thread_nvx_sum += block_data[n * SIZE_VELBLOCK + cellIndex (i,j,k)]*VX*DV3;
804+ thread_nvy_sum += block_data[n * SIZE_VELBLOCK + cellIndex (i,j,k)]*VY*DV3;
805+ thread_nvz_sum += block_data[n * SIZE_VELBLOCK + cellIndex (i,j,k)]*VZ*DV3;
806+ thread_n_sum += block_data[n * SIZE_VELBLOCK + cellIndex (i,j,k)]*DV3;
807807 }
808808 } // for-loop over velocity blocks
809809
@@ -815,14 +815,14 @@ namespace DRO {
815815 V[0 ] += thread_nvx_sum;
816816 V[1 ] += thread_nvy_sum;
817817 V[2 ] += thread_nvz_sum;
818- n += thread_n_sum;
818+ n_sum += thread_n_sum;
819819 }
820820 }
821821
822- // Finally, divide n *V by V.
823- V[0 ]/=n ;
824- V[1 ]/=n ;
825- V[2 ]/=n ;
822+ // Finally, divide n_sum *V by V.
823+ V[0 ]/=n_sum ;
824+ V[1 ]/=n_sum ;
825+ V[2 ]/=n_sum ;
826826 return ;
827827 }
828828
0 commit comments