Skip to content

Commit

Permalink
Resolve "Remove perturb_mode and perturb_amplitude from SpeciesInfo"
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilyBourne committed Feb 20, 2024
1 parent a3be632 commit 7832d1d
Show file tree
Hide file tree
Showing 29 changed files with 474 additions and 761 deletions.
10 changes: 3 additions & 7 deletions simulations/geometryXVx/bump_on_tail/bumpontail_fem_uniform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,7 @@ int main(int argc, char** argv)
}

// Initialization of the distribution function
ddc::init_discrete_space<IDimSp>(
std::move(charges),
std::move(masses),
std::move(init_perturb_amplitude),
std::move(init_perturb_mode));
ddc::init_discrete_space<IDimSp>(std::move(charges), std::move(masses));
device_t<DFieldSpVx> allfequilibrium_device(meshSpVx);
BumpontailEquilibrium const init_fequilibrium(
std::move(epsilon_bot),
Expand All @@ -162,8 +158,8 @@ int main(int argc, char** argv)
if (iter_start == 0) {
SingleModePerturbInitialization const
init(allfequilibrium_device,
ddc::host_discrete_space<IDimSp>().perturb_modes(),
ddc::host_discrete_space<IDimSp>().perturb_amplitudes());
init_perturb_mode.span_cview(),
init_perturb_amplitude.span_cview());
init(allfdistribu_device);
} else {
RestartInitialization const restart(iter_start, time_start);
Expand Down
10 changes: 3 additions & 7 deletions simulations/geometryXVx/bump_on_tail/bumpontail_fft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,7 @@ int main(int argc, char** argv)
}

// Initialization of the distribution function
ddc::init_discrete_space<IDimSp>(
std::move(charges),
std::move(masses),
std::move(init_perturb_amplitude),
std::move(init_perturb_mode));
ddc::init_discrete_space<IDimSp>(std::move(charges), std::move(masses));
device_t<DFieldSpVx> allfequilibrium_device(meshSpVx);
BumpontailEquilibrium const init_fequilibrium(
std::move(epsilon_bot),
Expand All @@ -157,8 +153,8 @@ int main(int argc, char** argv)
if (iter_start == 0) {
SingleModePerturbInitialization const
init(allfequilibrium_device,
ddc::host_discrete_space<IDimSp>().perturb_modes(),
ddc::host_discrete_space<IDimSp>().perturb_amplitudes());
init_perturb_mode.span_cview(),
init_perturb_amplitude.span_cview());
init(allfdistribu_device);
} else {
RestartInitialization const restart(iter_start, time_start);
Expand Down
10 changes: 3 additions & 7 deletions simulations/geometryXVx/landau/landau_fem_uniform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,7 @@ int main(int argc, char** argv)
}

// Initialization of the distribution function
ddc::init_discrete_space<IDimSp>(
std::move(charges),
std::move(masses),
std::move(init_perturb_amplitude),
std::move(init_perturb_mode));
ddc::init_discrete_space<IDimSp>(std::move(charges), std::move(masses));
device_t<DFieldSpVx> allfequilibrium_device(meshSpVx);
MaxwellianEquilibrium const init_fequilibrium(
std::move(density_eq),
Expand All @@ -161,8 +157,8 @@ int main(int argc, char** argv)
if (iter_start == 0) {
SingleModePerturbInitialization const
init(allfequilibrium_device,
ddc::host_discrete_space<IDimSp>().perturb_modes(),
ddc::host_discrete_space<IDimSp>().perturb_amplitudes());
init_perturb_mode.span_cview(),
init_perturb_amplitude.span_cview());
init(allfdistribu_device);
} else {
RestartInitialization const restart(iter_start, time_start);
Expand Down
10 changes: 3 additions & 7 deletions simulations/geometryXVx/landau/landau_fft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,7 @@ int main(int argc, char** argv)
}

// Initialization of the distribution function
ddc::init_discrete_space<IDimSp>(
std::move(charges),
std::move(masses),
std::move(init_perturb_amplitude),
std::move(init_perturb_mode));
ddc::init_discrete_space<IDimSp>(std::move(charges), std::move(masses));
device_t<DFieldSpVx> allfequilibrium_device(meshSpVx);
MaxwellianEquilibrium const init_fequilibrium(
std::move(density_eq),
Expand All @@ -157,8 +153,8 @@ int main(int argc, char** argv)
if (iter_start == 0) {
SingleModePerturbInitialization const
init(allfequilibrium_device,
ddc::host_discrete_space<IDimSp>().perturb_modes(),
ddc::host_discrete_space<IDimSp>().perturb_amplitudes());
init_perturb_mode.span_cview(),
init_perturb_amplitude.span_cview());
init(allfdistribu_device);
} else {
RestartInitialization const restart(iter_start, time_start);
Expand Down
10 changes: 3 additions & 7 deletions simulations/geometryXVx/sheath/sheath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,7 @@ int main(int argc, char** argv)
}

