Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] AMReX/pyAMReX/PICSAR: weekly update #5391

Open
wants to merge 2 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ jobs:
which nvcc || echo "nvcc not in PATH!"

git clone https://github.com/AMReX-Codes/amrex.git ../amrex
cd ../amrex && git checkout --detach e1222803739ed2342b9ff6fc2d57316ff0d6cb0c && cd -
cd ../amrex && git checkout --detach 62c2a81eac7862d526e5861ef2befc00b7f5b759 && cd -
make COMP=gcc QED=FALSE USE_MPI=TRUE USE_GPU=TRUE USE_OMP=FALSE USE_FFT=TRUE USE_CCACHE=TRUE -j 4

ccache -s
Expand Down
2 changes: 1 addition & 1 deletion Docs/source/developers/particles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Attribute name ``int``/``real`` Description Wher
Wheeler process physics is used.
==================== ================ ================================== ===== ==== ======================

WarpX allows extra runtime attributes to be added to particle containers (through ``AddRealComp("attrname")`` or ``AddIntComp("attrname")``).
WarpX allows extra runtime attributes to be added to particle containers (through ``NewRealComp("attrname")`` or ``NewIntComp("attrname")``).
The attribute name can then be used to access the values of that attribute.
For example, using a particle iterator, ``pti``, to loop over the particles the command ``pti.GetAttribs(particle_comps["attrname"]).dataPtr();`` will return the values of the ``"attrname"`` attribute.

Expand Down
6 changes: 3 additions & 3 deletions Source/Diagnostics/ParticleIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ MultiParticleContainer::Restart (const std::string& dir)
+ " was found in the checkpoint file, but it has not been added yet. "
+ " Adding it now."
);
pc->AddRealComp(comp_name);
pc->NewRealComp(comp_name);
}
}

Expand Down Expand Up @@ -206,7 +206,7 @@ MultiParticleContainer::Restart (const std::string& dir)
+ " was found in the checkpoint file, but it has not been added yet. "
+ " Adding it now."
);
pc->AddIntComp(comp_name);
pc->NewIntComp(comp_name);
}
}

