cholla
grav3D.h
1 #ifndef GRAV3D_H
2 #define GRAV3D_H
3 
4 #include<stdio.h>
5 #include"../global.h"
6 
7 #ifdef PFFT
8 #include"potential_PFFT_3D.h"
9 #endif
10 
11 #ifdef CUFFT
12 #include"potential_CUFFT_3D.h"
13 #endif
14 
15 #ifdef SOR
16 #include"potential_SOR_3D.h"
17 #endif
18 
19 
20 #ifdef HDF5
21 #include<hdf5.h>
22 #endif
23 
24 
27 class Grav3D
28 {
29  public:
30 
31  Real Lbox_x;
32  Real Lbox_y;
33  Real Lbox_z;
34 
35  Real xMin;
36  Real yMin;
37  Real zMin;
40  int nx_total;
43  int ny_total;
46  int nz_total;
47 
50  int nx_local;
53  int ny_local;
56  int nz_local;
57 
60  Real dx;
63  Real dy;
66  Real dz;
67 
68  #ifdef COSMOLOGY
69  Real current_a;
70  #endif
71 
72  Real dens_avrg ;
73 
74 
75  int n_cells;
76  int n_cells_potential;
77 
78 
79  bool INITIAL;
80 
81  Real dt_prev;
82  Real dt_now;
83 
84  Real Gconst;
85 
86  bool TRANSFER_POTENTIAL_BOUNDARIES;
87 
88  #ifdef PFFT
89  Potential_PFFT_3D Poisson_solver;
90  #endif
91 
92  #ifdef CUFFT
93  Potential_CUFFT_3D Poisson_solver;
94  #endif
95 
96  #ifdef SOR
97  Potential_SOR_3D Poisson_solver;
98  #endif
99 
100 
101  struct Fields
102  {
105  Real *density_h;
106 
109  Real *potential_h;
110 
113  Real *potential_1_h;
114 
115  } F;
116 
119  Grav3D(void);
120 
123  void Initialize( Real x_min, Real y_min, Real z_min, Real Lx, Real Ly, Real Lz, int nx_total, int ny_total, int nz_total, int nx_real, int ny_real, int nz_real, Real dx_real, Real dy_real, Real dz_real, int n_ghost_pot_offset, struct parameters *P);
124 
125  void AllocateMemory_CPU(void);
126  void Initialize_values_CPU();
127  void FreeMemory_CPU(void);
128 
129  Real Get_Average_Density( );
130  Real Get_Average_Density_function( int g_start, int g_end );
131 
132 
133 };
134 
135 
136 
137 
138 
139 
140 
141 
142 
143 
144 
145 
146 
147 
148 
149 
150 
151 
152 #endif //GRAV3D_H
int nx_local
Local number of cells in the x-dimension.
Definition: grav3D.h:50
Definition: grav3D.h:101
void Initialize(Real x_min, Real y_min, Real z_min, Real Lx, Real Ly, Real Lz, int nx_total, int ny_total, int nz_total, int nx_real, int ny_real, int nz_real, Real dx_real, Real dy_real, Real dz_real, int n_ghost_pot_offset, struct parameters *P)
Initialize the grid.
Definition: global.h:154
Real dz
z-width of cells
Definition: grav3D.h:66
Real dy
y-width of cells
Definition: grav3D.h:63
Grav3D(void)
Constructor for the gravity class.
Definition: grav3D.h:27
int ny_local
Local number of cells in the y-dimension.
Definition: grav3D.h:53
Real * potential_h
Array containing the gravitational potential of each cell in the grid.
Definition: grav3D.h:109
Real dx
x-width of cells
Definition: grav3D.h:60
int nz_local
Local number of cells in the z-dimension.
Definition: grav3D.h:56