// Initialization of the distribution function
ddc::init_discrete_space<IDimSp>(
std::move(charges),
std::move(masses),
std::move(init_perturb_amplitude),
std::move(init_perturb_mode));
ddc::init_discrete_space<IDimSp>(std::move(charges), std::move(masses));
device_t<DFieldSpVx> allfequilibrium_device(meshSpVx);
MaxwellianEquilibrium const init_fequilibrium(
std::move(density_eq),
Expand All @@ -176,8 +172,8 @@ int main(int argc, char** argv)
if (iter_start == 0) {
SingleModePerturbInitialization const
init(allfequilibrium_device,
ddc::host_discrete_space<IDimSp>().perturb_modes(),
ddc::host_discrete_space<IDimSp>().perturb_amplitudes());
init_perturb_mode.span_cview(),
init_perturb_amplitude.span_cview());
init(allfdistribu_device);
} else {
RestartInitialization const restart(iter_start, time_start);
Expand Down
10 changes: 3 additions & 7 deletions simulations/geometryXYVxVy/landau/landau4d_fft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,7 @@ int main(int argc, char** argv)
}

// Initialization of the distribution function
ddc::init_discrete_space<IDimSp>(
std::move(charges),
std::move(masses),
std::move(init_perturb_amplitude),
std::move(init_perturb_mode));
ddc::init_discrete_space<IDimSp>(std::move(charges), std::move(masses));
DFieldSpVxVy allfequilibrium(meshSpVxVy);
MaxwellianEquilibrium const init_fequilibrium(
std::move(density_eq),
Expand All @@ -193,8 +189,8 @@ int main(int argc, char** argv)
DFieldSpXYVxVy allfdistribu(meshSpXYVxVy);
SingleModePerturbInitialization const
init(allfequilibrium,
ddc::host_discrete_space<IDimSp>().perturb_modes(),
ddc::host_discrete_space<IDimSp>().perturb_amplitudes());
init_perturb_mode.span_cview(),
init_perturb_amplitude.span_cview());
init(allfdistribu);

// --> Algorithm info
Expand Down
34 changes: 1 addition & 33 deletions src/speciesinfo/species_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@ class SpeciesInformation
// mass of the particles of all kinetic species
ddc::Chunk<double, discrete_domain_type, ddc::KokkosAllocator<double, MemorySpace>> m_mass;

// Initial perturbation amplitude of all kinetic species
ddc::Chunk<double, discrete_domain_type, ddc::KokkosAllocator<double, MemorySpace>>
m_perturb_amplitude;

// Initial perturbation mode of all kinetic species
ddc::Chunk<int, discrete_domain_type, ddc::KokkosAllocator<int, MemorySpace>>
m_perturb_mode;

// workaround to access charges on the device
ddc::ChunkView<int, discrete_domain_type, std::experimental::layout_right, MemorySpace>
m_charge_view;
Expand All @@ -65,36 +57,24 @@ class SpeciesInformation
explicit Impl(Impl<OMemorySpace> const& impl)
: m_charge(impl.m_charge.domain())
, m_mass(impl.m_mass.domain())
, m_perturb_amplitude(impl.m_perturb_amplitude.domain())
, m_perturb_mode(impl.m_perturb_mode.domain())
, m_ielec(impl.m_ielec)
{
m_charge_view = m_charge.span_cview();
m_mass_view = m_mass.span_cview();
ddc::deepcopy(m_charge, impl.m_charge);
ddc::deepcopy(m_mass, impl.m_mass);
ddc::deepcopy(m_perturb_amplitude, impl.m_perturb_amplitude);
ddc::deepcopy(m_perturb_mode, impl.m_perturb_mode);
}

