1- #include < ExaMPM_Solver.hpp>
21#include < ExaMPM_BoundaryConditions.hpp>
2+ #include < ExaMPM_Solver.hpp>
33
44#include < Cabana_Core.hpp>
55
@@ -20,18 +20,18 @@ struct ParticleInitFunc
2020 double _volume;
2121 double _mass;
2222
23- ParticleInitFunc ( const double cell_size,
24- const int ppc,
23+ ParticleInitFunc ( const double cell_size, const int ppc,
2524 const double density )
26- : _volume( cell_size * cell_size * cell_size / (ppc* ppc* ppc) )
25+ : _volume( cell_size * cell_size * cell_size / ( ppc * ppc * ppc ) )
2726 , _mass( _volume * density )
28- {}
27+ {
28+ }
2929
30- template <class ParticleType >
31- KOKKOS_INLINE_FUNCTION
32- bool operator ()( const double x[ 3 ], ParticleType& p ) const
30+ template <class ParticleType >
31+ KOKKOS_INLINE_FUNCTION bool operator ()( const double x[ 3 ],
32+ ParticleType& p ) const
3333 {
34- if ( x[0 ]* x[0 ] + x[1 ]* x[1 ] + x[2 ]* x[2 ] < 0.25 * 0.25 )
34+ if ( x[0 ] * x[0 ] + x[1 ] * x[1 ] + x[2 ] * x[2 ] < 0.25 * 0.25 )
3535 {
3636 // Affine matrix.
3737 for ( int d0 = 0 ; d0 < 3 ; ++d0 )
@@ -63,32 +63,29 @@ struct ParticleInitFunc
6363};
6464
6565// ---------------------------------------------------------------------------//
66- void freeFall ( const double cell_size,
67- const int ppc,
68- const int halo_size,
69- const double delta_t ,
70- const double t_final,
71- const int write_freq,
66+ void freeFall ( const double cell_size, const int ppc, const int halo_size,
67+ const double delta_t , const double t_final, const int write_freq,
7268 const std::string& device )
7369{
7470 // The dam break domain is in a box on [0,1] in each dimension.
75- Kokkos::Array<double ,6 > global_box = { -0.5 , -0.5 , -0.5 , 0.5 , 0.5 , 0.5 };
71+ Kokkos::Array<double , 6 > global_box = { -0.5 , -0.5 , -0.5 , 0.5 , 0.5 , 0.5 };
7672
7773 // Compute the number of cells in each direction. The user input must
7874 // squarely divide the domain.
79- std::array<int ,3 > global_num_cell = { static_cast <int >(1.0 / cell_size),
80- static_cast <int >(1.0 / cell_size),
81- static_cast <int >(1.0 / cell_size) };
75+ std::array<int , 3 > global_num_cell = {
76+ static_cast <int >( 1.0 / cell_size ),
77+ static_cast <int >( 1.0 / cell_size ),
78+ static_cast <int >( 1.0 / cell_size ) };
8279
8380 // This will look like a 2D problem so make the Y direction periodic.
84- std::array<bool ,3 > periodic = { true , true , true };
81+ std::array<bool , 3 > periodic = { true , true , true };
8582
8683 // Due to the 2D nature of the problem we will only partition in Y. The
8784 // behavior of the fluid will be to largely just run out in X and Z with
8885 // little movement in Y.
8986 int comm_size;
9087 MPI_Comm_size ( MPI_COMM_WORLD, &comm_size );
91- std::array<int ,3 > ranks_per_dim = { 1 , comm_size, 1 };
88+ std::array<int , 3 > ranks_per_dim = { 1 , comm_size, 1 };
9289 Cajita::ManualPartitioner partitioner ( ranks_per_dim );
9390
9491 // Material properties.
@@ -110,23 +107,10 @@ void freeFall( const double cell_size,
110107 bc.boundary [5 ] = ExaMPM::BoundaryType::NONE;
111108
112109 // Solve the problem.
113- auto solver =
114- ExaMPM::createSolver ( device,
115- MPI_COMM_WORLD,
116- global_box,
117- global_num_cell,
118- periodic,
119- partitioner,
120- halo_size,
121- ParticleInitFunc (cell_size,ppc,density),
122- ppc,
123- bulk_modulus,
124- density,
125- gamma,
126- kappa,
127- delta_t ,
128- gravity,
129- bc );
110+ auto solver = ExaMPM::createSolver (
111+ device, MPI_COMM_WORLD, global_box, global_num_cell, periodic,
112+ partitioner, halo_size, ParticleInitFunc ( cell_size, ppc, density ),
113+ ppc, bulk_modulus, density, gamma, kappa, delta_t , gravity, bc );
130114 solver->solve ( t_final, write_freq );
131115}
132116
@@ -166,7 +150,6 @@ int main( int argc, char* argv[] )
166150 MPI_Finalize ();
167151
168152 return 0 ;
169-
170153}
171154
172155// ---------------------------------------------------------------------------//
0 commit comments