Expand Down Expand Up @@ -258,7 +258,7 @@ storePhiOnParticles ( PinnedMemoryParticleContainer& tmp,
is_full_diagnostic,
"Output of the electrostatic potential (phi) on the particles was requested, "
"but this is only available with `diag_type = Full`.");
tmp.AddRealComp("phi");
tmp.NewRealComp("phi");
int const phi_index = tmp.getParticleComps().at("phi");
auto& warpx = WarpX::GetInstance();
#ifdef AMREX_USE_OMP
Expand Down
12 changes: 6 additions & 6 deletions Source/Initialization/WarpXInitData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -688,15 +688,15 @@ WarpX::InitFromScratch ()
// Add space to save the positions and velocities at the start of the time steps
for (auto const& pc : *mypc) {
#if (AMREX_SPACEDIM >= 2)
pc->AddRealComp("x_n");
pc->NewRealComp("x_n");
#endif
#if defined(WARPX_DIM_3D) || defined(WARPX_DIM_RZ)
pc->AddRealComp("y_n");
pc->NewRealComp("y_n");
#endif
pc->AddRealComp("z_n");
pc->AddRealComp("ux_n");
pc->AddRealComp("uy_n");
pc->AddRealComp("uz_n");
pc->NewRealComp("z_n");
pc->NewRealComp("ux_n");
pc->NewRealComp("uy_n");
pc->NewRealComp("uz_n");
}

}
Expand Down
4 changes: 2 additions & 2 deletions Source/Particles/NamedComponentParticleContainer.H
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public:
* @param name Name of the new component
* @param comm Whether to communicate this component, in the particle Redistribute
*/
void AddRealComp (const std::string& name, bool comm=true)
void NewRealComp (const std::string& name, bool comm=true)
{
auto search = particle_comps.find(name);
if (search == particle_comps.end()) {
Expand All @@ -177,7 +177,7 @@ public:
* @param name Name of the new component
* @param comm Whether to communicate this component, in the particle Redistribute
*/
void AddIntComp (const std::string& name, bool comm=true)
void NewIntComp (const std::string& name, bool comm=true)
{
auto search = particle_icomps.find(name);
if (search == particle_icomps.end()) {
Expand Down
20 changes: 10 additions & 10 deletions Source/Particles/ParticleBoundaryBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,11 @@ void ParticleBoundaryBuffer::gatherParticlesFromDomainBoundaries (MultiParticleC
if (!buffer[i].isDefined())
{
buffer[i] = pc.make_alike<amrex::PinnedArenaAllocator>();
buffer[i].AddIntComp("stepScraped", false);
buffer[i].AddRealComp("deltaTimeScraped", false);
buffer[i].AddRealComp("nx", false);
buffer[i].AddRealComp("ny", false);
buffer[i].AddRealComp("nz", false);
buffer[i].NewIntComp("stepScraped", false);
buffer[i].NewRealComp("deltaTimeScraped", false);
buffer[i].NewRealComp("nx", false);
buffer[i].NewRealComp("ny", false);
buffer[i].NewRealComp("nz", false);
}

auto& species_buffer = buffer[i];
Expand Down Expand Up @@ -481,11 +481,11 @@ void ParticleBoundaryBuffer::gatherParticlesFromEmbeddedBoundaries (
if (!buffer[i].isDefined())
{
buffer[i] = pc.make_alike<amrex::PinnedArenaAllocator>();
buffer[i].AddIntComp("stepScraped", false);
buffer[i].AddRealComp("deltaTimeScraped", false);
buffer[i].AddRealComp("nx", false);
buffer[i].AddRealComp("ny", false);
buffer[i].AddRealComp("nz", false);
buffer[i].NewIntComp("stepScraped", false);
buffer[i].NewRealComp("deltaTimeScraped", false);
buffer[i].NewRealComp("nx", false);
buffer[i].NewRealComp("ny", false);
buffer[i].NewRealComp("nz", false);

}

Expand Down
16 changes: 8 additions & 8 deletions Source/Particles/PhysicalParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,12 +342,12 @@ PhysicalParticleContainer::PhysicalParticleContainer (AmrCore* amr_core, int isp
#ifdef WARPX_QED
pp_species_name.query("do_qed_quantum_sync", m_do_qed_quantum_sync);
if (m_do_qed_quantum_sync) {
AddRealComp("opticalDepthQSR");
NewRealComp("opticalDepthQSR");
}

pp_species_name.query("do_qed_breit_wheeler", m_do_qed_breit_wheeler);
if (m_do_qed_breit_wheeler) {
AddRealComp("opticalDepthBW");
NewRealComp("opticalDepthBW");
}

if(m_do_qed_quantum_sync){
Expand All @@ -368,7 +368,7 @@ PhysicalParticleContainer::PhysicalParticleContainer (AmrCore* amr_core, int isp
str_int_attrib_function.at(i));
m_user_int_attrib_parser.at(i) = std::make_unique<amrex::Parser>(
utils::parser::makeParser(str_int_attrib_function.at(i),{"x","y","z","ux","uy","uz","t"}));
AddIntComp(m_user_int_attribs.at(i));
NewIntComp(m_user_int_attribs.at(i));
}

// User-defined real attributes
Expand All @@ -383,19 +383,19 @@ PhysicalParticleContainer::PhysicalParticleContainer (AmrCore* amr_core, int isp
str_real_attrib_function.at(i));
m_user_real_attrib_parser.at(i) = std::make_unique<amrex::Parser>(
utils::parser::makeParser(str_real_attrib_function.at(i),{"x","y","z","ux","uy","uz","t"}));
AddRealComp(m_user_real_attribs.at(i));
NewRealComp(m_user_real_attribs.at(i));
}

// If old particle positions should be saved add the needed components
pp_species_name.query("save_previous_position", m_save_previous_position);
if (m_save_previous_position) {
#if (AMREX_SPACEDIM >= 2)
AddRealComp("prev_x");
NewRealComp("prev_x");
#endif
#if defined(WARPX_DIM_3D)
AddRealComp("prev_y");
NewRealComp("prev_y");
#endif
AddRealComp("prev_z");
NewRealComp("prev_z");
#ifdef WARPX_DIM_RZ
amrex::Abort("Saving previous particle positions not yet implemented in RZ");
#endif
Expand Down Expand Up @@ -3121,7 +3121,7 @@ PhysicalParticleContainer::InitIonizationModule ()
physical_element == "H" || !do_adk_correction,
"Correction to ADK by Zhang et al., PRA 90, 043410 (2014) only works with Hydrogen");
// Add runtime integer component for ionization level
AddIntComp("ionizationLevel");
NewIntComp("ionizationLevel");
// Get atomic number and ionization energies from file
const int ion_element_id = utils::physics::ion_map_ids.at(physical_element);
ion_atomic_number = utils::physics::ion_atomic_numbers[ion_element_id];
Expand Down
2 changes: 1 addition & 1 deletion Source/Python/Particles/WarpXParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void init_WarpXParticleContainer (py::module& m)
> wpc (m, "WarpXParticleContainer");
wpc
.def("add_real_comp",
[](WarpXParticleContainer& pc, const std::string& name, bool comm) { pc.AddRealComp(name, comm); },
[](WarpXParticleContainer& pc, const std::string& name, bool comm) { pc.NewRealComp(name, comm); },
py::arg("name"), py::arg("comm")
)
.def("add_n_particles",
Expand Down
2 changes: 1 addition & 1 deletion cmake/dependencies/AMReX.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ set(WarpX_amrex_src ""
set(WarpX_amrex_repo "https://github.com/AMReX-Codes/amrex.git"
CACHE STRING
"Repository URI to pull and build AMReX from if(WarpX_amrex_internal)")
set(WarpX_amrex_branch "e1222803739ed2342b9ff6fc2d57316ff0d6cb0c"
set(WarpX_amrex_branch "62c2a81eac7862d526e5861ef2befc00b7f5b759"
CACHE STRING
"Repository branch for WarpX_amrex_repo if(WarpX_amrex_internal)")

Expand Down
2 changes: 1 addition & 1 deletion cmake/dependencies/pyAMReX.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ option(WarpX_pyamrex_internal "Download & build pyAMReX" ON)
set(WarpX_pyamrex_repo "https://github.com/AMReX-Codes/pyamrex.git"
CACHE STRING
"Repository URI to pull and build pyamrex from if(WarpX_pyamrex_internal)")
set(WarpX_pyamrex_branch "3699781e4284921f9ccdbbbbc57169ff79c0de20"
set(WarpX_pyamrex_branch "fdd9c8cc8f9092ddbd5f29275393cf1329d7ac14"
CACHE STRING
"Repository branch for WarpX_pyamrex_repo if(WarpX_pyamrex_internal)")

Expand Down
Loading