20#include "Vector/vector_dist_subset.hpp"
21#include "Operators/Vector/vector_dist_operators.hpp"
22#include "DCPSE/DCPSE_op/DCPSE_surface_op.hpp"
31constexpr int NORMAL=4;
37int 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 SurfaceDerivative_xx<NORMAL> Sdxx(
particles, ord, rCut,grid_spacing);
108 SurfaceDerivative_yy<NORMAL> Sdyy(
particles, ord, rCut,grid_spacing);
116 double MaxError=0,L2=0;
132 std::cout.precision(16);
133 std::ofstream norms_file;
135 std::cout<<
"dTheta:"<<dtheta<<std::endl;
136 std::cout<<
"L2:"<<L2/sqrt(
double(n))<<std::endl;
137 std::cout<<
"L_inf:"<<MaxError<<std::endl;
138 norms_file.open(
"Errors/LBCirc_order_" + std::to_string(ord) +
".csv", std::ios_base::app);
139 if (norms_file.is_open() ==
false) {
140 std::cout <<
"ERROR: File is not open.\n";
143 norms_file <<n<<
","<<rcfac<<std::scientific<<
","<<L2/sqrt(
double(n))<<
","<<MaxError<< std::endl;
151 if (v_cl.rank() == 0)
152 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.
Implementation of 1-D std::vector like structure.
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.
vect_dist_key_dx get()
Get the actual key.
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(v_prp.template get< id >(vec_key.getKey()))
Get the property of an element.
auto getLastProp() -> decltype(v_prp.template get< id >(0))
Get the property of the last element.
void setPropNames(const openfpm::vector< std::string > &names)
Set the properties names.
auto getPos(vect_dist_key_dx vec_key) -> decltype(v_pos.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 getLastPos() -> decltype(v_pos.template get< 0 >(0))
Get the position of the last element.
void add()
Add local particle.
void deleteGhost()
Delete the particles on the ghost.
[v_transform metafunction]
aggregate of properties, from a list of object if create a struct that follow the OPENFPM native stru...