Karamelo  714599e9
Parallel Material Point Method Simulator
grid.h
1 /* -*- c++ -*- ----------------------------------------------------------
2  *
3  * *** Karamelo ***
4  * Parallel Material Point Method Simulator
5  *
6  * Copyright (2019) Alban de Vaucorbeil, alban.devaucorbeil@monash.edu
7  * Materials Science and Engineering, Monash University
8  * Clayton VIC 3800, Australia
9 
10  * This software is distributed under the GNU General Public License.
11  *
12  * ----------------------------------------------------------------------- */
13 
14 #ifndef MPM_GRID_H
15 #define MPM_GRID_H
16 
17 #include "pointers.h"
18 #include "grid.h"
19 #include "grid.h"
20 #include <vector>
21 #include <Eigen/Eigen>
22 #include <map>
23 #include <array>
24 
25 using namespace Eigen;
26 
38 struct Point {
39  int owner;
40  tagint tag;
41  double x[3];
42  int ntype[3];
43 };
44 
45 
54 class Grid : protected Pointers {
55  public:
56  int ncells;
57  bigint nnodes;
58  bigint nnodes_local;
59  bigint nnodes_ghost;
60  vector<tagint> ntag;
61  map<int, int> map_ntag;
62 
63  int nx;
64  int ny;
65  int nz;
66 
67  int nx_global;
68  int ny_global;
69  int nz_global;
70 
71  int nshared;
72  vector<tagint> shared;
73  map<int, vector<tagint>> dest_nshared;
74  map<int, vector<tagint>> origin_nshared;
75 
76  vector<int> nowner;
77 
78  double cellsize;
79 
80  vector<Eigen::Vector3d> x;
81  vector<Eigen::Vector3d> x0;
82  vector<Eigen::Vector3d> v;
83  vector<Eigen::Vector3d> v_update;
84  vector<Eigen::Vector3d> mb;
85  vector<Eigen::Vector3d> f;
86 
87  vector<double> mass;
88  vector<int> mask;
89  vector<bool> rigid;
90  vector<array<int, 3>> ntype;
91 
92  vector<double> pH;
93 
94  MPI_Datatype Pointtype;
95 
96  Grid(class MPM *);
97  virtual ~Grid();
98  void grow(int);
99  void grow_ghosts(int);
100  void setup(string);
101  void init(double*, double*);
102 
103  void reduce_mass_ghost_nodes();
104  void reduce_mass_ghost_nodes_old();
105  void reduce_ghost_nodes(bool only_v = false);
106  void reduce_ghost_nodes_old(bool only_v = false);
107  void update_grid_velocities();
108  void update_grid_positions();
109  void reduce_regularized_variables();
110 };
111 
112 #endif
map< int, vector< tagint > > origin_nshared
for each CPU, list the tags of ghost nodes
Definition: grid.h:74
vector< int > mask
nodes&#39; group mask
Definition: grid.h:88
vector< Eigen::Vector3d > x
nodes&#39; current position
Definition: grid.h:80
vector< Eigen::Vector3d > mb
nodes&#39; external forces times the mass
Definition: grid.h:84
tagint tag
Unique identification number of the point.
Definition: grid.h:40
vector< int > nowner
which CPU owns each node (universe->me for local nodes, other CPU for ghost nodes ...
Definition: grid.h:76
vector< tagint > ntag
unique identifier for nodes in the system.
Definition: grid.h:60
int owner
ID of the CPU who created the point.
Definition: grid.h:39
vector< Eigen::Vector3d > f
nodes&#39; internal forces
Definition: grid.h:85
double cellsize
size of the square cells forming the grid
Definition: grid.h:78
vector< array< int, 3 > > ntype
node type in x, y, and z directions (False for an edge, True otherwise)
Definition: grid.h:90
int ny
number of nodes along y on this CPU
Definition: grid.h:64
Definition: mpm.h:29
Definition: grid.h:54
int nshared
number of nodes that are shared (ghosts in other CPUs)
Definition: grid.h:71
vector< bool > rigid
are the nodes in the area of influence of a rigid body?
Definition: grid.h:89
map< int, vector< tagint > > dest_nshared
for each CPU, list the tags of shared nodes
Definition: grid.h:73
bigint nnodes_local
number of nodes (in this CPU)
Definition: grid.h:58
vector< double > mass
nodes&#39; current mass
Definition: grid.h:87
vector< Eigen::Vector3d > v_update
nodes&#39; velocity at time t+dt
Definition: grid.h:83
vector< Eigen::Vector3d > v
nodes&#39; velocity at time t
Definition: grid.h:82
vector< Eigen::Vector3d > x0
nodes&#39; position in the reference coordinate system
Definition: grid.h:81
vector< tagint > shared
tag of all shared nodes
Definition: grid.h:72
int ncells
number of cells
Definition: grid.h:56
int ny_global
number of nodes along y on all CPUs
Definition: grid.h:68
MPI_Datatype Pointtype
MPI type for struct Point.
Definition: grid.h:94
bigint nnodes_ghost
number of ghost nodes (in this CPU)
Definition: grid.h:59
Definition: grid.h:38
Definition: pointers.h:29
bigint nnodes
total number of nodes in the domain
Definition: grid.h:57
int nx
number of nodes along x on this CPU
Definition: grid.h:63
int nz_global
number of nodes along z on all CPUs
Definition: grid.h:69
int nx_global
number of nodes along x on all CPUs
Definition: grid.h:67
int nz
number of nodes along z on this CPU
Definition: grid.h:65
map< int, int > map_ntag
map_ntag[ntag[i]] = i;
Definition: grid.h:61