22 #include "Vector/vector_dist_subset.hpp"
23 #include "DCPSE/DCPSE_op/DCPSE_surface_op.hpp"
25 #include "util/SphericalHarmonics.hpp"
32 constexpr
int ANADF=2;
34 constexpr
int NORMAL=4;
35 constexpr
int PCOORD=5;
41 int main(
int argc,
char * argv[]) {
42 openfpm_init(&argc,&argv);
43 auto & v_cl = create_vcluster();
48 double grid_spacing_surf;
55 std::cout <<
"Warning: The executable requires the following arguments: number_grid_points orderOfConv" << std::endl;
58 n = std::stoi(argv[1]);
59 unsigned int ord=std::stoi(argv[2]);
64 p_output =
"particles";
67 double boxP1{-1.5}, boxP2{1.5};
68 double boxSize{boxP2 - boxP1};
69 size_t sz[3] = {n,n,n};
70 double grid_spacing{0.8/((std::pow(sz[0],1/3.0)-1))};
71 double Golden_angle=M_PI * (3.0 - sqrt(5.0));
72 grid_spacing_surf=grid_spacing;
73 rCut=2.9 * grid_spacing_surf;
75 Box<3,double> domain{{boxP1,boxP1,boxP1},{boxP2,boxP2,boxP2}};
76 size_t bc[3] = {NON_PERIODIC,NON_PERIODIC,NON_PERIODIC};
86 if (v_cl.rank() == 0) {
87 for(
int i=1;i<n_sp;i++)
89 double y = 1.0 - (i /double(n_sp - 1.0)) * 2.0;
90 double radius = sqrt(1 - y * y);
91 double Golden_theta = Golden_angle * i;
92 double x = cos(Golden_theta) * radius;
93 double z = sin(Golden_theta) * radius;
98 double rm=sqrt(x*x+y*y+z*z);
107 std::cout <<
"n: " << n <<
" - rCut: " << rCut <<
" nSpacing" << grid_spacing_surf<<std::endl;
115 auto &bulkIds=particles_bulk.getIds();
116 auto &bdrIds=particles_boundary.getIds();
117 std::unordered_map<const lm,double,key_hash,key_equal> Alm;
120 for(
int l=0;l<=K;l++){
121 for(
int m=-l;m<=l;m++){
122 Alm[std::make_tuple(l,m)]=0;
126 Alm[std::make_tuple(K,0)]=1;
131 while (it2.isNext()) {
134 particles.
getProp<ANADF>(p)=openfpm::math::sumY_Scalar<K>(xP[0],xP[1],xP[2],Alm);
135 particles.
getProp<DF>(p)=-(K)*(K+1)*openfpm::math::sumY_Scalar<K>(xP[0],xP[1],xP[2],Alm);
146 auto verletList =
particles.template getVerlet<VL_NON_SYMMETRIC|VL_SKIP_REF_PART>(rCut);
147 SurfaceDerivative_xx<NORMAL,decltype(verletList)> Sdxx{
particles,verletList,ord,rCut,grid_spacing_surf,rCut/grid_spacing_surf};
148 SurfaceDerivative_yy<NORMAL,decltype(verletList)> Sdyy{
particles,verletList,ord,rCut,grid_spacing_surf,rCut/grid_spacing_surf};
149 SurfaceDerivative_zz<NORMAL,decltype(verletList)> Sdzz{
particles,verletList,ord,rCut,grid_spacing_surf,rCut/grid_spacing_surf};
153 f=(Sdxx(Af)+Sdyy(Af)+Sdzz(Af));
159 double MaxError=0,L2=0;
160 for (
int j = 0; j < bulkIds.size(); j++) {
161 auto p = bulkIds.get<0>(j);
181 std::cout.precision(16);
183 std::cout<<
"L2:"<<L2/double(sqrt(n_sp))<<std::endl;
184 std::cout<<
"L_inf:"<<MaxError<<std::endl;
197 if (v_cl.rank() == 0){
198 std::cout <<
"DCPSE Construction took: " << DCtcpu/v_cl.size() <<
" s (CPU) - " << DCtwall/v_cl.size() <<
" s (wall)\n";
199 std::cout <<
"DCPSE Evaluation took: " << Dtcpu/v_cl.size() <<
" s (CPU) - " << Dtwall/v_cl.size() <<
" s (wall)\n";
200 std::cout <<
"Total DCPSE time: " << tcpu/v_cl.size() <<
" s (CPU) - " << twall/v_cl.size() <<
" s (wall)\n";
201 std::cout <<
"Entire Simulation took: " << Ftcpu/v_cl.size() <<
" s (CPU) - " << Ftwall/v_cl.size() <<
" s (wall)\n";
Header file containing functions for creating files and folders.
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.
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.
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...