From c1d92c12ae9444974f636b65a9adad4e01fcb527 Mon Sep 17 00:00:00 2001 From: eyadammak Date: Tue, 13 Feb 2024 12:05:09 -0800 Subject: [PATCH 01/41] adding the time --- Docs/source/usage/parameters.rst | 6 ++- .../spacecraft_charging/PICMI_inputs_rz.py | 8 ++-- .../Tests/point_of_contact_EB/analysis.py | 17 +++++++-- Examples/Tests/point_of_contact_EB/inputs_3d | 2 +- Examples/Tests/scraping/analysis_rz.py | 4 +- Examples/Tests/scraping/analysis_rz_filter.py | 4 +- Python/pywarpx/particle_containers.py | 27 +++++-------- Source/Diagnostics/BTDiagnostics.cpp | 2 +- Source/Particles/ParticleBoundaryBuffer.cpp | 38 +++++++++++-------- .../PinnedMemoryParticleContainer.cpp | 14 ++++++- 10 files changed, 71 insertions(+), 51 deletions(-) diff --git a/Docs/source/usage/parameters.rst b/Docs/source/usage/parameters.rst index b02e6198213..67974d300e0 100644 --- a/Docs/source/usage/parameters.rst +++ b/Docs/source/usage/parameters.rst @@ -2752,8 +2752,10 @@ The data collected at each boundary is written out to a subdirectory of the diag By default, all of the collected particle data is written out at the end of the simulation. Optionally, the ``.intervals`` parameter can be given to specify writing out the data more often. This can be important if a large number of particles are lost, avoiding filling up memory with the accumulated lost particle data. -In addition to their usual attributes, the saved particles have an integer attribute ``timestamp``, which -indicates the PIC iteration at which each particle was absorbed at the boundary. +In addition to their usual attributes, the saved particles have an integer attribute ``step_scraped``, which +indicates the PIC iteration at which each particle was absorbed at the boundary, +and a real attribute ``time_scraped``, which indicates the exact time calculated when each +particle hits the EB. ``BoundaryScrapingDiagnostics`` can be used with ``..random_fraction``, ``..uniform_stride``, and ``..plot_filter_function``, which have the same behavior as for ``FullDiagnostics``. For ``BoundaryScrapingDiagnostics``, these filters are applied at the time the data is written to file. An implication of this is that more particles may initially be accumulated in memory than are ultimately written. ``t`` in ``plot_filter_function`` refers to the time the diagnostic is written rather than the time the particle crossed the boundary. diff --git a/Examples/Physics_applications/spacecraft_charging/PICMI_inputs_rz.py b/Examples/Physics_applications/spacecraft_charging/PICMI_inputs_rz.py index 08ebe23f828..23f63f19e3a 100644 --- a/Examples/Physics_applications/spacecraft_charging/PICMI_inputs_rz.py +++ b/Examples/Physics_applications/spacecraft_charging/PICMI_inputs_rz.py @@ -249,16 +249,16 @@ def compute_actual_charge_on_spacecraft(): data_list = ['Er', 'Ez', 'phi', 'rho', 'rho_electrons', 'rho_protons'], warpx_format = 'openpmd', - write_dir = '.', - warpx_file_prefix = 'spacecraft_charging_plt' + #write_dir = '.', + #warpx_file_prefix = 'spacecraft_charging_plt' ) part_diag = picmi.ParticleDiagnostic(name = 'diag1', period = diagnostic_interval, species = [electrons, protons], warpx_format = 'openpmd', - write_dir = '.', - warpx_file_prefix = 'spacecraft_charging_plt' + #write_dir = '.', + #warpx_file_prefix = 'spacecraft_charging_plt' ) ########################## diff --git a/Examples/Tests/point_of_contact_EB/analysis.py b/Examples/Tests/point_of_contact_EB/analysis.py index fd4782241b2..0bde2f59f49 100755 --- a/Examples/Tests/point_of_contact_EB/analysis.py +++ b/Examples/Tests/point_of_contact_EB/analysis.py @@ -26,26 +26,35 @@ ts_scraping = OpenPMDTimeSeries('./diags/diag2/particles_at_eb/') it=ts_scraping.iterations -x,y,z=ts_scraping.get_particle( ['x','y','z'], species='electron', iteration=it ) +step_scraped, time_scraped, x, y, z=ts_scraping.get_particle( ['step_scraped','time_scraped','x','y','z'], species='electron', iteration=it ) +time_scraped_reduced=time_scraped[0]*1e10 # Analytical results calculated x_analytic=-0.1983 y_analytic=0.02584 z_analytic=0.0000 +#result obtained by analysis of simulations +step=3 +time_reduced=3.58 + print('NUMERICAL coordinates of the point of contact:') -print('x=%5.4f, y=%5.4f, z=%5.4f' % (x[0], y[0], z[0])) +print('step_scraped=%d, time_stamp=%5.4f e-10, x=%5.4f, y=%5.4f, z=%5.4f' % (step_scraped[0],time_reduced,x[0], y[0], z[0])) print('\n') print('ANALYTICAL coordinates of the point of contact:') -print('x=%5.4f, y=%5.4f, z=%5.4f' % (x_analytic, y_analytic, z_analytic)) +print('step_scraped=%d, time_stamp=%5.4f e-10, x=%5.4f, y=%5.4f, z=%5.4f' % (step, time_reduced, x_analytic, y_analytic, z_analytic)) tolerance=0.001 +tolerance_t=0.003 print("tolerance = "+ str(tolerance *100) + '%') +print("tolerance for the time = "+ str(tolerance_t *100) + '%') +diff_step=np.abs((step_scraped[0]-step)/step) +diff_time=np.abs((time_scraped_reduced-time_reduced)/time_reduced) diff_x=np.abs((x[0]-x_analytic)/x_analytic) diff_y=np.abs((y[0]-y_analytic)/y_analytic) print("percentage error for x = %5.4f %%" %(diff_x *100)) print("percentage error for y = %5.4f %%" %(diff_y *100)) -assert (diff_x < tolerance) and (diff_y < tolerance) and (np.abs(z[0]) < 1e-8) , 'Test point_of_contact did not pass' +assert (diff_x < tolerance) and (diff_y < tolerance) and (np.abs(z[0]) < 1e-8) and (diff_step < 1e-8) and (diff_time < tolerance_t) , 'Test point_of_contact did not pass' diff --git a/Examples/Tests/point_of_contact_EB/inputs_3d b/Examples/Tests/point_of_contact_EB/inputs_3d index 64f8b520161..c8bc98c11b9 100644 --- a/Examples/Tests/point_of_contact_EB/inputs_3d +++ b/Examples/Tests/point_of_contact_EB/inputs_3d @@ -19,7 +19,7 @@ boundary.potential_hi_y = 0 boundary.potential_lo_z = 0 boundary.potential_hi_z = 0 -warpx.const_dt = 1.216119097e-10 +warpx.const_dt = 1.0e-10 warpx.eb_implicit_function = "-(x**2+y**2+z**2-0.2**2)" # Do not evolve the E and B fields diff --git a/Examples/Tests/scraping/analysis_rz.py b/Examples/Tests/scraping/analysis_rz.py index 0390eed580e..3e060cb9d23 100755 --- a/Examples/Tests/scraping/analysis_rz.py +++ b/Examples/Tests/scraping/analysis_rz.py @@ -53,8 +53,8 @@ def n_remaining_particles( iteration ): w, = ts_full.get_particle(['w'], iteration=iteration) return len(w) def n_scraped_particles( iteration ): - timestamp = ts_scraping.get_particle( ['timestamp'], iteration=ts_scraping.iterations[0] ) - return (timestamp <= iteration).sum() + step_scraped = ts_scraping.get_particle( ['step_scraped'], iteration=ts_scraping.iterations[0] ) + return (step_scraped <= iteration).sum() n_remaining = np.array([ n_remaining_particles(iteration) for iteration in ts_full.iterations ]) n_scraped = np.array([ n_scraped_particles(iteration) for iteration in ts_full.iterations ]) n_total = n_remaining[0] diff --git a/Examples/Tests/scraping/analysis_rz_filter.py b/Examples/Tests/scraping/analysis_rz_filter.py index b97b6e0eb5a..920825ad421 100755 --- a/Examples/Tests/scraping/analysis_rz_filter.py +++ b/Examples/Tests/scraping/analysis_rz_filter.py @@ -50,8 +50,8 @@ def n_remaining_particles( iteration ): w, = ts_full.get_particle(['w'], iteration=iteration) return len(w) def n_scraped_particles( iteration ): - timestamp = ts_scraping.get_particle( ['timestamp'], iteration=ts_scraping.iterations[0] ) - return (timestamp <= iteration).sum() + step_scraped = ts_scraping.get_particle( ['step_scraped'], iteration=ts_scraping.iterations[0] ) + return (step_scraped <= iteration).sum() def n_scraped_z_leq_zero( iteration ): z_pos, = ts_scraping.get_particle( ['z'], iteration=ts_scraping.iterations[0] ) return (z_pos <= 0).sum() diff --git a/Python/pywarpx/particle_containers.py b/Python/pywarpx/particle_containers.py index 393663bc8cf..581f645180f 100644 --- a/Python/pywarpx/particle_containers.py +++ b/Python/pywarpx/particle_containers.py @@ -223,7 +223,7 @@ def get_particle_real_arrays(self, comp_name, level, copy_to_host=False): data_array = [] for pti in libwarpx.libwarpx_so.WarpXParIter(self.particle_container, level): soa = pti.soa() - idx = soa.get_real_data(comp_idx) + idx = soa.GetRealData(comp_idx) if copy_to_host: data_array.append(idx.to_numpy(copy=True)) else: @@ -269,7 +269,7 @@ def get_particle_int_arrays(self, comp_name, level, copy_to_host=False): data_array = [] for pti in libwarpx.libwarpx_so.WarpXParIter(self.particle_container, level): soa = pti.soa() - idx = soa.get_int_data(comp_idx) + idx = soa.GetIntData(comp_idx) if copy_to_host: data_array.append(idx.to_numpy(copy=True)) else: @@ -309,7 +309,7 @@ def get_particle_idcpu_arrays(self, level, copy_to_host=False): data_array = [] for pti in libwarpx.libwarpx_so.WarpXParIter(self.particle_container, level): soa = pti.soa() - idx = soa.get_idcpu_data() + idx = soa.GetIdCPUData() if copy_to_host: data_array.append(idx.to_numpy(copy=True)) else: @@ -772,9 +772,9 @@ def get_particle_boundary_buffer(self, species_name, boundary, comp_name, level) form x/y/z_hi/lo or eb. comp_name : str - The component of the array data that will be returned. If - "step_scraped" the special attribute holding the timestep at - which a particle was scraped will be returned. + The component of the array data that will be returned. + "x", "y", "z", "ux", "uy", "uz", "w" + "step_scraped","time_scraped", "nx", "ny", "nz" level : int Which AMR level to retrieve scraped particle data from. @@ -784,19 +784,10 @@ def get_particle_boundary_buffer(self, species_name, boundary, comp_name, level) part_container = self.particle_buffer.get_particle_container( species_name, self._get_boundary_number(boundary) ) + comp = part_container.comp_names data_array = [] - if comp_name == 'step_scraped': - # the step scraped is always the final integer component - comp_idx = part_container.num_int_comps - 1 - for ii, pti in enumerate(libwarpx.libwarpx_so.BoundaryBufferParIter(part_container, level)): - soa = pti.soa() - data_array.append(xp.array(soa.get_int_data(comp_idx), copy=False)) - else: - container_wrapper = ParticleContainerWrapper(species_name) - comp_idx = container_wrapper.particle_container.get_comp_index(comp_name) - for ii, pti in enumerate(libwarpx.libwarpx_so.BoundaryBufferParIter(part_container, level)): - soa = pti.soa() - data_array.append(xp.array(soa.get_real_data(comp_idx), copy=False)) + for ii in comp: + data_array.append(comp) return data_array diff --git a/Source/Diagnostics/BTDiagnostics.cpp b/Source/Diagnostics/BTDiagnostics.cpp index 16617159662..41c710805e9 100644 --- a/Source/Diagnostics/BTDiagnostics.cpp +++ b/Source/Diagnostics/BTDiagnostics.cpp @@ -1299,7 +1299,7 @@ BTDiagnostics::InterleaveBufferAndSnapshotHeader ( std::string buffer_Header_pat BTDPlotfileHeaderImpl buffer_HeaderImpl(buffer_Header_path); buffer_HeaderImpl.ReadHeaderData(); - // Update timestamp of snapshot with recently flushed buffer + // Update step_scraped of snapshot with recently flushed buffer snapshot_HeaderImpl.set_time( buffer_HeaderImpl.time() ); snapshot_HeaderImpl.set_timestep( buffer_HeaderImpl.timestep() ); diff --git a/Source/Particles/ParticleBoundaryBuffer.cpp b/Source/Particles/ParticleBoundaryBuffer.cpp index eaeb255b54b..4a49df429c6 100644 --- a/Source/Particles/ParticleBoundaryBuffer.cpp +++ b/Source/Particles/ParticleBoundaryBuffer.cpp @@ -44,7 +44,7 @@ struct IsOutsideDomainBoundary { } }; -struct FindEmbeddedBoundaryIntersection { +struct FindBoundaryIntersection { const int m_index; const int m_step; const amrex::Real m_dt; @@ -69,9 +69,6 @@ struct FindEmbeddedBoundaryIntersection { dst.m_runtime_idata[j][dst_i] = src.m_runtime_idata[j][src_i]; } - // Also record the integer timestep on the destination - dst.m_runtime_idata[m_index][dst_i] = m_step; - // Modify the position of the destination particle: // Move it to the point of intersection with the embedded boundary // (which is found by using a bisection algorithm) @@ -83,28 +80,32 @@ struct FindEmbeddedBoundaryIntersection { amrex::ParticleReal const uy = dst.m_rdata[PIdx::uy][dst_i]; amrex::ParticleReal const uz = dst.m_rdata[PIdx::uz][dst_i]; + // Bisection algorithm to find the point where phi(x,y,z)=0 (i.e. on the embedded boundary) + // Temporary variables to avoid implicit capture amrex::Real dt = m_dt; amrex::Array4 phiarr = m_phiarr; amrex::GpuArray dxi = m_dxi; amrex::GpuArray plo = m_plo; - // Bisection algorithm to find the point where phi(x,y,z)=0 (i.e. on the embedded boundary) - amrex::Real dt_fraction = amrex::bisect( 0.0, 1.0, [=] (amrex::Real dt_frac) { int i, j, k; amrex::Real W[AMREX_SPACEDIM][2]; - amrex::ParticleReal x_temp=xp, y_temp=yp, z_temp=zp; + amrex::Real x_temp=xp, y_temp=yp, z_temp=zp; UpdatePosition(x_temp, y_temp, z_temp, ux, uy, uz, -dt_frac*dt); ablastr::particles::compute_weights_nodal(x_temp, y_temp, z_temp, plo, dxi, i, j, k, W); amrex::Real phi_value = ablastr::particles::interp_field_nodal(i, j, k, W, phiarr); return phi_value; } ); + // Also record the real time on the destination + dst.m_runtime_idata[m_index][dst_i] = m_step; + dst.m_runtime_rdata[m_index][dst_i] = m_step*m_dt + (1- dt_fraction)*m_dt; + // Now that dt_fraction has be obtained (with bisect) // Save the corresponding position of the particle at the boundary - amrex::ParticleReal x_temp=xp, y_temp=yp, z_temp=zp; + amrex::Real x_temp=xp, y_temp=yp, z_temp=zp; UpdatePosition(x_temp, y_temp, z_temp, ux, uy, uz, -dt_fraction*m_dt); #if (defined WARPX_DIM_3D) @@ -131,6 +132,7 @@ struct FindEmbeddedBoundaryIntersection { struct CopyAndTimestamp { int m_index; int m_step; + amrex::Real m_dt; template AMREX_GPU_HOST_DEVICE @@ -148,9 +150,11 @@ struct CopyAndTimestamp { dst.m_runtime_idata[j][dst_i] = src.m_runtime_idata[j][src_i]; } dst.m_runtime_idata[m_index][dst_i] = m_step; + dst.m_runtime_rdata[m_index][dst_i] = m_step*m_dt; } }; + ParticleBoundaryBuffer::ParticleBoundaryBuffer () { m_particle_containers.resize(numBoundaries()); @@ -328,7 +332,8 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, if (!buffer[i].isDefined()) { buffer[i] = pc.make_alike(); - buffer[i].AddIntComp("timestamp", false); + buffer[i].AddRealComp("time_scraped", false); + buffer[i].AddIntComp("step_scraped", false); } auto& species_buffer = buffer[i]; for (int lev = 0; lev < pc.numLevels(); ++lev) @@ -368,12 +373,14 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, } { WARPX_PROFILE("ParticleBoundaryBuffer::gatherParticles::filterAndTransform"); - const int timestamp_index = ptile_buffer.NumRuntimeIntComps()-1; + auto& warpx = WarpX::GetInstance(); + const auto dt = warpx.getdt(pti.GetLevel()); + const int step_scraped_index = ptile_buffer.NumRuntimeRealComps()-1; const int timestep = warpx_instance.getistep(0); amrex::filterAndTransformParticles(ptile_buffer, ptile, predicate, - CopyAndTimestamp{timestamp_index, timestep}, + CopyAndTimestamp{step_scraped_index, timestep, dt}, 0, dst_index); } } @@ -393,7 +400,7 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, if (!buffer[i].isDefined()) { buffer[i] = pc.make_alike(); - buffer[i].AddIntComp("timestamp", false); + buffer[i].AddRealComp("step_scraped", false); } auto& species_buffer = buffer[i]; for (int lev = 0; lev < pc.numLevels(); ++lev) @@ -444,16 +451,15 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, WARPX_PROFILE("ParticleBoundaryBuffer::gatherParticles::resize_eb"); ptile_buffer.resize(dst_index + amrex::get<0>(reduce_data.value())); } - - const int timestamp_index = ptile_buffer.NumRuntimeIntComps()-1; - const int timestep = warpx_instance.getistep(0); auto& warpx = WarpX::GetInstance(); const auto dt = warpx.getdt(pti.GetLevel()); + const int step_scraped_index = ptile_buffer.NumRuntimeRealComps()-1; + const int timestep = warpx_instance.getistep(0); { WARPX_PROFILE("ParticleBoundaryBuffer::gatherParticles::filterTransformEB"); amrex::filterAndTransformParticles(ptile_buffer, ptile, predicate, - FindEmbeddedBoundaryIntersection{timestamp_index, timestep, dt, phiarr, dxi, plo}, 0, dst_index); + FindBoundaryIntersection{step_scraped_index, timestep, dt, phiarr, dxi, plo}, 0, dst_index); } } } diff --git a/Source/Python/Particles/PinnedMemoryParticleContainer.cpp b/Source/Python/Particles/PinnedMemoryParticleContainer.cpp index d4f6a422dbe..ad0cafade9e 100644 --- a/Source/Python/Particles/PinnedMemoryParticleContainer.cpp +++ b/Source/Python/Particles/PinnedMemoryParticleContainer.cpp @@ -15,4 +15,16 @@ void init_PinnedMemoryParticleContainer (py::module& m) PinnedMemoryParticleContainer, amrex::ParticleContainerPureSoA > pmpc (m, "PinnedMemoryParticleContainer"); -} + pmpc + .def_property_readonly("real_comp_names", + [](PinnedMemoryParticleContainer& pc) + { + return pc.getParticleComps(); + } + ) + .def_property_readonly("int_comp_names", + [](PinnedMemoryParticleContainer& pc) + { + return particle_comps = pc.getParticleiComps(); + } + ) From 2e9d23315230c18f1861ff8be0900f431fa6e24c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 13 Feb 2024 20:08:19 +0000 Subject: [PATCH 02/41] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- Docs/source/usage/parameters.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docs/source/usage/parameters.rst b/Docs/source/usage/parameters.rst index 67974d300e0..ea670173a1d 100644 --- a/Docs/source/usage/parameters.rst +++ b/Docs/source/usage/parameters.rst @@ -2754,7 +2754,7 @@ This can be important if a large number of particles are lost, avoiding filling In addition to their usual attributes, the saved particles have an integer attribute ``step_scraped``, which indicates the PIC iteration at which each particle was absorbed at the boundary, -and a real attribute ``time_scraped``, which indicates the exact time calculated when each +and a real attribute ``time_scraped``, which indicates the exact time calculated when each particle hits the EB. ``BoundaryScrapingDiagnostics`` can be used with ``..random_fraction``, ``..uniform_stride``, and ``..plot_filter_function``, which have the same behavior as for ``FullDiagnostics``. For ``BoundaryScrapingDiagnostics``, these filters are applied at the time the data is written to file. An implication of this is that more particles may initially be accumulated in memory than are ultimately written. ``t`` in ``plot_filter_function`` refers to the time the diagnostic is written rather than the time the particle crossed the boundary. From 2d818e32e6b065fd4702baccee989ef4ead6c42e Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Tue, 13 Feb 2024 12:46:00 -0800 Subject: [PATCH 03/41] Update particle_containers.py --- Python/pywarpx/particle_containers.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Python/pywarpx/particle_containers.py b/Python/pywarpx/particle_containers.py index 581f645180f..0b6e962d6d0 100644 --- a/Python/pywarpx/particle_containers.py +++ b/Python/pywarpx/particle_containers.py @@ -785,10 +785,7 @@ def get_particle_boundary_buffer(self, species_name, boundary, comp_name, level) species_name, self._get_boundary_number(boundary) ) comp = part_container.comp_names - data_array = [] - for ii in comp: - data_array.append(comp) - return data_array + return comp def clear_buffer(self): From 1f76a5ea99f29569e393737da975828770bf784e Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Tue, 13 Feb 2024 12:54:57 -0800 Subject: [PATCH 04/41] Update ParticleBoundaryBuffer.cpp --- Source/Particles/ParticleBoundaryBuffer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Particles/ParticleBoundaryBuffer.cpp b/Source/Particles/ParticleBoundaryBuffer.cpp index 4a49df429c6..5e9c1d88af5 100644 --- a/Source/Particles/ParticleBoundaryBuffer.cpp +++ b/Source/Particles/ParticleBoundaryBuffer.cpp @@ -44,7 +44,7 @@ struct IsOutsideDomainBoundary { } }; -struct FindBoundaryIntersection { +struct FindEmbeddedBoundaryIntersection { const int m_index; const int m_step; const amrex::Real m_dt; @@ -92,7 +92,7 @@ struct FindBoundaryIntersection { [=] (amrex::Real dt_frac) { int i, j, k; amrex::Real W[AMREX_SPACEDIM][2]; - amrex::Real x_temp=xp, y_temp=yp, z_temp=zp; + amrex::ParticleReal x_temp=xp, y_temp=yp, z_temp=zp; UpdatePosition(x_temp, y_temp, z_temp, ux, uy, uz, -dt_frac*dt); ablastr::particles::compute_weights_nodal(x_temp, y_temp, z_temp, plo, dxi, i, j, k, W); amrex::Real phi_value = ablastr::particles::interp_field_nodal(i, j, k, W, phiarr); @@ -105,7 +105,7 @@ struct FindBoundaryIntersection { // Now that dt_fraction has be obtained (with bisect) // Save the corresponding position of the particle at the boundary - amrex::Real x_temp=xp, y_temp=yp, z_temp=zp; + amrex::ParticleReal x_temp=xp, y_temp=yp, z_temp=zp; UpdatePosition(x_temp, y_temp, z_temp, ux, uy, uz, -dt_fraction*m_dt); #if (defined WARPX_DIM_3D) @@ -459,7 +459,7 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, { WARPX_PROFILE("ParticleBoundaryBuffer::gatherParticles::filterTransformEB"); amrex::filterAndTransformParticles(ptile_buffer, ptile, predicate, - FindBoundaryIntersection{step_scraped_index, timestep, dt, phiarr, dxi, plo}, 0, dst_index); + FindEmbeddedBoundaryIntersection{step_scraped_index, timestep, dt, phiarr, dxi, plo}, 0, dst_index); } } } From cf6c5f302f1ec5ed151888969ea520dd4d49fbde Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Tue, 13 Feb 2024 12:55:51 -0800 Subject: [PATCH 05/41] Update PICMI_inputs_rz.py --- .../spacecraft_charging/PICMI_inputs_rz.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Examples/Physics_applications/spacecraft_charging/PICMI_inputs_rz.py b/Examples/Physics_applications/spacecraft_charging/PICMI_inputs_rz.py index 23f63f19e3a..6840877891a 100644 --- a/Examples/Physics_applications/spacecraft_charging/PICMI_inputs_rz.py +++ b/Examples/Physics_applications/spacecraft_charging/PICMI_inputs_rz.py @@ -257,8 +257,8 @@ def compute_actual_charge_on_spacecraft(): period = diagnostic_interval, species = [electrons, protons], warpx_format = 'openpmd', - #write_dir = '.', - #warpx_file_prefix = 'spacecraft_charging_plt' + write_dir = '.', + warpx_file_prefix = 'spacecraft_charging_plt' ) ########################## From 1e67dc1ed000f9f8084c61f07521738dfb59e6ef Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Tue, 13 Feb 2024 12:56:27 -0800 Subject: [PATCH 06/41] Update PICMI_inputs_rz.py --- .../spacecraft_charging/PICMI_inputs_rz.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Examples/Physics_applications/spacecraft_charging/PICMI_inputs_rz.py b/Examples/Physics_applications/spacecraft_charging/PICMI_inputs_rz.py index 6840877891a..08ebe23f828 100644 --- a/Examples/Physics_applications/spacecraft_charging/PICMI_inputs_rz.py +++ b/Examples/Physics_applications/spacecraft_charging/PICMI_inputs_rz.py @@ -249,8 +249,8 @@ def compute_actual_charge_on_spacecraft(): data_list = ['Er', 'Ez', 'phi', 'rho', 'rho_electrons', 'rho_protons'], warpx_format = 'openpmd', - #write_dir = '.', - #warpx_file_prefix = 'spacecraft_charging_plt' + write_dir = '.', + warpx_file_prefix = 'spacecraft_charging_plt' ) part_diag = picmi.ParticleDiagnostic(name = 'diag1', From 83cfee86403d9429c1640dc305a814e9d39e3050 Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Tue, 13 Feb 2024 13:01:54 -0800 Subject: [PATCH 07/41] Update particle_containers.py --- Python/pywarpx/particle_containers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Python/pywarpx/particle_containers.py b/Python/pywarpx/particle_containers.py index 0b6e962d6d0..cb638cdf1e3 100644 --- a/Python/pywarpx/particle_containers.py +++ b/Python/pywarpx/particle_containers.py @@ -223,7 +223,7 @@ def get_particle_real_arrays(self, comp_name, level, copy_to_host=False): data_array = [] for pti in libwarpx.libwarpx_so.WarpXParIter(self.particle_container, level): soa = pti.soa() - idx = soa.GetRealData(comp_idx) + idx = soa.get_real_data(comp_idx) if copy_to_host: data_array.append(idx.to_numpy(copy=True)) else: @@ -269,7 +269,7 @@ def get_particle_int_arrays(self, comp_name, level, copy_to_host=False): data_array = [] for pti in libwarpx.libwarpx_so.WarpXParIter(self.particle_container, level): soa = pti.soa() - idx = soa.GetIntData(comp_idx) + idx = soa.get_int_data(comp_idx) if copy_to_host: data_array.append(idx.to_numpy(copy=True)) else: @@ -309,7 +309,7 @@ def get_particle_idcpu_arrays(self, level, copy_to_host=False): data_array = [] for pti in libwarpx.libwarpx_so.WarpXParIter(self.particle_container, level): soa = pti.soa() - idx = soa.GetIdCPUData() + idx = soa.get_idcpu_data() if copy_to_host: data_array.append(idx.to_numpy(copy=True)) else: From 0de37e3e1b85cc3d6305de43bcebe3c92c7106ed Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Tue, 13 Feb 2024 13:03:11 -0800 Subject: [PATCH 08/41] Update ParticleBoundaryBuffer.cpp --- Source/Particles/ParticleBoundaryBuffer.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Source/Particles/ParticleBoundaryBuffer.cpp b/Source/Particles/ParticleBoundaryBuffer.cpp index 5e9c1d88af5..290ff85f31f 100644 --- a/Source/Particles/ParticleBoundaryBuffer.cpp +++ b/Source/Particles/ParticleBoundaryBuffer.cpp @@ -80,8 +80,6 @@ struct FindEmbeddedBoundaryIntersection { amrex::ParticleReal const uy = dst.m_rdata[PIdx::uy][dst_i]; amrex::ParticleReal const uz = dst.m_rdata[PIdx::uz][dst_i]; - // Bisection algorithm to find the point where phi(x,y,z)=0 (i.e. on the embedded boundary) - // Temporary variables to avoid implicit capture amrex::Real dt = m_dt; amrex::Array4 phiarr = m_phiarr; From 43130f96a59c61ee1721ec1b2e5a6fce41ec8afa Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Tue, 13 Feb 2024 13:04:35 -0800 Subject: [PATCH 09/41] Update ParticleBoundaryBuffer.cpp --- Source/Particles/ParticleBoundaryBuffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Particles/ParticleBoundaryBuffer.cpp b/Source/Particles/ParticleBoundaryBuffer.cpp index 290ff85f31f..4f3fe899c70 100644 --- a/Source/Particles/ParticleBoundaryBuffer.cpp +++ b/Source/Particles/ParticleBoundaryBuffer.cpp @@ -378,7 +378,7 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, amrex::filterAndTransformParticles(ptile_buffer, ptile, predicate, - CopyAndTimestamp{step_scraped_index, timestep, dt}, + CopyAndTimestamp{timestamp_index, timestep, dt}, 0, dst_index); } } From ae0d279482a845a8004900860d7bbe5dbcf5d4da Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Tue, 13 Feb 2024 13:06:26 -0800 Subject: [PATCH 10/41] Update ParticleBoundaryBuffer.cpp --- Source/Particles/ParticleBoundaryBuffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Particles/ParticleBoundaryBuffer.cpp b/Source/Particles/ParticleBoundaryBuffer.cpp index 4f3fe899c70..290ff85f31f 100644 --- a/Source/Particles/ParticleBoundaryBuffer.cpp +++ b/Source/Particles/ParticleBoundaryBuffer.cpp @@ -378,7 +378,7 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, amrex::filterAndTransformParticles(ptile_buffer, ptile, predicate, - CopyAndTimestamp{timestamp_index, timestep, dt}, + CopyAndTimestamp{step_scraped_index, timestep, dt}, 0, dst_index); } } From bd52df663247a8ef5d22b349e20b1451567bb951 Mon Sep 17 00:00:00 2001 From: eyadammak Date: Tue, 13 Feb 2024 14:02:29 -0800 Subject: [PATCH 11/41] fix issue --- Source/Python/Particles/PinnedMemoryParticleContainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Python/Particles/PinnedMemoryParticleContainer.cpp b/Source/Python/Particles/PinnedMemoryParticleContainer.cpp index ad0cafade9e..3b4bbd9e8dd 100644 --- a/Source/Python/Particles/PinnedMemoryParticleContainer.cpp +++ b/Source/Python/Particles/PinnedMemoryParticleContainer.cpp @@ -25,6 +25,6 @@ void init_PinnedMemoryParticleContainer (py::module& m) .def_property_readonly("int_comp_names", [](PinnedMemoryParticleContainer& pc) { - return particle_comps = pc.getParticleiComps(); + return pc.getParticleiComps(); } ) From 29ab2140914ab46129131f03ef4eb8174a4bad96 Mon Sep 17 00:00:00 2001 From: eyadammak Date: Tue, 13 Feb 2024 14:12:04 -0800 Subject: [PATCH 12/41] fix issue --- Source/Python/Particles/PinnedMemoryParticleContainer.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/Python/Particles/PinnedMemoryParticleContainer.cpp b/Source/Python/Particles/PinnedMemoryParticleContainer.cpp index 3b4bbd9e8dd..c130d0e4ae9 100644 --- a/Source/Python/Particles/PinnedMemoryParticleContainer.cpp +++ b/Source/Python/Particles/PinnedMemoryParticleContainer.cpp @@ -21,10 +21,11 @@ void init_PinnedMemoryParticleContainer (py::module& m) { return pc.getParticleComps(); } - ) + ); .def_property_readonly("int_comp_names", [](PinnedMemoryParticleContainer& pc) { return pc.getParticleiComps(); } - ) + ); +} From 67b66767b81858c806b696e0763f4b85953c94cd Mon Sep 17 00:00:00 2001 From: eyadammak Date: Tue, 13 Feb 2024 14:17:35 -0800 Subject: [PATCH 13/41] issue fixed --- Source/Python/Particles/PinnedMemoryParticleContainer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Python/Particles/PinnedMemoryParticleContainer.cpp b/Source/Python/Particles/PinnedMemoryParticleContainer.cpp index c130d0e4ae9..ed40bac9be5 100644 --- a/Source/Python/Particles/PinnedMemoryParticleContainer.cpp +++ b/Source/Python/Particles/PinnedMemoryParticleContainer.cpp @@ -21,7 +21,7 @@ void init_PinnedMemoryParticleContainer (py::module& m) { return pc.getParticleComps(); } - ); + ) .def_property_readonly("int_comp_names", [](PinnedMemoryParticleContainer& pc) { @@ -29,3 +29,4 @@ void init_PinnedMemoryParticleContainer (py::module& m) } ); } + From c4a98f0a037faf94b589f93d39e7fb105bb88543 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 13 Feb 2024 22:18:51 +0000 Subject: [PATCH 14/41] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- Source/Python/Particles/PinnedMemoryParticleContainer.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/Python/Particles/PinnedMemoryParticleContainer.cpp b/Source/Python/Particles/PinnedMemoryParticleContainer.cpp index ed40bac9be5..21dd6a9d364 100644 --- a/Source/Python/Particles/PinnedMemoryParticleContainer.cpp +++ b/Source/Python/Particles/PinnedMemoryParticleContainer.cpp @@ -29,4 +29,3 @@ void init_PinnedMemoryParticleContainer (py::module& m) } ); } - From 3903344c1db0db7f75faa3d8d5eb7888ec9d7030 Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Tue, 13 Feb 2024 14:55:13 -0800 Subject: [PATCH 15/41] Update ParticleBoundaryBuffer.cpp --- Source/Particles/ParticleBoundaryBuffer.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/Particles/ParticleBoundaryBuffer.cpp b/Source/Particles/ParticleBoundaryBuffer.cpp index 290ff85f31f..aaf3bc438b8 100644 --- a/Source/Particles/ParticleBoundaryBuffer.cpp +++ b/Source/Particles/ParticleBoundaryBuffer.cpp @@ -62,7 +62,7 @@ struct FindEmbeddedBoundaryIntersection { for (int j = 0; j < SrcData::NAR; ++j) { dst.m_rdata[j][dst_i] = src.m_rdata[j][src_i]; } - for (int j = 0; j < src.m_num_runtime_real; ++j) { + for (int j = 0; j < src.m_num_run_real; ++j) { dst.m_runtime_rdata[j][dst_i] = src.m_runtime_rdata[j][src_i]; } for (int j = 0; j < src.m_num_runtime_int; ++j) { @@ -398,7 +398,8 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, if (!buffer[i].isDefined()) { buffer[i] = pc.make_alike(); - buffer[i].AddRealComp("step_scraped", false); + buffer[i].IntComp("step_scraped", false); + buffer[i].RealComp("time_scraped", false); } auto& species_buffer = buffer[i]; for (int lev = 0; lev < pc.numLevels(); ++lev) @@ -451,13 +452,13 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, } auto& warpx = WarpX::GetInstance(); const auto dt = warpx.getdt(pti.GetLevel()); - const int step_scraped_index = ptile_buffer.NumRuntimeRealComps()-1; - const int timestep = warpx_instance.getistep(0); + const int step_scraped_index = ptile_buffer.NumRunRealComps()-1; + const int step = warpx_instance.getistep(0); { WARPX_PROFILE("ParticleBoundaryBuffer::gatherParticles::filterTransformEB"); amrex::filterAndTransformParticles(ptile_buffer, ptile, predicate, - FindEmbeddedBoundaryIntersection{step_scraped_index, timestep, dt, phiarr, dxi, plo}, 0, dst_index); + FindEmbeddedBoundaryIntersection{step_scraped_index, step, dt, phiarr, dxi, plo}, 0, dst_index); } } } From 649d42be797a39bdaa8a2c7803af11c79d85bbf6 Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Tue, 13 Feb 2024 14:57:05 -0800 Subject: [PATCH 16/41] Update ParticleBoundaryBuffer.cpp --- Source/Particles/ParticleBoundaryBuffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Particles/ParticleBoundaryBuffer.cpp b/Source/Particles/ParticleBoundaryBuffer.cpp index aaf3bc438b8..d6075962326 100644 --- a/Source/Particles/ParticleBoundaryBuffer.cpp +++ b/Source/Particles/ParticleBoundaryBuffer.cpp @@ -62,7 +62,7 @@ struct FindEmbeddedBoundaryIntersection { for (int j = 0; j < SrcData::NAR; ++j) { dst.m_rdata[j][dst_i] = src.m_rdata[j][src_i]; } - for (int j = 0; j < src.m_num_run_real; ++j) { + for (int j = 0; j < src.m_num_runtime_real; ++j) { dst.m_runtime_rdata[j][dst_i] = src.m_runtime_rdata[j][src_i]; } for (int j = 0; j < src.m_num_runtime_int; ++j) { From ccd5f9bd3d989100385820455e5310a59a438922 Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Tue, 13 Feb 2024 14:58:15 -0800 Subject: [PATCH 17/41] Update ParticleBoundaryBuffer.cpp --- Source/Particles/ParticleBoundaryBuffer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Particles/ParticleBoundaryBuffer.cpp b/Source/Particles/ParticleBoundaryBuffer.cpp index d6075962326..715d3ae0506 100644 --- a/Source/Particles/ParticleBoundaryBuffer.cpp +++ b/Source/Particles/ParticleBoundaryBuffer.cpp @@ -85,7 +85,8 @@ struct FindEmbeddedBoundaryIntersection { amrex::Array4 phiarr = m_phiarr; amrex::GpuArray dxi = m_dxi; amrex::GpuArray plo = m_plo; - + + // Bisection algorithm to find the point where phi(x,y,z)=0 (i.e. on the embedded boundary) amrex::Real dt_fraction = amrex::bisect( 0.0, 1.0, [=] (amrex::Real dt_frac) { int i, j, k; From 9688d4295ddd3d53cc1960ccbab84f6039aeb88b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 13 Feb 2024 23:00:42 +0000 Subject: [PATCH 18/41] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- Source/Particles/ParticleBoundaryBuffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Particles/ParticleBoundaryBuffer.cpp b/Source/Particles/ParticleBoundaryBuffer.cpp index 715d3ae0506..555ebc9114a 100644 --- a/Source/Particles/ParticleBoundaryBuffer.cpp +++ b/Source/Particles/ParticleBoundaryBuffer.cpp @@ -85,7 +85,7 @@ struct FindEmbeddedBoundaryIntersection { amrex::Array4 phiarr = m_phiarr; amrex::GpuArray dxi = m_dxi; amrex::GpuArray plo = m_plo; - + // Bisection algorithm to find the point where phi(x,y,z)=0 (i.e. on the embedded boundary) amrex::Real dt_fraction = amrex::bisect( 0.0, 1.0, [=] (amrex::Real dt_frac) { From 0261afb8864702481bb33d03f546486b5eef36f9 Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Tue, 13 Feb 2024 15:25:56 -0800 Subject: [PATCH 19/41] Update ParticleBoundaryBuffer.cpp --- Source/Particles/ParticleBoundaryBuffer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Particles/ParticleBoundaryBuffer.cpp b/Source/Particles/ParticleBoundaryBuffer.cpp index 555ebc9114a..4e39c2371c8 100644 --- a/Source/Particles/ParticleBoundaryBuffer.cpp +++ b/Source/Particles/ParticleBoundaryBuffer.cpp @@ -399,8 +399,8 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, if (!buffer[i].isDefined()) { buffer[i] = pc.make_alike(); - buffer[i].IntComp("step_scraped", false); - buffer[i].RealComp("time_scraped", false); + buffer[i].AddIntComp("step_scraped", false); + buffer[i].AddRealComp("time_scraped", false); } auto& species_buffer = buffer[i]; for (int lev = 0; lev < pc.numLevels(); ++lev) From 149cce89ec1a21902be65edde36c1e24340b6a9c Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Tue, 13 Feb 2024 15:32:25 -0800 Subject: [PATCH 20/41] Update ParticleBoundaryBuffer.cpp --- Source/Particles/ParticleBoundaryBuffer.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/Particles/ParticleBoundaryBuffer.cpp b/Source/Particles/ParticleBoundaryBuffer.cpp index 4e39c2371c8..0f4410b448a 100644 --- a/Source/Particles/ParticleBoundaryBuffer.cpp +++ b/Source/Particles/ParticleBoundaryBuffer.cpp @@ -142,10 +142,10 @@ struct CopyAndTimestamp { for (int j = 0; j < SrcData::NAR; ++j) { dst.m_rdata[j][dst_i] = src.m_rdata[j][src_i]; } - for (int j = 0; j < src.m_num_runtime_real; ++j) { + for (int j = 0; j < src.m__runtime_real; ++j) { dst.m_runtime_rdata[j][dst_i] = src.m_runtime_rdata[j][src_i]; } - for (int j = 0; j < src.m_num_runtime_int; ++j) { + for (int j = 0; j < src.m__runtime_int; ++j) { dst.m_runtime_idata[j][dst_i] = src.m_runtime_idata[j][src_i]; } dst.m_runtime_idata[m_index][dst_i] = m_step; @@ -156,14 +156,14 @@ struct CopyAndTimestamp { ParticleBoundaryBuffer::ParticleBoundaryBuffer () { - m_particle_containers.resize(numBoundaries()); - m_do_boundary_buffer.resize(numBoundaries()); - m_do_any_boundary.resize(numBoundaries(), 0); - m_boundary_names.resize(numBoundaries()); + m_particle_containers.resize(Boundaries()); + m_do_boundary_buffer.resize(Boundaries()); + m_do_any_boundary.resize(Boundaries(), 0); + m_boundary_names.resize(Boundaries()); - for (int i = 0; i < numBoundaries(); ++i) + for (int i = 0; i < Boundaries(); ++i) { - m_particle_containers[i].resize(numSpecies()); + m_particle_containers[i].resize(Species()); m_do_boundary_buffer[i].resize(numSpecies(), 0); } @@ -374,7 +374,7 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, WARPX_PROFILE("ParticleBoundaryBuffer::gatherParticles::filterAndTransform"); auto& warpx = WarpX::GetInstance(); const auto dt = warpx.getdt(pti.GetLevel()); - const int step_scraped_index = ptile_buffer.NumRuntimeRealComps()-1; + const int step_scraped_index = ptile_buffer.NumRealComps()-1; const int timestep = warpx_instance.getistep(0); amrex::filterAndTransformParticles(ptile_buffer, ptile, @@ -453,7 +453,7 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, } auto& warpx = WarpX::GetInstance(); const auto dt = warpx.getdt(pti.GetLevel()); - const int step_scraped_index = ptile_buffer.NumRunRealComps()-1; + const int step_scraped_index = ptile_buffer.NumRealComps()-1; const int step = warpx_instance.getistep(0); { From 0d1b5e97febb4d1f16c3febdb8db06e94ee92b0c Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Tue, 13 Feb 2024 15:41:21 -0800 Subject: [PATCH 21/41] Update ParticleBoundaryBuffer.cpp --- Source/Particles/ParticleBoundaryBuffer.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/Particles/ParticleBoundaryBuffer.cpp b/Source/Particles/ParticleBoundaryBuffer.cpp index 0f4410b448a..d3ac6cfb7b4 100644 --- a/Source/Particles/ParticleBoundaryBuffer.cpp +++ b/Source/Particles/ParticleBoundaryBuffer.cpp @@ -142,10 +142,10 @@ struct CopyAndTimestamp { for (int j = 0; j < SrcData::NAR; ++j) { dst.m_rdata[j][dst_i] = src.m_rdata[j][src_i]; } - for (int j = 0; j < src.m__runtime_real; ++j) { + for (int j = 0; j < src.m_num_runtime_real; ++j) { dst.m_runtime_rdata[j][dst_i] = src.m_runtime_rdata[j][src_i]; } - for (int j = 0; j < src.m__runtime_int; ++j) { + for (int j = 0; j < src.m_num_runtime_int; ++j) { dst.m_runtime_idata[j][dst_i] = src.m_runtime_idata[j][src_i]; } dst.m_runtime_idata[m_index][dst_i] = m_step; @@ -156,14 +156,14 @@ struct CopyAndTimestamp { ParticleBoundaryBuffer::ParticleBoundaryBuffer () { - m_particle_containers.resize(Boundaries()); - m_do_boundary_buffer.resize(Boundaries()); - m_do_any_boundary.resize(Boundaries(), 0); - m_boundary_names.resize(Boundaries()); + m_particle_containers.resize(numBoundaries()); + m_do_boundary_buffer.resize(numBoundaries()); + m_do_any_boundary.resize(numBoundaries(), 0); + m_boundary_names.resize(numBoundaries()); - for (int i = 0; i < Boundaries(); ++i) + for (int i = 0; i < numBoundaries(); ++i) { - m_particle_containers[i].resize(Species()); + m_particle_containers[i].resize(numSpecies()); m_do_boundary_buffer[i].resize(numSpecies(), 0); } From 3baacd9bdd656cf021e86a12b7ea5b45e6949d78 Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Tue, 13 Feb 2024 15:59:48 -0800 Subject: [PATCH 22/41] Update ParticleBoundaryBuffer.cpp --- Source/Particles/ParticleBoundaryBuffer.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Source/Particles/ParticleBoundaryBuffer.cpp b/Source/Particles/ParticleBoundaryBuffer.cpp index d3ac6cfb7b4..499afc3bc3b 100644 --- a/Source/Particles/ParticleBoundaryBuffer.cpp +++ b/Source/Particles/ParticleBoundaryBuffer.cpp @@ -131,7 +131,6 @@ struct FindEmbeddedBoundaryIntersection { struct CopyAndTimestamp { int m_index; int m_step; - amrex::Real m_dt; template AMREX_GPU_HOST_DEVICE @@ -149,7 +148,6 @@ struct CopyAndTimestamp { dst.m_runtime_idata[j][dst_i] = src.m_runtime_idata[j][src_i]; } dst.m_runtime_idata[m_index][dst_i] = m_step; - dst.m_runtime_rdata[m_index][dst_i] = m_step*m_dt; } }; @@ -331,7 +329,6 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, if (!buffer[i].isDefined()) { buffer[i] = pc.make_alike(); - buffer[i].AddRealComp("time_scraped", false); buffer[i].AddIntComp("step_scraped", false); } auto& species_buffer = buffer[i]; @@ -372,14 +369,12 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, } { WARPX_PROFILE("ParticleBoundaryBuffer::gatherParticles::filterAndTransform"); - auto& warpx = WarpX::GetInstance(); - const auto dt = warpx.getdt(pti.GetLevel()); const int step_scraped_index = ptile_buffer.NumRealComps()-1; const int timestep = warpx_instance.getistep(0); amrex::filterAndTransformParticles(ptile_buffer, ptile, predicate, - CopyAndTimestamp{step_scraped_index, timestep, dt}, + CopyAndTimestamp{step_scraped_index, timestep}, 0, dst_index); } } From 95657bd6d02b6bd46d4d71c38135613c09a31ea0 Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Tue, 13 Feb 2024 16:02:42 -0800 Subject: [PATCH 23/41] Update ParticleBoundaryBuffer.cpp --- Source/Particles/ParticleBoundaryBuffer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Particles/ParticleBoundaryBuffer.cpp b/Source/Particles/ParticleBoundaryBuffer.cpp index 499afc3bc3b..b1f7101158f 100644 --- a/Source/Particles/ParticleBoundaryBuffer.cpp +++ b/Source/Particles/ParticleBoundaryBuffer.cpp @@ -369,7 +369,7 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, } { WARPX_PROFILE("ParticleBoundaryBuffer::gatherParticles::filterAndTransform"); - const int step_scraped_index = ptile_buffer.NumRealComps()-1; + const int step_scraped_index = ptile_buffer.NumRuntimeIntComps()-1; const int timestep = warpx_instance.getistep(0); amrex::filterAndTransformParticles(ptile_buffer, ptile, @@ -448,7 +448,7 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, } auto& warpx = WarpX::GetInstance(); const auto dt = warpx.getdt(pti.GetLevel()); - const int step_scraped_index = ptile_buffer.NumRealComps()-1; + const int step_scraped_index = ptile_buffer.NumRuntimeIntComps()-1; const int step = warpx_instance.getistep(0); { From 2677c8ad4e8c0ae508d10f7a2beae8dc88cef2c7 Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Tue, 13 Feb 2024 16:14:28 -0800 Subject: [PATCH 24/41] Update analysis_rz.py --- Examples/Tests/scraping/analysis_rz.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Examples/Tests/scraping/analysis_rz.py b/Examples/Tests/scraping/analysis_rz.py index 3e060cb9d23..7d40bd5edf4 100755 --- a/Examples/Tests/scraping/analysis_rz.py +++ b/Examples/Tests/scraping/analysis_rz.py @@ -53,7 +53,7 @@ def n_remaining_particles( iteration ): w, = ts_full.get_particle(['w'], iteration=iteration) return len(w) def n_scraped_particles( iteration ): - step_scraped = ts_scraping.get_particle( ['step_scraped'], iteration=ts_scraping.iterations[0] ) + step_scraped = ts_scraping.get_particle( ['stepScraped'], iteration=ts_scraping.iterations[0] ) return (step_scraped <= iteration).sum() n_remaining = np.array([ n_remaining_particles(iteration) for iteration in ts_full.iterations ]) n_scraped = np.array([ n_scraped_particles(iteration) for iteration in ts_full.iterations ]) From 629f8138bde3c7cdbe258a7cea3226b1725c2860 Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Tue, 13 Feb 2024 16:14:52 -0800 Subject: [PATCH 25/41] Update analysis_rz_filter.py --- Examples/Tests/scraping/analysis_rz_filter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Examples/Tests/scraping/analysis_rz_filter.py b/Examples/Tests/scraping/analysis_rz_filter.py index 920825ad421..dd13b993dc5 100755 --- a/Examples/Tests/scraping/analysis_rz_filter.py +++ b/Examples/Tests/scraping/analysis_rz_filter.py @@ -50,7 +50,7 @@ def n_remaining_particles( iteration ): w, = ts_full.get_particle(['w'], iteration=iteration) return len(w) def n_scraped_particles( iteration ): - step_scraped = ts_scraping.get_particle( ['step_scraped'], iteration=ts_scraping.iterations[0] ) + step_scraped = ts_scraping.get_particle( ['stepScraped'], iteration=ts_scraping.iterations[0] ) return (step_scraped <= iteration).sum() def n_scraped_z_leq_zero( iteration ): z_pos, = ts_scraping.get_particle( ['z'], iteration=ts_scraping.iterations[0] ) From b056c0262144956f57972bfcf3c3e4eed5549a42 Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Tue, 13 Feb 2024 16:15:44 -0800 Subject: [PATCH 26/41] Update analysis.py --- Examples/Tests/point_of_contact_EB/analysis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Examples/Tests/point_of_contact_EB/analysis.py b/Examples/Tests/point_of_contact_EB/analysis.py index 0bde2f59f49..743cbc2fb39 100755 --- a/Examples/Tests/point_of_contact_EB/analysis.py +++ b/Examples/Tests/point_of_contact_EB/analysis.py @@ -26,7 +26,7 @@ ts_scraping = OpenPMDTimeSeries('./diags/diag2/particles_at_eb/') it=ts_scraping.iterations -step_scraped, time_scraped, x, y, z=ts_scraping.get_particle( ['step_scraped','time_scraped','x','y','z'], species='electron', iteration=it ) +step_scraped, time_scraped, x, y, z=ts_scraping.get_particle( ['stepScraped','timeScraped','x','y','z'], species='electron', iteration=it ) time_scraped_reduced=time_scraped[0]*1e10 # Analytical results calculated From 341d44bde9ac69e1d2e09092b94e59b4ab534a24 Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Tue, 13 Feb 2024 16:57:53 -0800 Subject: [PATCH 27/41] Update PICMI_inputs_scrape.py --- Examples/Tests/particle_boundary_scrape/PICMI_inputs_scrape.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Examples/Tests/particle_boundary_scrape/PICMI_inputs_scrape.py b/Examples/Tests/particle_boundary_scrape/PICMI_inputs_scrape.py index 9871bdac655..e5a9a58f597 100755 --- a/Examples/Tests/particle_boundary_scrape/PICMI_inputs_scrape.py +++ b/Examples/Tests/particle_boundary_scrape/PICMI_inputs_scrape.py @@ -133,7 +133,7 @@ print(f"Number of electrons in buffer (proc #{my_id}): {n}") assert n == 612 -scraped_steps = particle_buffer.get_particle_boundary_buffer("electrons", 'eb', 'step_scraped', 0) +scraped_steps = particle_buffer.get_particle_boundary_buffer("electrons", 'eb', 'stepScraped', 0) for arr in scraped_steps: assert all(np.array(arr, copy=False) > 40) From 00e8b646ccbcf53dc85f9f45bcbc632eb11f8fd5 Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Wed, 14 Feb 2024 10:06:16 -0800 Subject: [PATCH 28/41] Update PICMI_inputs_reflection.py --- .../particle_boundary_process/PICMI_inputs_reflection.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Examples/Tests/particle_boundary_process/PICMI_inputs_reflection.py b/Examples/Tests/particle_boundary_process/PICMI_inputs_reflection.py index 9ac40818e12..bb1ebd73082 100755 --- a/Examples/Tests/particle_boundary_process/PICMI_inputs_reflection.py +++ b/Examples/Tests/particle_boundary_process/PICMI_inputs_reflection.py @@ -131,12 +131,12 @@ print("Number of electrons in lower buffer:", n) assert n == 67 -scraped_steps = buffer.get_particle_boundary_buffer("electrons", 'z_hi', 'step_scraped', 0) +scraped_steps = buffer.get_particle_boundary_buffer("electrons", 'z_hi', 'stepScraped', 0) for arr in scraped_steps: # print(arr) assert all(arr == 4) -scraped_steps = buffer.get_particle_boundary_buffer("electrons", 'z_lo', 'step_scraped', 0) +scraped_steps = buffer.get_particle_boundary_buffer("electrons", 'z_lo', 'stepScraped', 0) for arr in scraped_steps: # print(arr) assert all(arr == 8) From 1eee44859bd7492c4704d3f071b6105b0ab71c1e Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Thu, 15 Feb 2024 11:13:02 -0800 Subject: [PATCH 29/41] Update particle_containers.py --- Python/pywarpx/particle_containers.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Python/pywarpx/particle_containers.py b/Python/pywarpx/particle_containers.py index cb638cdf1e3..43eefa0337d 100644 --- a/Python/pywarpx/particle_containers.py +++ b/Python/pywarpx/particle_containers.py @@ -784,8 +784,22 @@ def get_particle_boundary_buffer(self, species_name, boundary, comp_name, level) part_container = self.particle_buffer.get_particle_container( species_name, self._get_boundary_number(boundary) ) - comp = part_container.comp_names - return comp + data_array = [] + #loop over the real attributes + if comp_name in part_container.real_comp_names: + comp_idx = part_container.real_comp_names[comp_name] + for ii, pti in enumerate(libwarpx.libwarpx_so.BoundaryBufferParIter(part_container, level)): + soa = pti.soa() + data_array.append(xp.array(soa.get_real_data(comp_idx), copy=False)) + #loop over the integer attributes + elif comp_name in part_container.int_comp_names: + comp_idx = part_container.int_comp_names[comp_name] + for ii, pti in enumerate(libwarpx.libwarpx_so.BoundaryBufferParIter(part_container, level)): + soa = pti.soa() + data_array.append(xp.array(soa.get_int_data(comp_idx), copy=False)) + else: + raise RuntimeError('Name %s not found' %comp_name) + return data_array def clear_buffer(self): From b68b88073f04f71c47e98edbbef2d5bf5b1e39ee Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Thu, 15 Feb 2024 11:14:04 -0800 Subject: [PATCH 30/41] Update PICMI_inputs_reflection.py --- .../particle_boundary_process/PICMI_inputs_reflection.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Examples/Tests/particle_boundary_process/PICMI_inputs_reflection.py b/Examples/Tests/particle_boundary_process/PICMI_inputs_reflection.py index bb1ebd73082..9ac40818e12 100755 --- a/Examples/Tests/particle_boundary_process/PICMI_inputs_reflection.py +++ b/Examples/Tests/particle_boundary_process/PICMI_inputs_reflection.py @@ -131,12 +131,12 @@ print("Number of electrons in lower buffer:", n) assert n == 67 -scraped_steps = buffer.get_particle_boundary_buffer("electrons", 'z_hi', 'stepScraped', 0) +scraped_steps = buffer.get_particle_boundary_buffer("electrons", 'z_hi', 'step_scraped', 0) for arr in scraped_steps: # print(arr) assert all(arr == 4) -scraped_steps = buffer.get_particle_boundary_buffer("electrons", 'z_lo', 'stepScraped', 0) +scraped_steps = buffer.get_particle_boundary_buffer("electrons", 'z_lo', 'step_scraped', 0) for arr in scraped_steps: # print(arr) assert all(arr == 8) From c9f505d7425736bdc2ade1c27d60887c207ec7c2 Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Thu, 15 Feb 2024 11:14:23 -0800 Subject: [PATCH 31/41] Update PICMI_inputs_scrape.py --- Examples/Tests/particle_boundary_scrape/PICMI_inputs_scrape.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Examples/Tests/particle_boundary_scrape/PICMI_inputs_scrape.py b/Examples/Tests/particle_boundary_scrape/PICMI_inputs_scrape.py index e5a9a58f597..9871bdac655 100755 --- a/Examples/Tests/particle_boundary_scrape/PICMI_inputs_scrape.py +++ b/Examples/Tests/particle_boundary_scrape/PICMI_inputs_scrape.py @@ -133,7 +133,7 @@ print(f"Number of electrons in buffer (proc #{my_id}): {n}") assert n == 612 -scraped_steps = particle_buffer.get_particle_boundary_buffer("electrons", 'eb', 'stepScraped', 0) +scraped_steps = particle_buffer.get_particle_boundary_buffer("electrons", 'eb', 'step_scraped', 0) for arr in scraped_steps: assert all(np.array(arr, copy=False) > 40) From 9fe74cab09ac0ba5b1106d97459282ebebc4361c Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Thu, 15 Feb 2024 13:12:17 -0800 Subject: [PATCH 32/41] Update ParticleBoundaryBuffer.cpp --- Source/Particles/ParticleBoundaryBuffer.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Source/Particles/ParticleBoundaryBuffer.cpp b/Source/Particles/ParticleBoundaryBuffer.cpp index b1f7101158f..356a97f6229 100644 --- a/Source/Particles/ParticleBoundaryBuffer.cpp +++ b/Source/Particles/ParticleBoundaryBuffer.cpp @@ -131,6 +131,7 @@ struct FindEmbeddedBoundaryIntersection { struct CopyAndTimestamp { int m_index; int m_step; + const amrex::Real m_dt; template AMREX_GPU_HOST_DEVICE @@ -148,6 +149,9 @@ struct CopyAndTimestamp { dst.m_runtime_idata[j][dst_i] = src.m_runtime_idata[j][src_i]; } dst.m_runtime_idata[m_index][dst_i] = m_step; + + amrex::Real dt = m_dt; + dst.m_runtime_rdata[m_index][dst_i] = m_step*m_dt; } }; @@ -330,6 +334,7 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, { buffer[i] = pc.make_alike(); buffer[i].AddIntComp("step_scraped", false); + buffer[i].AddRealComp("time_scraped", false); } auto& species_buffer = buffer[i]; for (int lev = 0; lev < pc.numLevels(); ++lev) @@ -369,12 +374,14 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, } { WARPX_PROFILE("ParticleBoundaryBuffer::gatherParticles::filterAndTransform"); + auto& warpx = WarpX::GetInstance(); + const auto dt = warpx.getdt(pti.GetLevel()); const int step_scraped_index = ptile_buffer.NumRuntimeIntComps()-1; const int timestep = warpx_instance.getistep(0); amrex::filterAndTransformParticles(ptile_buffer, ptile, predicate, - CopyAndTimestamp{step_scraped_index, timestep}, + CopyAndTimestamp{step_scraped_index, timestep,dt}, 0, dst_index); } } From f7396f3db20461236cdf54b5855ee330467b0e22 Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Thu, 15 Feb 2024 13:13:03 -0800 Subject: [PATCH 33/41] Update ParticleBoundaryBuffer.cpp --- Source/Particles/ParticleBoundaryBuffer.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Source/Particles/ParticleBoundaryBuffer.cpp b/Source/Particles/ParticleBoundaryBuffer.cpp index 356a97f6229..cf10bb624d7 100644 --- a/Source/Particles/ParticleBoundaryBuffer.cpp +++ b/Source/Particles/ParticleBoundaryBuffer.cpp @@ -149,8 +149,6 @@ struct CopyAndTimestamp { dst.m_runtime_idata[j][dst_i] = src.m_runtime_idata[j][src_i]; } dst.m_runtime_idata[m_index][dst_i] = m_step; - - amrex::Real dt = m_dt; dst.m_runtime_rdata[m_index][dst_i] = m_step*m_dt; } }; From 68cdfed48f6b218cdb85dafe83f3422756bc5ac5 Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 16 Feb 2024 11:22:10 -0800 Subject: [PATCH 34/41] Update ParticleBoundaryBuffer.cpp --- Source/Particles/ParticleBoundaryBuffer.cpp | 30 +++++++++++++-------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/Source/Particles/ParticleBoundaryBuffer.cpp b/Source/Particles/ParticleBoundaryBuffer.cpp index cf10bb624d7..e4f10edbc71 100644 --- a/Source/Particles/ParticleBoundaryBuffer.cpp +++ b/Source/Particles/ParticleBoundaryBuffer.cpp @@ -45,7 +45,8 @@ struct IsOutsideDomainBoundary { }; struct FindEmbeddedBoundaryIntersection { - const int m_index; + const int m_step_index; + const int m_time_index const int m_step; const amrex::Real m_dt; amrex::Array4 m_phiarr; @@ -99,8 +100,8 @@ struct FindEmbeddedBoundaryIntersection { } ); // Also record the real time on the destination - dst.m_runtime_idata[m_index][dst_i] = m_step; - dst.m_runtime_rdata[m_index][dst_i] = m_step*m_dt + (1- dt_fraction)*m_dt; + dst.m_runtime_idata[m_step_index][dst_i] = m_step; + dst.m_runtime_rdata[m_time_index][dst_i] = m_step*m_dt + (1- dt_fraction)*m_dt; // Now that dt_fraction has be obtained (with bisect) // Save the corresponding position of the particle at the boundary @@ -129,7 +130,8 @@ struct FindEmbeddedBoundaryIntersection { }; struct CopyAndTimestamp { - int m_index; + int m_step_index; + int m_time_index; int m_step; const amrex::Real m_dt; @@ -148,8 +150,8 @@ struct CopyAndTimestamp { for (int j = 0; j < src.m_num_runtime_int; ++j) { dst.m_runtime_idata[j][dst_i] = src.m_runtime_idata[j][src_i]; } - dst.m_runtime_idata[m_index][dst_i] = m_step; - dst.m_runtime_rdata[m_index][dst_i] = m_step*m_dt; + dst.m_runtime_idata[m_step_index][dst_i] = m_step; + dst.m_runtime_rdata[m_time_index][dst_i] = m_step*m_dt; } }; @@ -374,12 +376,15 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, WARPX_PROFILE("ParticleBoundaryBuffer::gatherParticles::filterAndTransform"); auto& warpx = WarpX::GetInstance(); const auto dt = warpx.getdt(pti.GetLevel()); - const int step_scraped_index = ptile_buffer.NumRuntimeIntComps()-1; - const int timestep = warpx_instance.getistep(0); + auto string_to_index_intcomp = buffer[i].getParticleiComps(); + int step_scraped_index = string_to_index_intcomp.at('step_scraped'); + auto string_to_index_realcomp = buffer[i].getParticleComps(); + int time_scraped_index = string_to_index_realcomp.at('time_scraped'); + const int step = warpx_instance.getistep(0); amrex::filterAndTransformParticles(ptile_buffer, ptile, predicate, - CopyAndTimestamp{step_scraped_index, timestep,dt}, + CopyAndTimestamp{step_scraped_index,time_scraped_index, step,dt}, 0, dst_index); } } @@ -453,13 +458,16 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, } auto& warpx = WarpX::GetInstance(); const auto dt = warpx.getdt(pti.GetLevel()); - const int step_scraped_index = ptile_buffer.NumRuntimeIntComps()-1; + auto string_to_index_intcomp = buffer[i].getParticleiComps(); + int step_scraped_index = string_to_index_intcomp.at('step_scraped'); + auto string_to_index_realcomp = buffer[i].getParticleComps(); + int time_scraped_index = string_to_index_realcomp.at('time_scraped'); const int step = warpx_instance.getistep(0); { WARPX_PROFILE("ParticleBoundaryBuffer::gatherParticles::filterTransformEB"); amrex::filterAndTransformParticles(ptile_buffer, ptile, predicate, - FindEmbeddedBoundaryIntersection{step_scraped_index, step, dt, phiarr, dxi, plo}, 0, dst_index); + FindEmbeddedBoundaryIntersection{step_scraped_index,time_scraped_index, step, dt, phiarr, dxi, plo}, 0, dst_index); } } } From f2a10f4368c4587965dd3b9bb01167ab9853f0b8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 16 Feb 2024 19:22:21 +0000 Subject: [PATCH 35/41] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- Source/Particles/ParticleBoundaryBuffer.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/Particles/ParticleBoundaryBuffer.cpp b/Source/Particles/ParticleBoundaryBuffer.cpp index e4f10edbc71..eb6fd6aa826 100644 --- a/Source/Particles/ParticleBoundaryBuffer.cpp +++ b/Source/Particles/ParticleBoundaryBuffer.cpp @@ -376,9 +376,9 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, WARPX_PROFILE("ParticleBoundaryBuffer::gatherParticles::filterAndTransform"); auto& warpx = WarpX::GetInstance(); const auto dt = warpx.getdt(pti.GetLevel()); - auto string_to_index_intcomp = buffer[i].getParticleiComps(); - int step_scraped_index = string_to_index_intcomp.at('step_scraped'); - auto string_to_index_realcomp = buffer[i].getParticleComps(); + auto string_to_index_intcomp = buffer[i].getParticleiComps(); + int step_scraped_index = string_to_index_intcomp.at('step_scraped'); + auto string_to_index_realcomp = buffer[i].getParticleComps(); int time_scraped_index = string_to_index_realcomp.at('time_scraped'); const int step = warpx_instance.getistep(0); @@ -458,9 +458,9 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, } auto& warpx = WarpX::GetInstance(); const auto dt = warpx.getdt(pti.GetLevel()); - auto string_to_index_intcomp = buffer[i].getParticleiComps(); - int step_scraped_index = string_to_index_intcomp.at('step_scraped'); - auto string_to_index_realcomp = buffer[i].getParticleComps(); + auto string_to_index_intcomp = buffer[i].getParticleiComps(); + int step_scraped_index = string_to_index_intcomp.at('step_scraped'); + auto string_to_index_realcomp = buffer[i].getParticleComps(); int time_scraped_index = string_to_index_realcomp.at('time_scraped'); const int step = warpx_instance.getistep(0); From 63dfd5df1ffe4fe2d4f2022f664e9ce998afe08a Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 16 Feb 2024 11:24:44 -0800 Subject: [PATCH 36/41] Update ParticleBoundaryBuffer.cpp --- Source/Particles/ParticleBoundaryBuffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Particles/ParticleBoundaryBuffer.cpp b/Source/Particles/ParticleBoundaryBuffer.cpp index eb6fd6aa826..95f5a4ac0b6 100644 --- a/Source/Particles/ParticleBoundaryBuffer.cpp +++ b/Source/Particles/ParticleBoundaryBuffer.cpp @@ -46,7 +46,7 @@ struct IsOutsideDomainBoundary { struct FindEmbeddedBoundaryIntersection { const int m_step_index; - const int m_time_index + const int m_time_index; const int m_step; const amrex::Real m_dt; amrex::Array4 m_phiarr; From 1268500f28388fc5816df756c3c83d4a3d22dfac Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 16 Feb 2024 11:27:09 -0800 Subject: [PATCH 37/41] Update ParticleBoundaryBuffer.cpp --- Source/Particles/ParticleBoundaryBuffer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Particles/ParticleBoundaryBuffer.cpp b/Source/Particles/ParticleBoundaryBuffer.cpp index 95f5a4ac0b6..7b0b9759272 100644 --- a/Source/Particles/ParticleBoundaryBuffer.cpp +++ b/Source/Particles/ParticleBoundaryBuffer.cpp @@ -377,9 +377,9 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, auto& warpx = WarpX::GetInstance(); const auto dt = warpx.getdt(pti.GetLevel()); auto string_to_index_intcomp = buffer[i].getParticleiComps(); - int step_scraped_index = string_to_index_intcomp.at('step_scraped'); + int step_scraped_index = string_to_index_intcomp.at("step_scraped"); auto string_to_index_realcomp = buffer[i].getParticleComps(); - int time_scraped_index = string_to_index_realcomp.at('time_scraped'); + int time_scraped_index = string_to_index_realcomp.at("time_scraped"); const int step = warpx_instance.getistep(0); amrex::filterAndTransformParticles(ptile_buffer, ptile, @@ -459,9 +459,9 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, auto& warpx = WarpX::GetInstance(); const auto dt = warpx.getdt(pti.GetLevel()); auto string_to_index_intcomp = buffer[i].getParticleiComps(); - int step_scraped_index = string_to_index_intcomp.at('step_scraped'); + int step_scraped_index = string_to_index_intcomp.at("step_scraped"); auto string_to_index_realcomp = buffer[i].getParticleComps(); - int time_scraped_index = string_to_index_realcomp.at('time_scraped'); + int time_scraped_index = string_to_index_realcomp.at("time_scraped"); const int step = warpx_instance.getistep(0); { From 3584bfbf0b02e51ca109a3e883c0f838731b4a46 Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 16 Feb 2024 11:52:47 -0800 Subject: [PATCH 38/41] Update ParticleBoundaryBuffer.cpp --- Source/Particles/ParticleBoundaryBuffer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Particles/ParticleBoundaryBuffer.cpp b/Source/Particles/ParticleBoundaryBuffer.cpp index 7b0b9759272..40bd12a38f9 100644 --- a/Source/Particles/ParticleBoundaryBuffer.cpp +++ b/Source/Particles/ParticleBoundaryBuffer.cpp @@ -377,9 +377,9 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, auto& warpx = WarpX::GetInstance(); const auto dt = warpx.getdt(pti.GetLevel()); auto string_to_index_intcomp = buffer[i].getParticleiComps(); - int step_scraped_index = string_to_index_intcomp.at("step_scraped"); + const int step_scraped_index = string_to_index_intcomp.at("step_scraped"); auto string_to_index_realcomp = buffer[i].getParticleComps(); - int time_scraped_index = string_to_index_realcomp.at("time_scraped"); + const int time_scraped_index = string_to_index_realcomp.at("time_scraped"); const int step = warpx_instance.getistep(0); amrex::filterAndTransformParticles(ptile_buffer, ptile, @@ -459,9 +459,9 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, auto& warpx = WarpX::GetInstance(); const auto dt = warpx.getdt(pti.GetLevel()); auto string_to_index_intcomp = buffer[i].getParticleiComps(); - int step_scraped_index = string_to_index_intcomp.at("step_scraped"); + const int step_scraped_index = string_to_index_intcomp.at("step_scraped"); auto string_to_index_realcomp = buffer[i].getParticleComps(); - int time_scraped_index = string_to_index_realcomp.at("time_scraped"); + const int time_scraped_index = string_to_index_realcomp.at("time_scraped"); const int step = warpx_instance.getistep(0); { From a845ccac188bd9a750f2d23dfb1cc0a32e7995e9 Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 16 Feb 2024 13:25:55 -0800 Subject: [PATCH 39/41] Update Source/Particles/ParticleBoundaryBuffer.cpp Co-authored-by: Remi Lehe --- Source/Particles/ParticleBoundaryBuffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Particles/ParticleBoundaryBuffer.cpp b/Source/Particles/ParticleBoundaryBuffer.cpp index 40bd12a38f9..784468cd3dd 100644 --- a/Source/Particles/ParticleBoundaryBuffer.cpp +++ b/Source/Particles/ParticleBoundaryBuffer.cpp @@ -378,7 +378,7 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, const auto dt = warpx.getdt(pti.GetLevel()); auto string_to_index_intcomp = buffer[i].getParticleiComps(); const int step_scraped_index = string_to_index_intcomp.at("step_scraped"); - auto string_to_index_realcomp = buffer[i].getParticleComps(); + auto string_to_index_realcomp = buffer[i].getParticleRuntimeComps(); const int time_scraped_index = string_to_index_realcomp.at("time_scraped"); const int step = warpx_instance.getistep(0); From 449241e41f0be3670a5f565e6b9172866c1428f8 Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 16 Feb 2024 13:35:15 -0800 Subject: [PATCH 40/41] Update Source/Particles/ParticleBoundaryBuffer.cpp Co-authored-by: Remi Lehe --- Source/Particles/ParticleBoundaryBuffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Particles/ParticleBoundaryBuffer.cpp b/Source/Particles/ParticleBoundaryBuffer.cpp index 784468cd3dd..0e52a85f03d 100644 --- a/Source/Particles/ParticleBoundaryBuffer.cpp +++ b/Source/Particles/ParticleBoundaryBuffer.cpp @@ -376,7 +376,7 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, WARPX_PROFILE("ParticleBoundaryBuffer::gatherParticles::filterAndTransform"); auto& warpx = WarpX::GetInstance(); const auto dt = warpx.getdt(pti.GetLevel()); - auto string_to_index_intcomp = buffer[i].getParticleiComps(); + auto string_to_index_intcomp = buffer[i].getParticleRuntimeiComps(); const int step_scraped_index = string_to_index_intcomp.at("step_scraped"); auto string_to_index_realcomp = buffer[i].getParticleRuntimeComps(); const int time_scraped_index = string_to_index_realcomp.at("time_scraped"); From 914686ba257150bf0bffe1ec13cd92f9e42ed607 Mon Sep 17 00:00:00 2001 From: Eya D <81635404+EyaDammak@users.noreply.github.com> Date: Fri, 16 Feb 2024 13:36:22 -0800 Subject: [PATCH 41/41] Update ParticleBoundaryBuffer.cpp --- Source/Particles/ParticleBoundaryBuffer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Particles/ParticleBoundaryBuffer.cpp b/Source/Particles/ParticleBoundaryBuffer.cpp index 0e52a85f03d..2b90adac172 100644 --- a/Source/Particles/ParticleBoundaryBuffer.cpp +++ b/Source/Particles/ParticleBoundaryBuffer.cpp @@ -458,9 +458,9 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, } auto& warpx = WarpX::GetInstance(); const auto dt = warpx.getdt(pti.GetLevel()); - auto string_to_index_intcomp = buffer[i].getParticleiComps(); + auto string_to_index_intcomp = buffer[i].getParticleRuntimeiComps(); const int step_scraped_index = string_to_index_intcomp.at("step_scraped"); - auto string_to_index_realcomp = buffer[i].getParticleComps(); + auto string_to_index_realcomp = buffer[i].getParticleRuntimeComps(); const int time_scraped_index = string_to_index_realcomp.at("time_scraped"); const int step = warpx_instance.getistep(0);