Skip to content

Commit

Permalink
Fix start_comp offset in tracer particle routines (AMReX-Codes#4098)
Browse files Browse the repository at this point in the history
This makes the routines work as expected given the variable names
(currently, `ncomp` was being treated as `end_comp`)

The proposed changes:
- [x] fix a bug or incorrect behavior in AMReX
- [ ] add new capabilities to AMReX
- [ ] changes answers in the test suite to more than roundoff level
- [ ] are likely to significantly affect the results of downstream AMReX
users
- [ ] include documentation in the code and/or rst files, if appropriate
  • Loading branch information
atmyers authored Aug 20, 2024
1 parent 0e97bad commit baec46e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Src/Particle/AMReX_TracerParticle_mod_K.H
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ void linear_interpolate_to_particle (const P& p,
amrex::Real sz[] = {amrex::Real(1.0) - zint, zint};
#endif

for (int comp = start_comp; comp < ncomp; ++comp) {
for (int comp = start_comp; comp < start_comp + ncomp; ++comp) {
val[ctr] = ParticleReal(0.0);
#if (AMREX_SPACEDIM > 2)
for (int kk = 0; kk <=1; ++kk) {
Expand Down Expand Up @@ -378,7 +378,7 @@ void linear_interpolate_to_particle_z (const P& p,
hint_ilojhi,
hint_ihijhi};
#endif
for (int comp = start_comp; comp < ncomp; ++comp) {
for (int comp = start_comp; comp < start_comp + ncomp; ++comp) {
val[ctr] = amrex::ParticleReal(0.);
#if (AMREX_SPACEDIM == 2)
int k0 = 0;
Expand Down Expand Up @@ -550,7 +550,7 @@ void linear_interpolate_to_particle_mapped (const P& p,

int i = p.idata(0);
int j = p.idata(1);
for (int comp = start_comp; comp < ncomp; ++comp) {
for (int comp = start_comp; comp < start_comp + ncomp; ++comp) {

#if (AMREX_SPACEDIM == 2)
// Value of data at surrounding nodes
Expand Down

0 comments on commit baec46e

Please sign in to comment.