Commit e571812f authored by incardon's avatar incardon

Fixing benchmark

parent a032842c
......@@ -120,8 +120,9 @@ typedef vector_dist<3,float,aggregate<float[3],float[3],float[3],float[3],float[
float ringr1 = 1.0;
// radius of the core of the torus
float sigma = 1.0/3.523;
// Reynold number
float tgtre = 7500.0;
// Reynold number (If you want to use 7500.0 you have to use a grid 1600x400x400)
//float tgtre = 7500.0;
float tgtre = 10.0;
// Noise factor for the ring vorticity on z
float ringnz = 0.01;
......@@ -131,7 +132,8 @@ float dcgamma = 4.32334181e-01;
float nu = 1.0/tgtre;
// Time step
float dt = 0.025;
// float dt = 0.0025
float dt = 0.0125;
// All the properties by index
constexpr unsigned int vorticity = 0;
......@@ -264,6 +266,14 @@ void init_ring(grid_type & gr, const Box<3,float> & domain)
gr.template get<vorticity>(key_d)[y] = -radstr * cos(theta1);
gr.template get<vorticity>(key_d)[z] = radstr * sin(theta1);
// kill the axis term
float rad1r_ = sqrt((ty-2.5f)*(ty-2.5f) + (tz-2.5f)*(tz-2.5f)) + ringr1*(1.0f + ringnz * noise);
float rad1sqTILDA = rad1sq*rinv2;
radstr = exp(-rad1sq*rinv2)*rinv2*gamma/M_PI;
gr.template get<vorticity>(key_d)[x] = 0.0f;
gr.template get<vorticity>(key_d)[y] = -radstr * cos(theta1);
gr.template get<vorticity>(key_d)[z] = radstr * sin(theta1);
++it;
}
......@@ -1092,8 +1102,8 @@ template<typename vector, typename grid> void check_point_and_save(vector & part
particles.write("part_out_" + std::to_string(i),VTK_WRITER | FORMAT_BINARY);
g_vort.template ghost_get<vorticity>();
g_vel.template ghost_get<velocity>();
g_vel.write("grid_velocity_" + std::to_string(i), VTK_WRITER | FORMAT_BINARY);
g_vort.write("grid_vorticity_" + std::to_string(i), VTK_WRITER | FORMAT_BINARY);
g_vel.write_frame("grid_velocity",i, VTK_WRITER | FORMAT_BINARY);
g_vort.write_frame("grid_vorticity",i, VTK_WRITER | FORMAT_BINARY);
}
// In order to reduce the size of the saved data we apply a threshold.
......@@ -1157,13 +1167,17 @@ int main(int argc, char* argv[])
openfpm_init(&argc,&argv);
{
// Domain, a rectangle
Box<3,float> domain({0.0,0.0,0.0},{22.0,5.57,5.57});
// For the grid 1600x400x400 use
// Box<3,float> domain({0.0,0.0,0.0},{22.0,5.57,5.57});
Box<3,float> domain({0.0,0.0,0.0},{11.0,5.57,5.57});
// Ghost (Not important in this case but required)
Ghost<3,long int> g(2);
// Grid points on x=128 y=64 z=64
long int sz[] = {512,64,64};
// if we use Re = 7500
// long int sz[] = {1600,400,400};
long int sz[] = {128,64,64};
size_t szu[] = {(size_t)sz[0],(size_t)sz[1],(size_t)sz[2]};
periodicity<3> bc = {{PERIODIC,PERIODIC,PERIODIC}};
......
......@@ -105,9 +105,9 @@ int main(int argc, char* argv[])
++it;
}
vd.write("Vector/vector_move_before_map",i,CSV_WRITER);
vd.write_frame("Vector/vector_move_before_map",i,CSV_WRITER);
vd.map();
vd.write("Vector/vector_move",i,CSV_WRITER);
vd.write_frame("Vector/vector_move",i,CSV_WRITER);
}
openfpm_finalize();
......
......@@ -215,9 +215,6 @@ template<unsigned int dim> void cell_list_comp_reorder_hilbert_benchmark(size_t
auto NN = vd.getCellList_hilb(r_cut);
// Initialize SFC (we are only interested in force calculation)
NN.init_SFC();
openfpm::vector<double> measures;
double sum_cl_mean = 0;
......@@ -234,6 +231,9 @@ template<unsigned int dim> void cell_list_comp_reorder_hilbert_benchmark(size_t
double sum_fr_mean = 0;
double sum_fr_dev = 0;
// Initialize SFC (we are only interested in force calculation)
NN.init_SFC();
measures.clear();
for (size_t l = 0 ; l < N_VERLET_TEST; l++)
{measures.add(benchmark_calc_forces_hilb<dim>(NN,vd,r_cut));}
......
......@@ -103,6 +103,11 @@ struct gcl<dim,St,CellList_gen<dim, St, Process_keys_hilb,Mem_type, shift<dim, S
#define CELL_MEMBAL(dim,St) CellList_gen<dim, St, Process_keys_lin, Mem_bal, shift<dim, St> >
#define CELL_MEMMW(dim,St) CellList_gen<dim, St, Process_keys_lin, Mem_mw, shift<dim, St> >
#define CELL_MEMFAST_HILB(dim,St) CellList_gen<dim, St, Process_keys_hilb, Mem_fast, shift<dim, St> >
#define CELL_MEMBAL_HILB(dim,St) CellList_gen<dim, St, Process_keys_hilb, Mem_bal, shift<dim, St> >
#define CELL_MEMMW_HILB(dim,St) CellList_gen<dim, St, Process_keys_hilb, Mem_mw, shift<dim, St> >
/*! \brief Distributed vector
*
* This class reppresent a distributed vector, the distribution of the structure
......@@ -1747,6 +1752,11 @@ public:
dist.setDistTol(md.distributionTol());
}
/*! \brief Save the distributed vector on HDF5 file
*
* \param filename file where to save
*
*/
inline void save(const std::string & filename) const
{
HDF5_writer<VECTOR_DIST> h5s;
......@@ -1754,6 +1764,11 @@ public:
h5s.save(filename,v_pos,v_prp);
}
/*! \brief Load the distributed vector from an HDF5 file
*
* \param filename file from where to load
*
*/
inline void load(const std::string & filename)
{
HDF5_reader<VECTOR_DIST> h5l;
......@@ -1763,8 +1778,9 @@ public:
/*! \brief Output particle position and properties
*
* \param out output
* \param opt VTK_WRITER or CSV_WRITER
* \param out output filename
* \param opt VTK_WRITER, CSV_WRITER, it is also possible to choose the format for VTK
* FORMAT_BINARY. (the default is ASCII format)
*
* \return true if the file has been written without error
*
......@@ -1833,12 +1849,13 @@ public:
*
* \param out output
* \param iteration (we can append the number at the end of the file_name)
* \param opt NO_GHOST or WITH_GHOST
* \param opt VTK_WRITER, CSV_WRITER, it is also possible to choose the format for VTK
* FORMAT_BINARY. (the default is ASCII format)
*
* \return if the file has been written correctly
*
*/
inline bool write(std::string out, size_t iteration, int opt = NO_GHOST)
inline bool write_frame(std::string out, size_t iteration, int opt = VTK_WRITER)
{
if ((opt & 0x0FFF0000) == CSV_WRITER)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment