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

Core library cleanup #1457

Merged
merged 4 commits into from
Mar 14, 2025
Merged
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
26 changes: 12 additions & 14 deletions include/core/bdf.h
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ using namespace dealii;
* should be in decreasing order.
*
* For example, if the method is a BDF2 (\f$n=2\f$), it uses three values for
* the time: \f$t\f$, \f$t-\Delta t_1\f$ and \f$t-\Delta t_2\f$. Thus the @p
* the time: \f$t\f$, \f$t-\Delta t_1\f$ and \f$t-\Delta t_2\f$. Thus, the @p
* time_steps vector should contain \f$\Delta t_1\f$ and \f$\Delta t_2\f$.
*
* @return Vector containing BDF integration coefficient values.
@@ -36,8 +36,8 @@ using namespace dealii;
*/
Vector<double>
calculate_bdf_coefficients(
const Parameters::SimulationControl::TimeSteppingMethod method,
const std::vector<double> &time_steps);
Parameters::SimulationControl::TimeSteppingMethod method,
const std::vector<double> &time_steps);


/**
@@ -65,13 +65,11 @@ calculate_bdf_coefficients(
* calculation of BDF coefficients.
*/
Vector<double>
delta(const unsigned int order,
const unsigned int n,
const unsigned int j,
delta(unsigned int order,
unsigned int n,
unsigned int j,
const Vector<double> &times);



/**
* @brief Get the maximum number of previous time steps supposed by the BDF
* schemes implemented in Lethe.
@@ -97,17 +95,17 @@ maximum_number_of_previous_solutions()
*/
inline unsigned int
number_of_previous_solutions(
Parameters::SimulationControl::TimeSteppingMethod method)
const Parameters::SimulationControl::TimeSteppingMethod method)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the const be absent here, given the link in the description?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good question friend. Because this is an inline function the function is defined afterwards. So here the header does not contain the function prototype but the function itself. Consequently, the const has to be there because the function is defined straight up afterwards :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that makes sense! Thank you for the explanation

{
if (method == Parameters::SimulationControl::TimeSteppingMethod::bdf1 ||
method == Parameters::SimulationControl::TimeSteppingMethod::steady_bdf)
return 1;
else if (method == Parameters::SimulationControl::TimeSteppingMethod::bdf2)
if (method == Parameters::SimulationControl::TimeSteppingMethod::bdf2)
return 2;
else if (method == Parameters::SimulationControl::TimeSteppingMethod::bdf3)
if (method == Parameters::SimulationControl::TimeSteppingMethod::bdf3)
return 3;
else
return 0;

return 0;
}

/**
@@ -131,7 +129,7 @@ number_of_previous_solutions(
*/

template <typename DataType>
inline void
void
bdf_extrapolate(const std::vector<double> &time_vector,
const std::vector<std::vector<DataType>> &solution_vector,
const unsigned int number_of_previous_solutions,
131 changes: 58 additions & 73 deletions include/core/boundary_conditions.h

Large diffs are not rendered by default.

9 changes: 0 additions & 9 deletions include/core/dem_properties.h
Original file line number Diff line number Diff line change
@@ -76,15 +76,6 @@ namespace DEM
};
} // namespace CFDDEMProperties

/**
* @brief Return the number of properties stored on each particle.
* @tparam PropertiesIndex Index of the properties used within the ParticleHandler.
* @return Number of DEM properties.
*/
template <typename PropertiesIndex>
unsigned int
get_number_properties();