/**
* @brief Main constructor taking all attributes
* @param[in] charge array storing both kinetic and adiabatic charges
* @param[in] mass array storing both kinetic and adiabatic masses
* @param[in] perturb_amplitude array storing kinetic pertubation amplitudes
* @param[in] perturb_mode array storing kinetic pertubation modes
*/
Impl(ddc::Chunk<int, discrete_domain_type, ddc::KokkosAllocator<int, MemorySpace>> charge,
ddc::Chunk<double, discrete_domain_type, ddc::KokkosAllocator<double, MemorySpace>>
mass,
ddc::Chunk<double, discrete_domain_type, ddc::KokkosAllocator<double, MemorySpace>>
perturb_amplitude,
ddc::Chunk<int, discrete_domain_type, ddc::KokkosAllocator<int, MemorySpace>>
perturb_mode)
mass)
: m_charge(std::move(charge))
, m_mass(std::move(mass))
, m_perturb_amplitude(std::move(perturb_amplitude))
, m_perturb_mode(std::move(perturb_mode))
{
m_charge_view = m_charge.span_cview();
m_mass_view = m_mass.span_cview();
Expand Down Expand Up @@ -146,18 +126,6 @@ class SpeciesInformation
{
return m_mass.span_view();
}

/// @return kinetic perturbation amplitudes array
auto perturb_amplitudes() const
{
return m_perturb_amplitude.span_view();
}

/// @return kinetic perturbation modes array
auto perturb_modes() const
{
return m_perturb_mode.span_view();
}
};
};

Expand Down
2 changes: 1 addition & 1 deletion tests/geometryRTheta/advection_2d_rp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

set(TIME_METHOD "CRANK_NICOLSON_METHOD")

foreach(MAPPING_TYPE "CIRCULAR_MAPPING" "CZARNY_MAPPING_PHYSICAL" "CZARNY_MAPPING_PSEUDO_CARTESIAN" "DISCRETE_MAPPING")
foreach(MAPPING_TYPE "CIRCULAR_MAPPING_PHYSICAL" "CZARNY_MAPPING_PHYSICAL" "CZARNY_MAPPING_PSEUDO_CARTESIAN" "DISCRETE_MAPPING_PSEUDO_CARTESIAN")
foreach(SIMULATION "TRANSLATION_SIMULATION" "ROTATION_SIMULATION" "DECENTRED_ROTATION_SIMULATION")
set(test_name "advection_${MAPPING_TYPE}__${TIME_METHOD}__${SIMULATION}")
add_executable("${test_name}"
Expand Down
22 changes: 12 additions & 10 deletions tests/geometryRTheta/advection_2d_rp/advection_all_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#include <vector_field_span.hpp>

#include "advection_domain.hpp"
#include "advection_maths_tools.hpp"
#include "advection_simulation_utils.hpp"
#include "bsl_advection_rp.hpp"
#include "geometry.hpp"
#include "paraconfpp.hpp"
Expand Down Expand Up @@ -175,7 +175,6 @@ struct GeneralParameters
double final_time;
bool if_save_curves;
bool if_save_feet;
int counter_function;
};

template <int i_map = 0, int i_feet = 0, class SimulationTuple>
Expand All @@ -189,10 +188,15 @@ void run_simulations_with_methods(
Numerics methods(sim.advection_domain, num_params);
auto& num = std::get<i_feet>(methods.numerics);

std::ostringstream ss;
ss << sim.mapping_name << " MAPPING - " << sim.domain_name << " DOMAIN - " << num.method_name
<< " - ";
std::string simulation_name = ss.str();
std::ostringstream name_stream;
name_stream << sim.mapping_name << " MAPPING - " << sim.domain_name << " DOMAIN - "
<< num.method_name << " - ";
std::string simulation_name = name_stream.str();

std::ostringstream output_stream;
output_stream << to_lower(sim.mapping_name) << "_" << to_lower(sim.domain_name) << "-"
<< to_lower(num.method_name) << "-";
std::string output_stem = output_stream.str();

simulate_the_3_simulations(
sim.mapping,
Expand All @@ -207,7 +211,7 @@ void run_simulations_with_methods(
num.time_step,
params.if_save_curves,
params.if_save_feet,
params.counter_function,
output_stem,
simulation_name);

if constexpr (i_feet < methods.size_tuple - 1) {
Expand Down Expand Up @@ -371,16 +375,14 @@ int main(int argc, char** argv)

// SIMULATION: ==========================================================================

int counter_function(0);
GeneralParameters params
= {grid,
interpolator,
builder,
spline_evaluator_extrapol,
final_time,
if_save_curves,
if_save_feet,
counter_function};
if_save_feet};
run_simulations_with_methods(simulations, num_params, params);

end_full_simulation = std::chrono::system_clock::now();
Expand Down
Loading

0 comments on commit 7832d1d

Please sign in to comment.