-
Notifications
You must be signed in to change notification settings - Fork 14
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
New particle interface using derived classes #827
base: development
Are you sure you want to change the base?
Conversation
so that SetRadEnergySource is called on all Fabs at a level
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
There were too many comments to post at once. Showing the first 10 out of 68. Check the log or trigger a new build to see more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
There were too many comments to post at once. Showing the first 10 out of 70. Check the log or trigger a new build to see more.
|
||
const double lum1 = 1.0; | ||
|
||
template <> struct quokka::EOS_Traits<ParticleProblem> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "quokka::EOS_Traits" is directly included [misc-include-cleaner]
src/problems/GravRadParticle3D/test_grav_rad_particle_3D.cpp:12:
- #include "test_grav_rad_particle_3D.hpp"
+ #include "hydro/EOS.hpp"
+ #include "test_grav_rad_particle_3D.hpp"
static constexpr double gamma = 5. / 3.; | ||
}; | ||
|
||
template <> struct Physics_Traits<ParticleProblem> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "Physics_Traits" is directly included [misc-include-cleaner]
src/problems/GravRadParticle3D/test_grav_rad_particle_3D.cpp:12:
- #include "test_grav_rad_particle_3D.hpp"
+ #include "physics_info.hpp"
+ #include "test_grav_rad_particle_3D.hpp"
CICRadParticles->InitFromAsciiFile("GravRadParticles3D.txt", nreal_extra, nullptr); | ||
} | ||
|
||
template <> AMREX_GPU_HOST_DEVICE auto RadSystem<ParticleProblem>::ComputePlanckOpacity(const double /*rho*/, const double /*Tgas*/) -> amrex::Real |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "AMREX_GPU_HOST_DEVICE" is directly included [misc-include-cleaner]
src/problems/GravRadParticle3D/test_grav_rad_particle_3D.cpp:10:
- #include "AMReX_Vector.H"
+ #include "AMReX_GpuQualifiers.H"
+ #include "AMReX_Vector.H"
return kappa0; | ||
} | ||
|
||
template <> void QuokkaSimulation<ParticleProblem>::setInitialConditionsOnGrid(quokka::grid const &grid_elem) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "quokka::grid" is directly included [misc-include-cleaner]
src/problems/GravRadParticle3D/test_grav_rad_particle_3D.cpp:12:
- #include "test_grav_rad_particle_3D.hpp"
+ #include "grid.hpp"
+ #include "test_grav_rad_particle_3D.hpp"
template <> void QuokkaSimulation<ParticleProblem>::setInitialConditionsOnGrid(quokka::grid const &grid_elem) | ||
{ | ||
const amrex::Box &indexRange = grid_elem.indexRange_; | ||
const amrex::Array4<double> &state_cc = grid_elem.array_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "amrex::Array4" is directly included [misc-include-cleaner]
src/problems/GravRadParticle3D/test_grav_rad_particle_3D.cpp:7:
- #include "AMReX_BCRec.H"
+ #include "AMReX_Array4.H"
+ #include "AMReX_BCRec.H"
const auto Egas0 = initial_Egas; | ||
|
||
// loop over the grid and set the initial condition | ||
amrex::ParallelFor(indexRange, [=] AMREX_GPU_DEVICE(int i, int j, int k) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "amrex::ParallelFor" is directly included [misc-include-cleaner]
src/problems/GravRadParticle3D/test_grav_rad_particle_3D.cpp:10:
- #include "AMReX_Vector.H"
+ #include "AMReX_GpuLaunchFunctsC.H"
+ #include "AMReX_Vector.H"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
There were too many comments to post at once. Showing the first 10 out of 64. Check the log or trigger a new build to see more.
|
||
// get particle positions | ||
quokka::CICRadParticleContainer<ParticleProblem> analysisPC{}; | ||
amrex::Box const box(amrex::IntVect{AMREX_D_DECL(0, 0, 0)}, amrex::IntVect{AMREX_D_DECL(1, 1, 1)}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "AMREX_D_DECL" is directly included [misc-include-cleaner]
src/problems/GravRadParticle3D/test_grav_rad_particle_3D.cpp:10:
- #include "AMReX_Vector.H"
+ #include "AMReX_SPACE.H"
+ #include "AMReX_Vector.H"
quokka::CICRadParticleContainer<ParticleProblem> analysisPC{}; | ||
amrex::Box const box(amrex::IntVect{AMREX_D_DECL(0, 0, 0)}, amrex::IntVect{AMREX_D_DECL(1, 1, 1)}); | ||
amrex::Geometry const geom(box); | ||
amrex::BoxArray const boxArray(box); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "amrex::BoxArray" is directly included [misc-include-cleaner]
src/problems/GravRadParticle3D/test_grav_rad_particle_3D.cpp:10:
- #include "AMReX_Vector.H"
+ #include "AMReX_BoxArray.H"
+ #include "AMReX_Vector.H"
amrex::Geometry const geom(box); | ||
amrex::BoxArray const boxArray(box); | ||
amrex::Vector<int> const ranks({0}); // workaround nvcc bug | ||
amrex::DistributionMapping const dmap(ranks); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "amrex::DistributionMapping" is directly included [misc-include-cleaner]
src/problems/GravRadParticle3D/test_grav_rad_particle_3D.cpp:10:
- #include "AMReX_Vector.H"
+ #include "AMReX_DistributionMapping.H"
+ #include "AMReX_Vector.H"
sim.particleRegister_.getParticleDescriptor("CICRad_particles")->getParticleContainer<quokka::CICRadParticleContainer<ParticleProblem>>(); | ||
analysisPC.copyParticles(*container); | ||
|
||
if (amrex::ParallelDescriptor::IOProcessor()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "amrex::ParallelDescriptor::IOProcessor" is directly included [misc-include-cleaner]
src/problems/GravRadParticle3D/test_grav_rad_particle_3D.cpp:10:
- #include "AMReX_Vector.H"
+ #include "AMReX_ParallelDescriptor.H"
+ #include "AMReX_Vector.H"
analysisPC.copyParticles(*container); | ||
|
||
if (amrex::ParallelDescriptor::IOProcessor()) { | ||
quokka::CICRadParticleIterator<ParticleProblem> const pIter(analysisPC, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "quokka::CICRadParticleIterator" is directly included [misc-include-cleaner]
quokka::CICRadParticleIterator<ParticleProblem> const pIter(analysisPC, 0);
^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
There were too many comments to post at once. Showing the first 10 out of 63. Check the log or trigger a new build to see more.
|
||
#include "AMReX.H" | ||
#include "AMReX_BCRec.H" | ||
#include "AMReX_BC_TYPES.H" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: included header AMReX_BCRec.H is not used directly [misc-include-cleaner]
#include "AMReX_BC_TYPES.H" | |
#include "AMReX_BC_TYPES.H" |
#include "AMReX_BC_TYPES.H" | ||
#include "AMReX_Box.H" | ||
#include "AMReX_GpuLaunchFunctsC.H" | ||
#include "AMReX_REAL.H" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: included header AMReX_GpuLaunchFunctsC.H is not used directly [misc-include-cleaner]
#include "AMReX_REAL.H" | |
#include "AMReX_REAL.H" |
#include "AMReX_Box.H" | ||
#include "AMReX_GpuLaunchFunctsC.H" | ||
#include "AMReX_REAL.H" | ||
#include "AMReX_Vector.H" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: included header AMReX_REAL.H is not used directly [misc-include-cleaner]
#include "AMReX_Vector.H" | |
#include "AMReX_Vector.H" |
#include "AMReX_GpuLaunchFunctsC.H" | ||
#include "AMReX_REAL.H" | ||
#include "AMReX_Vector.H" | ||
#include "QuokkaSimulation.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: included header AMReX_Vector.H is not used directly [misc-include-cleaner]
#include "QuokkaSimulation.hpp" | |
#include "QuokkaSimulation.hpp" |
#include "QuokkaSimulation.hpp" | ||
#include "hydro/EOS.hpp" | ||
#include "particles/PhysicsParticles.hpp" | ||
#include "radiation/radiation_system.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: included header PhysicsParticles.hpp is not used directly [misc-include-cleaner]
#include "radiation/radiation_system.hpp" | |
#include "radiation/radiation_system.hpp" |
static constexpr double gamma = 5. / 3.; | ||
}; | ||
|
||
template <> struct Physics_Traits<ParticleProblem> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "Physics_Traits" is directly included [misc-include-cleaner]
src/problems/GravRadParticle3D/test_grav_rad_particle_3D.cpp:18:
- #include "radiation/radiation_system.hpp"
+ #include "physics_info.hpp"
+ #include "radiation/radiation_system.hpp"
CICRadParticles->InitFromAsciiFile("GravRadParticles3D.txt", nreal_extra, nullptr); | ||
} | ||
|
||
template <> AMREX_GPU_HOST_DEVICE auto RadSystem<ParticleProblem>::ComputePlanckOpacity(const double /*rho*/, const double /*Tgas*/) -> amrex::Real |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "AMREX_GPU_HOST_DEVICE" is directly included [misc-include-cleaner]
src/problems/GravRadParticle3D/test_grav_rad_particle_3D.cpp:13:
- #include "AMReX_REAL.H"
+ #include "AMReX_GpuQualifiers.H"
+ #include "AMReX_REAL.H"
}; | ||
|
||
// Boundary conditions | ||
constexpr int nvars = RadSystem<ParticleProblem>::nvar_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'nvars' is not initialized [cppcoreguidelines-init-variables]
constexpr int nvars = RadSystem<ParticleProblem>::nvar_; | |
constexpr int nvars = 0 = RadSystem<ParticleProblem>::nvar_; |
sim.evolve(); | ||
|
||
// compute total radiation energy | ||
const double total_Erad_over_vol = sim.state_new_cc_[0].sum(RadSystem<ParticleProblem>::radEnergy_index); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'total_Erad_over_vol' is not initialized [cppcoreguidelines-init-variables]
src/problems/GravRadParticle3D/test_grav_rad_particle_3D.cpp:20:
+
+ #include <math.h>
const double total_Erad_over_vol = sim.state_new_cc_[0].sum(RadSystem<ParticleProblem>::radEnergy_index); | |
const double total_Erad_over_vol = NAN = sim.state_new_cc_[0].sum(RadSystem<ParticleProblem>::radEnergy_index); |
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
There were too many comments to post at once. Showing the first 10 out of 58. Check the log or trigger a new build to see more.
static constexpr double gamma = 5. / 3.; | ||
}; | ||
|
||
template <> struct Physics_Traits<ParticleProblem> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "Physics_Traits" is directly included [misc-include-cleaner]
src/problems/GravRadParticle3D/test_grav_rad_particle_3D.cpp:17:
- #include "radiation/radiation_system.hpp"
+ #include "physics_info.hpp"
+ #include "radiation/radiation_system.hpp"
CICRadParticles->InitFromAsciiFile("GravRadParticles3D.txt", nreal_extra, nullptr); | ||
} | ||
|
||
template <> AMREX_GPU_HOST_DEVICE auto RadSystem<ParticleProblem>::ComputePlanckOpacity(const double /*rho*/, const double /*Tgas*/) -> amrex::Real |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "AMREX_GPU_HOST_DEVICE" is directly included [misc-include-cleaner]
src/problems/GravRadParticle3D/test_grav_rad_particle_3D.cpp:12:
- #include "AMReX_REAL.H"
+ #include "AMReX_GpuQualifiers.H"
+ #include "AMReX_REAL.H"
return kappa0; | ||
} | ||
|
||
template <> void QuokkaSimulation<ParticleProblem>::setInitialConditionsOnGrid(quokka::grid const &grid_elem) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "quokka::grid" is directly included [misc-include-cleaner]
src/problems/GravRadParticle3D/test_grav_rad_particle_3D.cpp:15:
- #include "hydro/EOS.hpp"
+ #include "grid.hpp"
+ #include "hydro/EOS.hpp"
template <> void QuokkaSimulation<ParticleProblem>::setInitialConditionsOnGrid(quokka::grid const &grid_elem) | ||
{ | ||
const amrex::Box &indexRange = grid_elem.indexRange_; | ||
const amrex::Array4<double> &state_cc = grid_elem.array_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "amrex::Array4" is directly included [misc-include-cleaner]
src/problems/GravRadParticle3D/test_grav_rad_particle_3D.cpp:9:
- #include "AMReX_BCRec.H"
+ #include "AMReX_Array4.H"
+ #include "AMReX_BCRec.H"
const auto Egas0 = initial_Egas; | ||
|
||
// loop over the grid and set the initial condition | ||
amrex::ParallelFor(indexRange, [=] AMREX_GPU_DEVICE(int i, int j, int k) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "amrex::ParallelFor" is directly included [misc-include-cleaner]
src/problems/GravRadParticle3D/test_grav_rad_particle_3D.cpp:12:
- #include "AMReX_REAL.H"
+ #include "AMReX_GpuLaunchFunctsC.H"
+ #include "AMReX_REAL.H"
|
||
// get particle positions | ||
quokka::CICRadParticleContainer<ParticleProblem> analysisPC{}; | ||
amrex::Box const box(amrex::IntVect{AMREX_D_DECL(0, 0, 0)}, amrex::IntVect{AMREX_D_DECL(1, 1, 1)}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "AMREX_D_DECL" is directly included [misc-include-cleaner]
src/problems/GravRadParticle3D/test_grav_rad_particle_3D.cpp:13:
- #include "AMReX_Vector.H"
+ #include "AMReX_SPACE.H"
+ #include "AMReX_Vector.H"
quokka::CICRadParticleContainer<ParticleProblem> analysisPC{}; | ||
amrex::Box const box(amrex::IntVect{AMREX_D_DECL(0, 0, 0)}, amrex::IntVect{AMREX_D_DECL(1, 1, 1)}); | ||
amrex::Geometry const geom(box); | ||
amrex::BoxArray const boxArray(box); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "amrex::BoxArray" is directly included [misc-include-cleaner]
src/problems/GravRadParticle3D/test_grav_rad_particle_3D.cpp:12:
- #include "AMReX_REAL.H"
+ #include "AMReX_BoxArray.H"
+ #include "AMReX_REAL.H"
amrex::Geometry const geom(box); | ||
amrex::BoxArray const boxArray(box); | ||
amrex::Vector<int> const ranks({0}); // workaround nvcc bug | ||
amrex::DistributionMapping const dmap(ranks); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "amrex::DistributionMapping" is directly included [misc-include-cleaner]
src/problems/GravRadParticle3D/test_grav_rad_particle_3D.cpp:12:
- #include "AMReX_REAL.H"
+ #include "AMReX_DistributionMapping.H"
+ #include "AMReX_REAL.H"
sim.particleRegister_.getParticleDescriptor("CICRad_particles")->getParticleContainer<quokka::CICRadParticleContainer<ParticleProblem>>(); | ||
analysisPC.copyParticles(*container); | ||
|
||
if (amrex::ParallelDescriptor::IOProcessor()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "amrex::ParallelDescriptor::IOProcessor" is directly included [misc-include-cleaner]
src/problems/GravRadParticle3D/test_grav_rad_particle_3D.cpp:12:
- #include "AMReX_REAL.H"
+ #include "AMReX_ParallelDescriptor.H"
+ #include "AMReX_REAL.H"
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
Azure Pipelines successfully started running 2 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
There were too many comments to post at once. Showing the first 10 out of 49. Check the log or trigger a new build to see more.
if (amrex::ParallelDescriptor::IOProcessor()) { | ||
quokka::CICRadParticleIterator<ParticleProblem> const pIter(analysisPC, 0); | ||
if (pIter.isValid()) { | ||
const amrex::Long np = pIter.numParticles(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "amrex::Long" is directly included [misc-include-cleaner]
src/problems/GravRadParticle3D/test_grav_rad_particle_3D.cpp:12:
- #include "AMReX_REAL.H"
+ #include "AMReX_INT.H"
+ #include "AMReX_REAL.H"
// copy particles from device to host | ||
quokka::CICRadParticleContainer<ParticleProblem>::ParticleType *pData = particles().data(); | ||
amrex::Vector<quokka::CICRadParticleContainer<ParticleProblem>::ParticleType> pData_h(np); | ||
amrex::Gpu::copy(amrex::Gpu::deviceToHost, pData, pData + np, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
amrex::Gpu::copy(amrex::Gpu::deviceToHost, pData, pData + np,
^
// copy particles from device to host | ||
quokka::CICRadParticleContainer<ParticleProblem>::ParticleType *pData = particles().data(); | ||
amrex::Vector<quokka::CICRadParticleContainer<ParticleProblem>::ParticleType> pData_h(np); | ||
amrex::Gpu::copy(amrex::Gpu::deviceToHost, pData, pData + np, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "amrex::Gpu::copy" is directly included [misc-include-cleaner]
src/problems/GravRadParticle3D/test_grav_rad_particle_3D.cpp:12:
- #include "AMReX_REAL.H"
+ #include "AMReX_GpuContainers.H"
+ #include "AMReX_REAL.H"
// copy particles from device to host | ||
quokka::CICRadParticleContainer<ParticleProblem>::ParticleType *pData = particles().data(); | ||
amrex::Vector<quokka::CICRadParticleContainer<ParticleProblem>::ParticleType> pData_h(np); | ||
amrex::Gpu::copy(amrex::Gpu::deviceToHost, pData, pData + np, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "amrex::Gpu::deviceToHost" is directly included [misc-include-cleaner]
amrex::Gpu::copy(amrex::Gpu::deviceToHost, pData, pData + np,
^
static constexpr int beta_order = 0; | ||
static constexpr OpacityModel opacity_model = OpacityModel::piecewise_constant_opacity; | ||
static constexpr double energy_unit = 1.0; | ||
static constexpr amrex::GpuArray<double, nGroups_ + 1> radBoundaries{0.001, 1.0, 3.0, 100.0}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "amrex::GpuArray" is directly included [misc-include-cleaner]
src/problems/RadParticle/test_radparticle.cpp:6:
- #include "AMReX_Array4.H"
+ #include "AMReX_Array.H"
+ #include "AMReX_Array4.H"
// } | ||
|
||
template <> | ||
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE auto |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "AMREX_FORCE_INLINE" is directly included [misc-include-cleaner]
src/problems/RadParticle/test_radparticle.cpp:8:
- #include "AMReX_GpuQualifiers.H"
+ #include "AMReX_Extension.H"
+ #include "AMReX_GpuQualifiers.H"
const auto Egas0 = initial_Egas; | ||
|
||
// loop over the grid and set the initial condition | ||
amrex::ParallelFor(indexRange, [=] AMREX_GPU_DEVICE(int i, int j, int k) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "amrex::ParallelFor" is directly included [misc-include-cleaner]
src/problems/RadParticle/test_radparticle.cpp:8:
- #include "AMReX_GpuQualifiers.H"
+ #include "AMReX_GpuLaunchFunctsC.H"
+ #include "AMReX_GpuQualifiers.H"
// loop over the grid and set the initial condition | ||
amrex::ParallelFor(indexRange, [=] AMREX_GPU_DEVICE(int i, int j, int k) { | ||
for (int g = 0; g < nGroups_; ++g) { | ||
state_cc(i, j, k, RadSystem<ParticleProblem>::radEnergy_index + Physics_NumVars::numRadVars * g) = Erad0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "Physics_NumVars" is directly included [misc-include-cleaner]
src/problems/RadParticle/test_radparticle.cpp:13:
- #include "radiation/radiation_system.hpp"
+ #include "physics_numVars.hpp"
+ #include "radiation/radiation_system.hpp"
|
||
// Boundary conditions | ||
constexpr int nvars = RadSystem<ParticleProblem>::nvar_; | ||
amrex::Vector<amrex::BCRec> BCs_cc(nvars); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "amrex::BCRec" is directly included [misc-include-cleaner]
src/problems/RadParticle/test_radparticle.cpp:7:
- #include "AMReX_Box.H"
+ #include "AMReX_BCRec.H"
+ #include "AMReX_Box.H"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
There were too many comments to post at once. Showing the first 10 out of 29. Check the log or trigger a new build to see more.
|
||
// Boundary conditions | ||
constexpr int nvars = RadSystem<ParticleProblem>::nvar_; | ||
amrex::Vector<amrex::BCRec> BCs_cc(nvars); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "amrex::Vector" is directly included [misc-include-cleaner]
src/problems/RadParticle/test_radparticle.cpp:9:
- #include "QuokkaSimulation.hpp"
+ #include "AMReX_Vector.H"
+ #include "QuokkaSimulation.hpp"
amrex::Vector<amrex::BCRec> BCs_cc(nvars); | ||
for (int n = 0; n < nvars; ++n) { | ||
for (int i = 0; i < AMREX_SPACEDIM; ++i) { | ||
BCs_cc[n].setLo(i, amrex::BCType::int_dir); // periodic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "amrex::BCType::int_dir" is directly included [misc-include-cleaner]
src/problems/RadParticle/test_radparticle.cpp:7:
- #include "AMReX_Box.H"
+ #include "AMReX_BC_TYPES.H"
+ #include "AMReX_Box.H"
const double dx = sim.Geom(0).CellSize(0); | ||
|
||
// compute error norm | ||
std::vector<double> Erad_group0(nx); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "std::vector" is directly included [misc-include-cleaner]
src/problems/RadParticle/test_radparticle.cpp:16:
- #ifdef HAVE_PYTHON
+ #include <vector>
+ #ifdef HAVE_PYTHON
double tot_lum_group1 = 0.0; | ||
double tot_lum_group2 = 0.0; | ||
for (int i = 0; i < nx; ++i) { | ||
amrex::Real const x = position[i]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "amrex::Real" is directly included [misc-include-cleaner]
src/problems/RadParticle/test_radparticle.cpp:9:
- #include "QuokkaSimulation.hpp"
+ #include "AMReX_REAL.H"
+ #include "QuokkaSimulation.hpp"
const double lum_exact_group2 = lum3 * tmax; | ||
|
||
const double err_norm = | ||
std::abs(tot_lum_group0 - lum_exact_group0) + std::abs(tot_lum_group1 - lum_exact_group1) + std::abs(tot_lum_group2 - lum_exact_group2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "std::abs" is directly included [misc-include-cleaner]
src/problems/RadParticle/test_radparticle.cpp:15:
- #include <fmt/format.h>
+ #include <cstdlib>
+ #include <fmt/format.h>
matplotlibcpp::clf(); | ||
matplotlibcpp::ylim(-0.05, 1.4); | ||
|
||
std::map<std::string, std::string> erad_args; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "std::map" is directly included [misc-include-cleaner]
src/problems/RadParticle/test_radparticle.cpp:16:
- #ifdef HAVE_PYTHON
+ #include <map>
+ #ifdef HAVE_PYTHON
/// | ||
|
||
#include "test_radparticle_2D.hpp" | ||
#include "QuokkaSimulation.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: included header test_radparticle_2D.hpp is not used directly [misc-include-cleaner]
#include "QuokkaSimulation.hpp" | |
#include "QuokkaSimulation.hpp" |
|
||
const double lum1 = 1.0; | ||
|
||
template <> struct quokka::EOS_Traits<ParticleProblem> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "quokka::EOS_Traits" is directly included [misc-include-cleaner]
src/problems/RadParticle2D/test_radparticle_2D.cpp:6:
+ #include "hydro/EOS.hpp"
static constexpr double gamma = 5. / 3.; | ||
}; | ||
|
||
template <> struct Physics_Traits<ParticleProblem> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "Physics_Traits" is directly included [misc-include-cleaner]
src/problems/RadParticle2D/test_radparticle_2D.cpp:6:
+ #include "physics_info.hpp"
// face-centred | ||
static constexpr bool is_mhd_enabled = false; | ||
static constexpr int nGroups = nGroups_; // number of radiation groups | ||
static constexpr UnitSystem unit_system = UnitSystem::CONSTANTS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "UnitSystem" is directly included [misc-include-cleaner]
static constexpr UnitSystem unit_system = UnitSystem::CONSTANTS;
^
Quality Gate passedIssues Measures |
// Redistribute particles after movement. This ensures particles are in the correct cells/processors for radiation deposition | ||
// TODO(cch): I believe this is needed and missing this in the original code was a bug, but I don't understand why this was not caught earlier. | ||
// Maybe the binary_orbit test was the only test for gravity and there was no multiple boxes in that test? | ||
for (int lev = 0; lev <= finest_level; ++lev) { |
Check notice
Code scanning / CodeQL
Declaration hides variable Note
line 961
### Description add `misc-include-cleaner` to exclusion list of .clang-tidy. This will get rid of warnings like `warning: no header providing "AMREX_GPU_HOST_DEVICE" is directly included` in clang-tidy-review. ### Related issues Should get rid of the `clang-tidy-review` failure in PR #827 . ### Checklist _Before this pull request can be reviewed, all of these tasks should be completed. Denote completed tasks with an `x` inside the square brackets `[ ]` in the Markdown source below:_ - [x] I have added a description (see above). - [x] I have added a link to any related issues (if applicable; see above). - [x] I have read the [Contributing Guide](https://github.com/quokka-astro/quokka/blob/development/CONTRIBUTING.md). - [ ] I have added tests for any new physics that this PR adds to the code. - [ ] *(For quokka-astro org members)* I have manually triggered the GPU tests with the magic comment `/azp run`.
Description
The physics particle interface provides a flexible and extensible system for managing different types of particles in the simulation. It uses a combination of the Strategy pattern and Registry pattern to handle multiple particle types through a common interface.
Core Components
1. PhysicsParticleDescriptor (Base Class)
This abstract base class defines the interface that all particle descriptors must implement. It provides virtual methods for common particle operations like:
2. Concrete Descriptor Classes
Currently, the system provides three specialized descriptor classes. More can be added by subclassing
PhysicsParticleDescriptor
.RadParticleDescriptor
: For radiation-emitting particlesCICParticleDescriptor
: For Cloud-In-Cell (gravitating) particlesCICRadParticleDescriptor
: For particles that both emit radiation and interact via CIC3. PhysicsParticleRegister
A registry that manages all particle descriptors and provides high-level operations that apply to all registered particles.
Usage
1. Creating and Registering Particles
See example in
src/simulation.hpp: InitParticles()
2. Using the Interface
Once particles are registered, you can perform operations on all particles through the register:
Key Features
Type Safety: Each descriptor handles type-safe casting of its particle container internally.
Extensibility: New particle types can be added by:
PhysicsParticleDescriptor
Unified Interface: All particle operations can be performed through the register without knowing the specific particle types.
Selective Operations: The system automatically handles operations only for particles that support them:
Adding a New Particle Type
New test problems
This implementation is totally working, passing both
RadParticle
andGravRadParticle3D
tests.Related issues
None.
Checklist
Before this pull request can be reviewed, all of these tasks should be completed. Denote completed tasks with an
x
inside the square brackets[ ]
in the Markdown source below:/azp run
.