/**
* @brief Controls the name of output variables for the vtu.
* @tparam dim An integer that denotes the number of spatial dimensions.
10 changes: 6 additions & 4 deletions include/core/density_model.h
Original file line number Diff line number Diff line change
@@ -133,7 +133,7 @@ class DensityConstant : public DensityModel
* zero.
*/
double
jacobian(const std::map<field, double> &field_values, field id) override
jacobian(const std::map<field, double> &field_values, const field id) override
{
(void)field_values;
(void)id;
@@ -150,7 +150,8 @@ class DensityConstant : public DensityModel
* @param[in] id Identifier of the field with respect to which a derivative
* should be computed.
*
* @param[out] jacobian Vector of computed derivative values of the density
* @param[out] jacobian_vector Vector of computed derivative values of the
* density
* with respect to the field of the specified @p id. In this case, it returns
* a vector of zeros since the density remains constant.
*
@@ -294,7 +295,7 @@ class DensityIsothermalIdealGas : public DensityModel
* specified field.
*/
double
jacobian(const std::map<field, double> &field_values, field id) override
jacobian(const std::map<field, double> &field_values, const field id) override
{
(void)field_values;
if (id == field::pressure)
@@ -313,7 +314,8 @@ class DensityIsothermalIdealGas : public DensityModel
* @param[in] id Identifier of the field with respect to which a derivative
* should be computed.
*
* @param[out] jacobian Vector of computed derivative values of the density
* @param[out] jacobian_vector Vector of computed derivative values of the
* density
* with respect to the field of the specified @p id.
*/
void
14 changes: 7 additions & 7 deletions include/core/grids.h
Original file line number Diff line number Diff line change
@@ -37,8 +37,8 @@ attach_grid_to_triangulation(
template <int dim, int spacedim = dim>
void
setup_periodic_boundary_conditions(
parallel::DistributedTriangulationBase<dim, spacedim> &triangulation,
const BoundaryConditions::BoundaryConditions<spacedim> &boundary_conditions);
parallel::DistributedTriangulationBase<dim, spacedim> &triangulation,
const BoundaryConditions::BoundaryConditions &boundary_conditions);

/**
* @brief Completely set-up a mesh and its manifold
@@ -54,11 +54,11 @@ setup_periodic_boundary_conditions(
template <int dim, int spacedim = dim>
void
read_mesh_and_manifolds(
parallel::DistributedTriangulationBase<dim, spacedim> &triangulation,
const Parameters::Mesh &mesh_parameters,
const Parameters::Manifolds &manifolds_parameters,
const bool &restart,
const BoundaryConditions::BoundaryConditions<spacedim> &boundary_conditions);
parallel::DistributedTriangulationBase<dim, spacedim> &triangulation,
const Parameters::Mesh &mesh_parameters,
const Parameters::Manifolds &manifolds_parameters,
const bool &restart,
const BoundaryConditions::BoundaryConditions &boundary_conditions);


/**
32 changes: 15 additions & 17 deletions source/core/bdf.cc
Original file line number Diff line number Diff line change
@@ -45,42 +45,40 @@ calculate_bdf_coefficients(
{
switch (method)
{
case (Parameters::SimulationControl::TimeSteppingMethod::bdf1):
case Parameters::SimulationControl::TimeSteppingMethod::bdf1:
return bdf_coefficients(1, time_steps);
case (Parameters::SimulationControl::TimeSteppingMethod::steady_bdf):
case Parameters::SimulationControl::TimeSteppingMethod::steady_bdf:
return bdf_coefficients(1, time_steps);
case (Parameters::SimulationControl::TimeSteppingMethod::bdf2):
case Parameters::SimulationControl::TimeSteppingMethod::bdf2:
return bdf_coefficients(2, time_steps);
case (Parameters::SimulationControl::TimeSteppingMethod::bdf3):
case Parameters::SimulationControl::TimeSteppingMethod::bdf3:
return bdf_coefficients(3, time_steps);
default:
throw(std::runtime_error(
"BDF coefficients were requested without a BDF method"));
break;
}
}

Vector<double>
delta(const unsigned int p,
delta(const unsigned int order,
const unsigned int n,
const unsigned int j,
const Vector<double> &times)
{
if (j == 0)
{
Vector<double> arr(p + 1);
Vector<double> arr(order + 1);
arr = 0.;
arr[n] = 1;
return arr;
}
else
{
Vector<double> delta_1 = delta(p, n, j - 1, times);
Vector<double> delta_2 = delta(p, n + 1, j - 1, times);
Vector<double> delta_sol(p + 1);
for (unsigned int i_del = 0; i_del < p + 1; ++i_del)
delta_sol[i_del] =
(delta_1[i_del] - delta_2[i_del]) / (times[n] - times[n + j]);
return delta_sol;
}

// else
Vector<double> delta_1 = delta(order, n, j - 1, times);
Vector<double> delta_2 = delta(order, n + 1, j - 1, times);
Vector<double> delta_sol(order + 1);
for (unsigned int i_del = 0; i_del < order + 1; ++i_del)
delta_sol[i_del] =
(delta_1[i_del] - delta_2[i_del]) / (times[n] - times[n + j]);
return delta_sol;
}
2 changes: 0 additions & 2 deletions source/core/boundary_conditions.cc
Original file line number Diff line number Diff line change
@@ -5,8 +5,6 @@

namespace BoundaryConditions
{
extern template class BoundaryConditions<2>;
extern template class BoundaryConditions<3>;
extern template class NSBoundaryConditions<2>;
extern template class NSBoundaryConditions<3>;
extern template class HTBoundaryConditions<2>;
62 changes: 17 additions & 45 deletions source/core/dem_properties.cc
Original file line number Diff line number Diff line change
@@ -12,37 +12,22 @@ namespace DEM
std::vector<std::pair<std::string, int>>
ParticleProperties<dim, PropertiesIndex>::get_properties_name()
{
if constexpr (std::is_same_v<PropertiesIndex,
DEM::DEMProperties::PropertiesIndex>)
{
std::vector<std::pair<std::string, int>> properties(
PropertiesIndex::n_properties);
properties[PropertiesIndex::type] = std::make_pair("type", 1);
properties[PropertiesIndex::dp] = std::make_pair("diameter", 1);
properties[PropertiesIndex::v_x] = std::make_pair("velocity", 3);
properties[PropertiesIndex::v_y] = std::make_pair("velocity", 1);
properties[PropertiesIndex::v_z] = std::make_pair("velocity", 1);
properties[PropertiesIndex::omega_x] = std::make_pair("omega", 3);
properties[PropertiesIndex::omega_y] = std::make_pair("omega", 1);
properties[PropertiesIndex::omega_z] = std::make_pair("omega", 1);
properties[PropertiesIndex::mass] = std::make_pair("mass", 1);

return properties;
}
std::vector<std::pair<std::string, int>> properties(
PropertiesIndex::n_properties);

properties[PropertiesIndex::type] = std::make_pair("type", 1);
properties[PropertiesIndex::dp] = std::make_pair("diameter", 1);
properties[PropertiesIndex::v_x] = std::make_pair("velocity", 3);
properties[PropertiesIndex::v_y] = std::make_pair("velocity", 1);
properties[PropertiesIndex::v_z] = std::make_pair("velocity", 1);
properties[PropertiesIndex::omega_x] = std::make_pair("omega", 3);
properties[PropertiesIndex::omega_y] = std::make_pair("omega", 1);
properties[PropertiesIndex::omega_z] = std::make_pair("omega", 1);
properties[PropertiesIndex::mass] = std::make_pair("mass", 1);

if constexpr (std::is_same_v<PropertiesIndex,
DEM::CFDDEMProperties::PropertiesIndex>)
{
std::vector<std::pair<std::string, int>> properties(
PropertiesIndex::n_properties);
properties[PropertiesIndex::type] = std::make_pair("type", 1);
properties[PropertiesIndex::dp] = std::make_pair("diameter", 1);
properties[PropertiesIndex::v_x] = std::make_pair("velocity", 3);
properties[PropertiesIndex::v_y] = std::make_pair("velocity", 1);
properties[PropertiesIndex::v_z] = std::make_pair("velocity", 1);
properties[PropertiesIndex::omega_x] = std::make_pair("omega", 3);
properties[PropertiesIndex::omega_y] = std::make_pair("omega", 1);
properties[PropertiesIndex::omega_z] = std::make_pair("omega", 1);
properties[PropertiesIndex::fem_force_x] =
std::make_pair("fem_force", 3);
properties[PropertiesIndex::fem_force_y] =
@@ -57,26 +42,13 @@ namespace DEM
std::make_pair("fem_torque", 1);
properties[PropertiesIndex::volumetric_contribution] =
std::make_pair("volumetric_contribution", 1);
properties[PropertiesIndex::mass] = std::make_pair("mass", 1);

return properties;
}
return properties;
}

template <typename PropertiesIndex>
unsigned int
get_number_properties()
{
return PropertiesIndex::n_properties;
}

template class ParticleProperties<2, DEM::DEMProperties::PropertiesIndex>;
template class ParticleProperties<2, DEM::CFDDEMProperties::PropertiesIndex>;
template class ParticleProperties<3, DEM::DEMProperties::PropertiesIndex>;
template class ParticleProperties<3, DEM::CFDDEMProperties::PropertiesIndex>;
template class ParticleProperties<2, DEMProperties::PropertiesIndex>;
template class ParticleProperties<2, CFDDEMProperties::PropertiesIndex>;
template class ParticleProperties<3, DEMProperties::PropertiesIndex>;
template class ParticleProperties<3, CFDDEMProperties::PropertiesIndex>;

template unsigned int
DEM::get_number_properties<DEM::DEMProperties::PropertiesIndex>();
template unsigned int
DEM::get_number_properties<DEM::CFDDEMProperties::PropertiesIndex>();
} // namespace DEM
6 changes: 2 additions & 4 deletions source/core/density_model.cc
Original file line number Diff line number Diff line change
@@ -14,8 +14,6 @@ DensityModel::model_cast(const Parameters::Material &material_properties)
material_properties.isothermal_ideal_gas_density_parameters.R,
material_properties.isothermal_ideal_gas_density_parameters.T);
}
else
{
return std::make_shared<DensityConstant>(material_properties.density);
}

return std::make_shared<DensityConstant>(material_properties.density);
}
56 changes: 28 additions & 28 deletions source/core/grids.cc
Original file line number Diff line number Diff line change
@@ -292,8 +292,8 @@ attach_grid_to_triangulation(
template <int dim, int spacedim>
void
setup_periodic_boundary_conditions(
parallel::DistributedTriangulationBase<dim, spacedim> &triangulation,
const BoundaryConditions::BoundaryConditions<spacedim> &boundary_conditions)
parallel::DistributedTriangulationBase<dim, spacedim> &triangulation,
const BoundaryConditions::BoundaryConditions &boundary_conditions)

{
// Setup periodic boundary conditions
@@ -320,11 +320,11 @@ setup_periodic_boundary_conditions(
template <int dim, int spacedim>
void
read_mesh_and_manifolds(
parallel::DistributedTriangulationBase<dim, spacedim> &triangulation,
const Parameters::Mesh &mesh_parameters,
const Parameters::Manifolds &manifolds_parameters,
const bool &restart,
const BoundaryConditions::BoundaryConditions<spacedim> &boundary_conditions)
parallel::DistributedTriangulationBase<dim, spacedim> &triangulation,
const Parameters::Mesh &mesh_parameters,
const Parameters::Manifolds &manifolds_parameters,
const bool &restart,
const BoundaryConditions::BoundaryConditions &boundary_conditions)
{
attach_grid_to_triangulation(triangulation, mesh_parameters);

@@ -411,35 +411,35 @@ attach_grid_to_triangulation(

template void
setup_periodic_boundary_conditions(
parallel::DistributedTriangulationBase<2, 2> &triangulation,
const BoundaryConditions::BoundaryConditions<2> &boundary_conditions);
parallel::DistributedTriangulationBase<2, 2> &triangulation,
const BoundaryConditions::BoundaryConditions &boundary_conditions);
template void
setup_periodic_boundary_conditions(
parallel::DistributedTriangulationBase<2, 3> &triangulation,
const BoundaryConditions::BoundaryConditions<3> &boundary_conditions);
parallel::DistributedTriangulationBase<2, 3> &triangulation,
const BoundaryConditions::BoundaryConditions &boundary_conditions);
template void
setup_periodic_boundary_conditions(
parallel::DistributedTriangulationBase<3, 3> &triangulation,
const BoundaryConditions::BoundaryConditions<3> &boundary_conditions);
parallel::DistributedTriangulationBase<3, 3> &triangulation,
const BoundaryConditions::BoundaryConditions &boundary_conditions);

template void
read_mesh_and_manifolds(
parallel::DistributedTriangulationBase<2> &triangulation,
const Parameters::Mesh &mesh_parameters,
const Parameters::Manifolds &manifolds_parameters,
const bool &restart,
const BoundaryConditions::BoundaryConditions<2> &boundary_conditions);
parallel::DistributedTriangulationBase<2> &triangulation,
const Parameters::Mesh &mesh_parameters,
const Parameters::Manifolds &manifolds_parameters,
const bool &restart,
const BoundaryConditions::BoundaryConditions &boundary_conditions);
template void
read_mesh_and_manifolds(
parallel::DistributedTriangulationBase<3> &triangulation,
const Parameters::Mesh &mesh_parameters,
const Parameters::Manifolds &manifolds_parameters,
const bool &restart,
const BoundaryConditions::BoundaryConditions<3> &boundary_conditions);
parallel::DistributedTriangulationBase<3> &triangulation,
const Parameters::Mesh &mesh_parameters,
const Parameters::Manifolds &manifolds_parameters,
const bool &restart,
const BoundaryConditions::BoundaryConditions &boundary_conditions);
template void
read_mesh_and_manifolds(
parallel::DistributedTriangulationBase<2, 3> &triangulation,
const Parameters::Mesh &mesh_parameters,
const Parameters::Manifolds &manifolds_parameters,
const bool &restart,
const BoundaryConditions::BoundaryConditions<3> &boundary_conditions);
parallel::DistributedTriangulationBase<2, 3> &triangulation,
const Parameters::Mesh &mesh_parameters,
const Parameters::Manifolds &manifolds_parameters,
const bool &restart,
const BoundaryConditions::BoundaryConditions &boundary_conditions);
4 changes: 1 addition & 3 deletions source/dem/dem.cc
Original file line number Diff line number Diff line change
@@ -41,9 +41,7 @@ DEMSolver<dim, PropertiesIndex>::DEMSolver(
, checkpoint_controller(parameters.restart)
, triangulation(this->mpi_communicator)
, mapping(1)
, particle_handler(triangulation,
mapping,
DEM::get_number_properties<PropertiesIndex>())
, particle_handler(triangulation, mapping, PropertiesIndex::n_properties)
, computing_timer(this->mpi_communicator,
this->pcout,
TimerOutput::summary,
2 changes: 1 addition & 1 deletion source/fem-dem/cfd_dem_coupling.cc
Original file line number Diff line number Diff line change
@@ -320,7 +320,7 @@ CFDDEMSolver<dim>::read_dem()
Particles::ParticleHandler<dim> temporary_particle_handler(
*this->triangulation,
this->particle_mapping,
DEM::get_number_properties<DEM::DEMProperties::PropertiesIndex>());
DEM::DEMProperties::n_properties);

ia >> temporary_particle_handler;

11 changes: 4 additions & 7 deletions source/fem-dem/fluid_dynamics_vans.cc
Original file line number Diff line number Diff line change
@@ -17,10 +17,9 @@ FluidDynamicsVANS<dim>::FluidDynamicsVANS(
: FluidDynamicsMatrixBased<dim>(nsparam.cfd_parameters)
, cfd_dem_simulation_parameters(nsparam)
, particle_mapping(1)
, particle_handler(
*this->triangulation,
particle_mapping,
DEM::get_number_properties<DEM::CFDDEMProperties::PropertiesIndex>())
, particle_handler(*this->triangulation,
particle_mapping,
DEM::CFDDEMProperties::n_properties)
, void_fraction_manager(
&(*this->triangulation),
nsparam.void_fraction,
@@ -113,9 +112,7 @@ FluidDynamicsVANS<dim>::read_dem()

// Create a temporary particle_handler with DEM properties
Particles::ParticleHandler<dim> temporary_particle_handler(
*this->triangulation,
particle_mapping,
DEM::get_number_properties<DEM::DEMProperties::PropertiesIndex>());
*this->triangulation, particle_mapping, DEM::DEMProperties::n_properties);


ia >> temporary_particle_handler;
7 changes: 3 additions & 4 deletions source/fem-dem/fluid_dynamics_vans_matrix_free.cc
Original file line number Diff line number Diff line change
@@ -23,10 +23,9 @@ FluidDynamicsVANSMatrixFree<dim>::FluidDynamicsVANSMatrixFree(
: FluidDynamicsMatrixFree<dim>(param.cfd_parameters)
, cfd_dem_simulation_parameters(param)
, particle_mapping(1)
, particle_handler(
*this->triangulation,
particle_mapping,
DEM::get_number_properties<DEM::CFDDEMProperties::PropertiesIndex>())
, particle_handler(*this->triangulation,
particle_mapping,
DEM::CFDDEMProperties::n_properties)
, void_fraction_manager(
&(*this->triangulation),
param.void_fraction,
2 changes: 1 addition & 1 deletion tests/dem/distribution_normal.cc
Original file line number Diff line number Diff line change
@@ -59,7 +59,7 @@ test()

// Defining particle handler
Particles::ParticleHandler<dim> particle_handler(
tr, mapping, DEM::get_number_properties<PropertiesIndex>());
tr, mapping, PropertiesIndex::n_properties);

// Calling uniform insertion
std::vector<std::shared_ptr<Distribution>> distribution_object_container;
2 changes: 1 addition & 1 deletion tests/dem/insertion_plane.cc
Original file line number Diff line number Diff line change
@@ -68,7 +68,7 @@ test()

// Defining particle handler
Particles::ParticleHandler<dim> particle_handler(
tr, mapping, DEM::get_number_properties<PropertiesIndex>());
tr, mapping, PropertiesIndex::n_properties);

insertion_object.insert(particle_handler, tr, dem_parameters);

8 changes: 3 additions & 5 deletions tests/dem/insertion_volume_1.cc
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@

using namespace dealii;

template <int dim>
template <int dim, typename PropertiesIndex>
void
test()
{
@@ -56,9 +56,7 @@ test()

// Defining particle handler
Particles::ParticleHandler<dim> particle_handler(
tr,
mapping,
DEM::get_number_properties<DEM::DEMProperties::PropertiesIndex>());
tr, mapping, PropertiesIndex::n_properties);
// Calling uniform insertion
std::vector<std::shared_ptr<Distribution>> distribution_object_container;
distribution_object_container.push_back(std::make_shared<UniformDistribution>(
@@ -95,7 +93,7 @@ main(int argc, char **argv)
Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);

initlog();
test<3>();
test<3, DEM::DEMProperties::PropertiesIndex>();
}
catch (std::exception &exc)
{
8 changes: 3 additions & 5 deletions tests/dem/insertion_volume_2.cc
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@

using namespace dealii;

template <int dim>
template <int dim, typename PropertiesIndex>
void
test()
{
@@ -56,9 +56,7 @@ test()

// Defining particle handler
Particles::ParticleHandler<dim> particle_handler(
tr,
mapping,
DEM::get_number_properties<DEM::DEMProperties::PropertiesIndex>());
tr, mapping, PropertiesIndex::n_properties);
// Calling uniform insertion
std::vector<std::shared_ptr<Distribution>> distribution_object_container;
distribution_object_container.push_back(std::make_shared<UniformDistribution>(
@@ -95,7 +93,7 @@ main(int argc, char **argv)
Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);

initlog();
test<3>();
test<3, DEM::DEMProperties::PropertiesIndex>();
}
catch (std::exception &exc)
{
8 changes: 3 additions & 5 deletions tests/dem/integration_euler.cc
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@

using namespace dealii;

template <int dim>
template <int dim, typename PropertiesIndex>
void
test()
{
@@ -49,9 +49,7 @@ test()

// Defining particle handler
Particles::ParticleHandler<dim> particle_handler(
tr,
mapping,
DEM::get_number_properties<DEM::DEMProperties::PropertiesIndex>());
tr, mapping, PropertiesIndex::n_properties);
// inserting one particle at x = 0 , y = 0 and z = 0 m
// initial velocity of particles = 0, 0, 0 m/s
// gravitational acceleration = 0, 0, -9.81 m/s2
@@ -111,7 +109,7 @@ main(int argc, char **argv)
Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);

initlog();
test<3>();
test<3, DEM::DEMProperties::PropertiesIndex>();
}
catch (std::exception &exc)
{
33 changes: 3 additions & 30 deletions tests/dem/integration_schemes_accuracy.cc
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@

using namespace dealii;

template <int dim>
template <int dim, typename PropertiesIndex>
void
test()
{
@@ -54,9 +54,7 @@ test()

// Defning particle handler
Particles::ParticleHandler<dim> particle_handler(
tr,
mapping,
DEM::get_number_properties<DEM::DEMProperties::PropertiesIndex>());
tr, mapping, PropertiesIndex::n_properties);

int id = 0;
double particle_mass = 1;
@@ -124,11 +122,7 @@ test()
Tensor<1, dim> force_tensor;
force_tensor[dim - 1] =
-spring_constant * particle_iterator->get_location()[dim - 1];
#if (DEAL_II_VERSION_MAJOR < 10 && DEAL_II_VERSION_MINOR < 4)
force[particle_iterator->get_id()] = force_tensor;
#else
force[particle_iterator->get_local_index()] = force_tensor;
#endif
explicit_euler_object.integrate(
particle_handler, g, dt1, torque, force, MOI);

@@ -181,11 +175,7 @@ test()
Tensor<1, dim> force_tensor;
force_tensor[dim - 1] =
-spring_constant * particle_iterator->get_location()[dim - 1];
#if (DEAL_II_VERSION_MAJOR < 10 && DEAL_II_VERSION_MINOR < 4)
force[particle_iterator->get_id()] = force_tensor;
#else
force[particle_iterator->get_local_index()] = force_tensor;
#endif
explicit_euler_object.integrate(
particle_handler, g, dt2, torque, force, MOI);
t += dt2;
@@ -217,16 +207,7 @@ test()
particle_mass;

particle_handler.sort_particles_into_subdomains_and_cells();
#if (DEAL_II_VERSION_MAJOR < 10 && DEAL_II_VERSION_MINOR < 4)
{
unsigned int max_particle_id = 0;
for (const auto &particle : particle_handler)
max_particle_id = std::max(max_particle_id, particle.get_id());
force.resize(max_particle_id + 1);
}
#else
force.resize(particle_handler.get_max_local_particle_index());
#endif
torque.resize(force.size());
MOI.resize(force.size());

@@ -241,11 +222,7 @@ test()
{
t = 0;

#if (DEAL_II_VERSION_MAJOR < 10 && DEAL_II_VERSION_MINOR < 4)
force[particle_iterator->get_id()][dim - 1] = -x0;
#else
force[particle_iterator->get_local_index()][dim - 1] = -x0;
#endif

velocity_verlet_object.integrate_half_step_location(
particle_handler, g, dt1, torque, force, MOI);
@@ -256,11 +233,7 @@ test()
Tensor<1, dim> force_tensor;
force_tensor[dim - 1] =
-spring_constant * particle_iterator->get_location()[dim - 1];
#if (DEAL_II_VERSION_MAJOR < 10 && DEAL_II_VERSION_MINOR < 4)
force[particle_iterator->get_id()] = force_tensor;
#else
force[particle_iterator->get_local_index()] = force_tensor;
#endif
velocity_verlet_object.integrate(
particle_handler, g, dt1, torque, force, MOI);

@@ -352,7 +325,7 @@ main(int argc, char **argv)
Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);

initlog();
test<3>();
test<3, DEM::DEMProperties::PropertiesIndex>();
}
catch (std::exception &exc)
{
8 changes: 3 additions & 5 deletions tests/dem/integration_velocity_verlet.cc
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@

using namespace dealii;

template <int dim>
template <int dim, typename PropertiesIndex>
void
test()
{
@@ -51,9 +51,7 @@ test()

// Defning particle handler
Particles::ParticleHandler<dim> particle_handler(
tr,
mapping,
DEM::get_number_properties<DEM::DEMProperties::PropertiesIndex>());
tr, mapping, PropertiesIndex::n_properties);


// inserting one particle at x = 0 , y = 0 and z = 0 m
@@ -115,7 +113,7 @@ main(int argc, char **argv)
Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);

initlog();
test<3>();
test<3, DEM::DEMProperties::PropertiesIndex>();
}
catch (std::exception &exc)
{
2 changes: 1 addition & 1 deletion tests/dem/normal_force.cc
Original file line number Diff line number Diff line change
@@ -103,7 +103,7 @@ test()

// Defining particle handler
Particles::ParticleHandler<dim> particle_handler(
tr, mapping, DEM::get_number_properties<PropertiesIndex>());
tr, mapping, PropertiesIndex::n_properties);
// Inserting one particle in contact with wall
Point<dim> position1 = {-0.999, 0, 0};
int id = 0;
14 changes: 4 additions & 10 deletions tests/dem/particle_handler_conversion_1.cc
Original file line number Diff line number Diff line change
@@ -33,9 +33,7 @@ test()

// Define a particle handler with a particle and properties
Particles::ParticleHandler<dim> particle_handler(
tr,
mapping,
DEM::get_number_properties<DEM::DEMProperties::PropertiesIndex>());
tr, mapping, DEM::DEMProperties::PropertiesIndex::n_properties);
// Inserting one particle in contact with wall
Point<dim> position1;
for (int d = 0; d < dim; ++d)
@@ -68,8 +66,7 @@ test()
deallog << "Particle " << particle->get_id() << std::endl;
deallog << "Position : " << particle->get_location() << std::endl;
for (unsigned int i = 0;
i <
DEM::get_number_properties<DEM::DEMProperties::PropertiesIndex>();
i < DEM::DEMProperties::PropertiesIndex::n_properties;
++i)
{
deallog << "Property " << i << " : " << particle->get_properties()[i]
@@ -80,9 +77,7 @@ test()

// Create a second Particle Handler using a second set of properties
Particles::ParticleHandler<dim> particle_handler_output(
tr,
mapping,
DEM::get_number_properties<DEM::CFDDEMProperties::PropertiesIndex>());
tr, mapping, DEM::CFDDEMProperties::PropertiesIndex::n_properties);

// Fill the second particle handler using the first one
convert_particle_handler<dim,
@@ -99,8 +94,7 @@ test()
deallog << "Particle " << particle->get_id() << std::endl;
deallog << "Position : " << particle->get_location() << std::endl;
for (unsigned int i = 0;
i <
DEM::get_number_properties<DEM::CFDDEMProperties::PropertiesIndex>();
i < DEM::CFDDEMProperties::PropertiesIndex::n_properties;
++i)
{
deallog << "Property " << i << " : " << particle->get_properties()[i]
2 changes: 1 addition & 1 deletion tests/dem/particle_particle_contact_force_linear.cc
Original file line number Diff line number Diff line change
@@ -53,7 +53,7 @@ test()
const double neighborhood_threshold = std::pow(1.3 * particle_diameter, 2);

Particles::ParticleHandler<dim> particle_handler(
triangulation, mapping, DEM::get_number_properties<PropertiesIndex>());
triangulation, mapping, PropertiesIndex::n_properties);

// Creating containers manager for finding cell neighbor and also broad and
// fine particle-particle search objects
2 changes: 1 addition & 1 deletion tests/dem/particle_particle_contact_force_nonlinear.cc
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@ test()
const double neighborhood_threshold = std::pow(1.3 * particle_diameter, 2);

Particles::ParticleHandler<dim> particle_handler(
triangulation, mapping, DEM::get_number_properties<PropertiesIndex>());
triangulation, mapping, PropertiesIndex::n_properties);

// Creating containers manager for finding cell neighbor and also broad and
// fine particle-particle search objects
2 changes: 1 addition & 1 deletion tests/dem/particle_particle_contact_on_two_processors.cc
Original file line number Diff line number Diff line change
@@ -97,7 +97,7 @@ test()
const double neighborhood_threshold = std::pow(1.3 * particle_diameter, 2);

Particles::ParticleHandler<dim> particle_handler(
triangulation, mapping, DEM::get_number_properties<PropertiesIndex>());
triangulation, mapping, PropertiesIndex::n_properties);

typename dem_data_structures<2>::particle_index_iterator_map
local_particle_container;
2 changes: 1 addition & 1 deletion tests/dem/particle_particle_fine_search.cc
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ test()

// Defining general simulation parameters
Particles::ParticleHandler<dim> particle_handler(
triangulation, mapping, DEM::get_number_properties<PropertiesIndex>());
triangulation, mapping, PropertiesIndex::n_properties);

DEMContactManager<dim, PropertiesIndex> contact_manager;

2 changes: 1 addition & 1 deletion tests/dem/particle_point_contact.cc
Original file line number Diff line number Diff line change
@@ -80,7 +80,7 @@ test()

// Defining particle handler
Particles::ParticleHandler<dim> particle_handler(
tr, mapping, DEM::get_number_properties<PropertiesIndex>());
tr, mapping, PropertiesIndex::n_properties);
// Inserting one particle in contact with wall
Point<dim> position1 = {0.97, 2.05};
int id = 0;
2 changes: 1 addition & 1 deletion tests/dem/particle_wall_contact_force_linear.cc
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ test()
}

Particles::ParticleHandler<dim> particle_handler(
tr, mapping, DEM::get_number_properties<PropertiesIndex>());
tr, mapping, PropertiesIndex::n_properties);

// Inserting one particle in contact with a wall
Point<dim> position1 = {-0.998, 0, 0};
2 changes: 1 addition & 1 deletion tests/dem/particle_wall_contact_force_nonlinear.cc
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ test()
}

Particles::ParticleHandler<dim> particle_handler(
tr, mapping, DEM::get_number_properties<PropertiesIndex>());
tr, mapping, PropertiesIndex::n_properties);

// Inserting one particle in contact with a wall
Point<dim> position1 = {-0.998, 0, 0};
2 changes: 1 addition & 1 deletion tests/dem/particle_wall_fine_search.cc
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ test()
double particle_diameter = 0.005;

Particles::ParticleHandler<dim> particle_handler(
tr, mapping, DEM::get_number_properties<PropertiesIndex>());
tr, mapping, PropertiesIndex::n_properties);

// Inserting one particle in contact with a wall
Point<dim> position1 = {-0.998, 0, 0};
2 changes: 1 addition & 1 deletion tests/dem/post_collision_velocity.cc
Original file line number Diff line number Diff line change
@@ -101,7 +101,7 @@ test(double coefficient_of_restitution)

// Defining particle handler
Particles::ParticleHandler<dim> particle_handler(
tr, mapping, DEM::get_number_properties<PropertiesIndex>());
tr, mapping, PropertiesIndex::n_properties);
// Inserting one particle in contact with wall
Point<dim> position = {-0.999, 0, 0};
int id = 0;
2 changes: 1 addition & 1 deletion tests/dem/two_particles_multiple_contacts_parallel.cc
Original file line number Diff line number Diff line change
@@ -90,7 +90,7 @@ test()
Parameters::Lagrangian::RollingResistanceMethod::constant_resistance;

Particles::ParticleHandler<dim> particle_handler(
triangulation, mapping, DEM::get_number_properties<PropertiesIndex>());
triangulation, mapping, PropertiesIndex::n_properties);

typename dem_data_structures<2>::particle_index_iterator_map
local_particle_container;