Skip to content

Commit

Permalink
fixup: ensure current position is valid for frozen particles
Browse files Browse the repository at this point in the history
  • Loading branch information
streeve authored and pabloseleson committed Jan 3, 2025
1 parent f7c642e commit 1f3613e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/CabanaPD_Particles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ class Particles<MemorySpace, PMB, TemperatureIndependent, BaseOutput, Dimension>
auto type = sliceType();
auto rho = sliceDensity();
auto u = sliceDisplacement();
auto y = sliceCurrentPosition();
auto vol = sliceVolume();
auto nofail = sliceNoFail();

Expand All @@ -307,7 +306,6 @@ class Particles<MemorySpace, PMB, TemperatureIndependent, BaseOutput, Dimension>
Cabana::get( particle, CabanaPD::Field::ReferencePosition(),
d ) = px[d];
u( pid, d ) = 0.0;
y( pid, d ) = 0.0;
v( pid, d ) = 0.0;
f( pid, d ) = 0.0;
}
Expand Down Expand Up @@ -497,15 +495,17 @@ class Particles<MemorySpace, PMB, TemperatureIndependent, BaseOutput, Dimension>
auto y = Cabana::slice<0>( _aosoa_y, "current_positions" );
auto x = sliceReferencePosition();
auto u = sliceDisplacement();
Kokkos::RangePolicy<execution_space> policy( frozenOffset(),
referenceOffset() );
// Frozen particles are included in output so we include them in this
// loop to guarantee they are correct even though they never change.
Kokkos::RangePolicy<execution_space> policy( 0, referenceOffset() );
auto sum_x_u = KOKKOS_LAMBDA( const std::size_t pid )
{
for ( int d = 0; d < 3; d++ )
y( pid, d ) = x( pid, d ) + u( pid, d );
};
Kokkos::parallel_for( "CabanaPD::CalculateCurrentPositions", policy,
sum_x_u );
Kokkos::fence();
//_timer.stop();
}

Expand Down

0 comments on commit 1f3613e

Please sign in to comment.