20 #include "Vector/vector_dist_subset.hpp"
21 #include "Operators/Vector/vector_dist_operators.hpp"
22 #include "DCPSE/DCPSE_op/DCPSE_surface_op.hpp"
29 constexpr
int ANADF=2;
31 constexpr
int NORMAL=4;
37 int main(
int argc,
char * argv[]) {
38 openfpm_init(&argc,&argv);
39 auto & v_cl = create_vcluster();
46 std::cout <<
"Warning: The executable requires the following arguments: number_grid_points" << std::endl;
48 n = 128*std::pow(2,std::stoi(argv[1]));
49 unsigned int ord=std::stoi(argv[2]);
50 double rcfac=std::stof(argv[3]);
52 std::string cwd{boost::filesystem::current_path().string()};
53 std::string output_dir{cwd +
"/output_circle_NoProj"};
56 p_output = output_dir +
"/particles_";
59 double boxP1{-1.5}, boxP2{1.5};
60 double boxSize{boxP2 - boxP1};
62 double grid_spacing{boxSize/(sz[0]-1)};
63 double rCut{(rcfac) * grid_spacing};
66 size_t bc[2] = {NON_PERIODIC,NON_PERIODIC};
76 double dtheta{2*M_PI/double(n)};
77 if (v_cl.rank() == 0) {
78 for (
int i = 0; i < n; ++i) {
79 coord[0] = std::cos(theta);
80 coord[1] = std::sin(theta);
95 std::cout <<
"n: " << n <<
" - grid spacing: " << grid_spacing <<
" - rCut: " << rCut <<
"Dtheta" << dtheta<<std::endl;
107 auto verletList =
particles.template getVerlet<VL_NON_SYMMETRIC|VL_SKIP_REF_PART>(rCut);
108 SurfaceDerivative_xx<NORMAL,decltype(verletList)> Sdxx(
particles, verletList, ord, rCut, grid_spacing, rCut/grid_spacing);
109 SurfaceDerivative_yy<NORMAL,decltype(verletList)> Sdyy(
particles, verletList, ord, rCut, grid_spacing, rCut/grid_spacing);
117 double MaxError=0,L2=0;
133 std::cout.precision(16);
134 std::ofstream norms_file;
136 std::cout<<
"dTheta:"<<dtheta<<std::endl;
137 std::cout<<
"L2:"<<L2/sqrt(
double(n))<<std::endl;
138 std::cout<<
"L_inf:"<<MaxError<<std::endl;
139 norms_file.open(
"Errors/LBCirc_order_" + std::to_string(ord) +
".csv", std::ios_base::app);
140 if (norms_file.is_open() ==
false) {
141 std::cout <<
"ERROR: File is not open.\n";
144 norms_file <<n<<
","<<rcfac<<std::scientific<<
","<<L2/sqrt(
double(n))<<
","<<MaxError<< std::endl;
152 if (v_cl.rank() == 0)
153 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.
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.
size_t size_local() const
return the local size of the vector
bool write_frame(std::string out, size_t iteration, int opt=VTK_WRITER)
Output particle position and properties.
auto getProp(vect_dist_key_dx vec_key) -> decltype(vPrp.template get< id >(vec_key.getKey()))
Get the property of an element.
void setPropNames(const openfpm::vector< std::string > &names)
Set the properties names.
auto getPos(vect_dist_key_dx vec_key) -> decltype(vPos.template get< 0 >(vec_key.getKey()))
Get the position of an element.
vector_dist_iterator getDomainIterator() const
Get an iterator that traverse the particles in the domain.
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 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...