20 #include "Vector/vector_dist_subset.hpp"
21 #include "DCPSE/DCPSE_op/DCPSE_surface_op.hpp"
22 #include "DCPSE/DCPSE_op/DCPSE_Solver.hpp"
23 #include "util/SphericalHarmonics.hpp"
30 constexpr
int ANADF=2;
32 constexpr
int NORMAL=4;
33 constexpr
int PCOORD=5;
39 int main(
int argc,
char * argv[]) {
40 openfpm_init(&argc,&argv);
41 auto & v_cl = create_vcluster();
44 double grid_spacing_surf;
50 std::cout <<
"Error: The executable requires the following arguments: number_grid_points" << std::endl;
56 grid_spacing_surf=std::stof(argv[1]);
57 EIGENVAL=std::stof(argv[2]);
62 std::string cwd{boost::filesystem::current_path().string()};
63 std::string output_dir{cwd +
"/output_Bunny"};
65 p_output = output_dir +
"/particles";
66 double boxP1{-1.5}, boxP2{1.5};
67 double boxSize{boxP2 - boxP1};
68 rCut=2.5 * grid_spacing_surf;
70 Box<3,double> domain{{boxP1,boxP1,boxP1},{boxP2,boxP2,boxP2}};
71 size_t bc[3] = {NON_PERIODIC,NON_PERIODIC,NON_PERIODIC};
77 double Nx,Ny,Nz,Px,Py,Pz;
79 PCfile.open(
"data.csv");
82 while ( PCfile >> Nx >> Ny >> Nz >> Px >> Py >> Pz )
94 std::cout <<
"n: " << pctr <<
" - rCut: " << rCut <<
"nSpacing" << grid_spacing_surf<<std::endl;
103 auto &bulkIds=particles_bulk.getIds();
104 auto &bdrIds=particles_boundary.getIds();
112 auto verletList =
particles.template getVerlet<VL_NON_SYMMETRIC|VL_SKIP_REF_PART>(rCut);
113 SurfaceDerivative_x<NORMAL,decltype(verletList)> Sdx{
particles,verletList,2,rCut,grid_spacing_surf,rCut/grid_spacing_surf};
114 SurfaceDerivative_y<NORMAL,decltype(verletList)> Sdy{
particles,verletList,2,rCut,grid_spacing_surf,rCut/grid_spacing_surf};
115 SurfaceDerivative_z<NORMAL,decltype(verletList)> Sdz{
particles,verletList,2,rCut,grid_spacing_surf,rCut/grid_spacing_surf};
117 SurfaceDerivative_xx<NORMAL,decltype(verletList)> Sdxx{
particles,verletList,2,rCut,grid_spacing_surf,rCut/grid_spacing_surf};
118 SurfaceDerivative_yy<NORMAL,decltype(verletList)> Sdyy{
particles,verletList,2,rCut,grid_spacing_surf,rCut/grid_spacing_surf};
119 SurfaceDerivative_zz<NORMAL,decltype(verletList)> Sdzz{
particles,verletList,2,rCut,grid_spacing_surf,rCut/grid_spacing_surf};
121 DErr=-0.5*(Sdx(N[0])+Sdy(N[1])+Sdz(N[2]));
127 auto Eig = Sdxx(f)+Sdyy(f)+Sdzz(f)-EIGENVAL*f;
128 Solver.impose(Eig, bulkIds, 0);
129 Solver.impose(f, bdrIds, 0.1);
141 if (v_cl.rank() == 0)
142 std::cout <<
"Simulation took: " << tt.
getcputime() <<
" s (CPU) - " << tt.
getwct() <<
" s (wall)\n";
Header file containing functions for creating files and folders.
static void create_directory_if_not_exist(std::string path, bool silent=0)
Creates a directory if not already existent.
This class represent an N-dimensional box.
This class implement the point shape in an N-dimensional space.
Class for cpu time benchmarking.
void stop()
Stop the timer.
double getcputime()
Return the cpu time.
void start()
Start the timer.
double getwct()
Return the elapsed real time.
bool write_frame(std::string out, size_t iteration, int opt=VTK_WRITER)
Output particle position and properties.
void setPropNames(const openfpm::vector< std::string > &names)
Set the properties names.
void ghost_get(size_t opt=WITH_POSITION)
It synchronize the properties and position of the ghost particles.
void map(size_t opt=NONE)
It move all the particles that does not belong to the local processor to the respective processor.
bool write(std::string out, int opt=VTK_WRITER)
Output particle position and properties.
auto getLastProp() -> decltype(vPrp.template get< id >(0))
Get the property of the last element.
void add()
Add local particle.
void ghost_get_subset()
Stub does not do anything.
void deleteGhost()
Delete the particles on the ghost.
auto getLastPos() -> decltype(vPos.template get< 0 >(0))
Get the position of the last element.
[v_transform metafunction]
aggregate of properties, from a list of object if create a struct that follow the OPENFPM native stru...