Dendro  5.01
Dendro in Greek language means tree. The Dendro library is a large scale (262K cores on ORNL's Titan) distributed memory adaptive octree framework. The main goal of Dendro is to perform large scale multiphysics simulations efficeiently in mordern supercomputers. Dendro consists of efficient parallel data structures and algorithms to perform variational ( finite element) methods and finite difference mthods on 2:1 balanced arbitary adaptive octrees which enables the users to perform simulations raning from black holes (binary black hole mergers) to blood flow in human body, where applications ranging from relativity, astrophysics to biomedical engineering.
nlsmUtils.h
1 //
2 // Created by milinda on 7/25/17.
10 #ifndef SFCSORTBENCH_GRUTILS_H
11 #define SFCSORTBENCH_GRUTILS_H
12 
13 #include "point.h"
14 #include "parameters.h"
15 #include "mesh.h"
16 #include "block.h"
17 #include "parUtils.h"
18 #include "json.hpp"
19 #include "dendroProfileParams.h"
20 #include "profile_params.h"
21 
22 
23 #define Rx (nlsm::NLSM_COMPD_MAX[0]-nlsm::NLSM_COMPD_MIN[0])
24 #define Ry (nlsm::NLSM_COMPD_MAX[1]-nlsm::NLSM_COMPD_MIN[1])
25 #define Rz (nlsm::NLSM_COMPD_MAX[2]-nlsm::NLSM_COMPD_MIN[2])
26 
27 #define RgX (nlsm::NLSM_OCTREE_MAX[0]-nlsm::NLSM_OCTREE_MIN[0])
28 #define RgY (nlsm::NLSM_OCTREE_MAX[1]-nlsm::NLSM_OCTREE_MIN[1])
29 #define RgZ (nlsm::NLSM_OCTREE_MAX[2]-nlsm::NLSM_OCTREE_MIN[2])
30 
31 #define GRIDX_TO_X(xg) (((Rx/RgX)*(xg-nlsm::NLSM_OCTREE_MIN[0]))+nlsm::NLSM_COMPD_MIN[0])
32 #define GRIDY_TO_Y(yg) (((Ry/RgY)*(yg-nlsm::NLSM_OCTREE_MIN[1]))+nlsm::NLSM_COMPD_MIN[1])
33 #define GRIDZ_TO_Z(zg) (((Rz/RgZ)*(zg-nlsm::NLSM_OCTREE_MIN[2]))+nlsm::NLSM_COMPD_MIN[2])
34 
35 #define X_TO_GRIDX(xc) (((RgX/Rx)*(xc-nlsm::NLSM_COMPD_MIN[0]))+nlsm::NLSM_OCTREE_MIN[0])
36 #define Y_TO_GRIDY(yc) (((RgY/Ry)*(yc-nlsm::NLSM_COMPD_MIN[1]))+nlsm::NLSM_OCTREE_MIN[1])
37 #define Z_TO_GRIDZ(zc) (((RgZ/Rz)*(zc-nlsm::NLSM_COMPD_MIN[2]))+nlsm::NLSM_OCTREE_MIN[2])
38 
39 
40 using json = nlohmann::json;
41 namespace nlsm
42 {
46 enum VAR {U_CHI=0,U_PHI};
47 
48 static const char * NLSM_VAR_NAMES[]={"U_CHI","U_PHI"};
49 
60  void readParamFile(const char * fName,MPI_Comm comm);
61 
62 
70  // Initial data
71  void initData(const double xx1,const double yy1,const double zz1, double *var);
72 
77  void analyticalSol(const double xx1,const double yy1,const double zz1,const double t, double *var);
78 
84  void blockAdaptiveOctree(std::vector<ot::TreeNode>& tmpNodes,const Point& pt_min,const Point & pt_max,const unsigned int regLev,const unsigned int maxDepth,MPI_Comm comm);
85 
89  double computeWTol(double x,double y,double z,double tol_min);
90 
91 }// end of namespace nlsm
92 
93 
94 
95 namespace nlsm
96 {
97 
98  namespace timer
99  {
100 
102  void initFlops();
103 
105  void resetSnapshot();
106 
107 
112  template<typename T>
113  void computeOverallStats(T *stat, T *stat_g, MPI_Comm comm)
114  {
115  int rank,npes;
116  MPI_Comm_size(comm,&npes);
117  MPI_Comm_rank(comm,&rank);
118 
119  par::Mpi_Reduce(stat,stat_g,1,MPI_MIN,0,comm);
120  par::Mpi_Reduce(stat,stat_g+1,1,MPI_SUM,0,comm);
121  par::Mpi_Reduce(stat,stat_g+2,1,MPI_MAX,0,comm);
122  stat_g[1]/=(npes);
123 
124  }
125 
126 
128  void profileInfo(const char* filePrefix,const ot::Mesh* pMesh);
129 
131  void profileInfoIntermediate(const char* filePrefix,const ot::Mesh* pMesh,const unsigned int currentStep);
132 
133 
134  }
135 
136 
137 }
138 
139 #endif //SFCSORTBENCH_GRUTILS_H
int Mpi_Reduce(T *sendbuf, T *recvbuf, int count, MPI_Op op, int root, MPI_Comm comm)
a class to store JSON values
Definition: json.hpp:85
void readParamFile(const char *fName, MPI_Comm comm)
internal variables needed for rk update.
Definition: nlsmUtils.cpp:15
This file contains all the parameters related to NLSM simulation.
Definition: nlsm.py:1
Definition: mesh.h:179
basic_json<> json
default JSON class
Definition: json.hpp:109
void blockAdaptiveOctree(std::vector< ot::TreeNode > &tmpNodes, const Point &pt_min, const Point &pt_max, const unsigned int regLev, const unsigned int maxDepth, MPI_Comm comm)
: Generates block adaptive octree for the given binary blockhole problem.
Definition: nlsmUtils.cpp:445
A point class.
Definition: point.h:36
A set of parallel utilities.
double computeWTol(double x, double y, double z, double tol_min)
wavelet tolerance as a function of space.
Definition: nlsmUtils.cpp:496
void initData(const double xx1, const double yy1, const double zz1, double *var)
Initialize all the variables for a given point in space.
Definition: nlsmUtils.cpp:233
void analyticalSol(const double xx1, const double yy1, const double zz1, const double t, double *var)
Definition: nlsmUtils.cpp:363
VAR
These variable indexes are based on the variables defined in rkNLSM.h.
Definition: nlsmUtils.h:46