22#include "Vector/vector_dist_subset.hpp"
23#include "DCPSE/DCPSE_op/DCPSE_surface_op.hpp"
25#include "util/SphericalHarmonics.hpp"
34constexpr int NORMAL=4;
35constexpr int PCOORD=5;
41int 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);
145 SurfaceDerivative_xx<NORMAL> Sdxx{
particles,ord,rCut,grid_spacing_surf};
146 SurfaceDerivative_yy<NORMAL> Sdyy{
particles,ord,rCut,grid_spacing_surf};
147 SurfaceDerivative_zz<NORMAL> Sdzz{
particles,ord,rCut,grid_spacing_surf};
151 f=(Sdxx(Af)+Sdyy(Af)+Sdzz(Af));
157 double MaxError=0,L2=0;
158 for (
int j = 0; j < bulkIds.size(); j++) {
159 auto p = bulkIds.get<0>(j);
179 std::cout.precision(16);
181 std::cout<<
"L2:"<<L2/double(sqrt(n_sp))<<std::endl;
182 std::cout<<
"L_inf:"<<MaxError<<std::endl;
194 if (v_cl.rank() == 0){
195 std::cout <<
"DCPSE Construction took: " << DCtcpu/v_cl.size() <<
" s (CPU) - " << DCtwall/v_cl.size() <<
" s (wall)\n";
196 std::cout <<
"DCPSE Evaluation took: " << Dtcpu/v_cl.size() <<
" s (CPU) - " << Dtwall/v_cl.size() <<
" s (wall)\n";
197 std::cout <<
"Total DCPSE time: " << tcpu/v_cl.size() <<
" s (CPU) - " << twall/v_cl.size() <<
" s (wall)\n";
198 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.
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.
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.
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...