From 855918533309e80d5eadb59d5071ff1f233bc633 Mon Sep 17 00:00:00 2001 From: Ann Almgren Date: Fri, 2 Feb 2024 12:31:17 -0800 Subject: [PATCH] Fix particles (#1422) * fix how we locate particles with terrain * fix particle issue that caused crash with CUDA + DEBUG --- Source/ERF.H | 2 +- Source/ERF.cpp | 4 ---- Source/Particles/ParticleData.H | 4 ++-- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Source/ERF.H b/Source/ERF.H index c7cf09297..dfaa7481f 100644 --- a/Source/ERF.H +++ b/Source/ERF.H @@ -682,7 +682,7 @@ private: #ifdef ERF_USE_PARTICLES // Particle container with all particle species - static ParticleData particleData; + ParticleData particleData; // variables and functions for tracers particles bool m_use_tracer_particles; /*!< tracer particles that advect with flow */ diff --git a/Source/ERF.cpp b/Source/ERF.cpp index 99ed04d29..f1cf4bf97 100644 --- a/Source/ERF.cpp +++ b/Source/ERF.cpp @@ -28,10 +28,6 @@ Vector ERF::ref_tags; SolverChoice ERF::solverChoice; -#ifdef ERF_USE_PARTICLES -ParticleData ERF::particleData; -#endif - // Time step control amrex::Real ERF::cfl = 0.8; amrex::Real ERF::fixed_dt = -1.0; diff --git a/Source/Particles/ParticleData.H b/Source/Particles/ParticleData.H index d93d086af..b7e8c611b 100644 --- a/Source/Particles/ParticleData.H +++ b/Source/Particles/ParticleData.H @@ -50,12 +50,12 @@ class ParticleData } /*! Write checkpoint files */ - void Checkpoint ( const std::string& a_fname ) + void Checkpoint ( const std::string& a_fname ) const { BL_PROFILE("ParticleData::Checkpoint()"); for (ParticlesNamesVector::size_type i = 0; i < m_namelist.size(); i++) { auto name( m_namelist[i] ); - auto particles( m_particle_species[name] ); + auto particles( m_particle_species.at(name) ); particles->Checkpoint( a_fname, name, true, particles->varNames() ); } }