@@ -27,9 +27,16 @@ int main (int argc, char* argv[])
27
27
// **********************************
28
28
29
29
// number of cells on each side of the domain
30
- int n_cell;
30
+ int n_cell_x;
31
+ int n_cell_y;
32
+ int n_cell_z;
31
33
32
- // size of each box (or grid)
34
+ // dimensions of each box (or grid)
35
+ Real prob_hi_x;
36
+ Real prob_hi_y;
37
+ Real prob_hi_z;
38
+
39
+ // This is the largest size a grid can be
33
40
int max_grid_size;
34
41
35
42
// **********************************
@@ -42,9 +49,16 @@ int main (int argc, char* argv[])
42
49
// pp.query means we optionally need the inputs file to have it - but we must supply a default here
43
50
ParmParse pp;
44
51
45
- // We need to get n_cell from the inputs file - this is the number of cells on each side of
46
- // a square (or cubic) domain.
47
- pp.get (" n_cell" ,n_cell);
52
+ // We need to get n_cell_ from the inputs file - this is the number of cells on each side of
53
+ // a rectangular domain.
54
+ pp.get (" n_cell_x" ,n_cell_x);
55
+ pp.get (" n_cell_y" ,n_cell_y);
56
+ pp.get (" n_cell_z" ,n_cell_z);
57
+
58
+ // We need to get prob_hi_x/y/z from the inputs file - this is the physical dimensions of the domain
59
+ pp.get (" prob_hi_x" ,prob_hi_x);
60
+ pp.get (" prob_hi_y" ,prob_hi_y);
61
+ pp.get (" prob_hi_z" ,prob_hi_z);
48
62
49
63
// The domain is broken into boxes of size max_grid_size
50
64
pp.get (" max_grid_size" ,max_grid_size);
@@ -53,7 +67,6 @@ int main (int argc, char* argv[])
53
67
// **********************************
54
68
// DEFINE SIMULATION SETUP AND GEOMETRY
55
69
// **********************************
56
-
57
70
// make BoxArray and Geometry
58
71
// ba will contain a list of boxes that cover the domain
59
72
// geom contains information such as the physical domain size,
@@ -63,7 +76,7 @@ int main (int argc, char* argv[])
63
76
64
77
// define lower and upper indices
65
78
IntVect dom_lo (AMREX_D_DECL ( 0 , 0 , 0 ));
66
- IntVect dom_hi (AMREX_D_DECL (n_cell -1 , n_cell -1 , n_cell -1 ));
79
+ IntVect dom_hi (AMREX_D_DECL (n_cell_x -1 , n_cell_y -1 , n_cell_z -1 ));
67
80
68
81
// Make a single box that is the entire domain
69
82
Box domain (dom_lo, dom_hi);
@@ -77,9 +90,9 @@ int main (int argc, char* argv[])
77
90
// How Boxes are distrubuted among MPI processes
78
91
DistributionMapping dm (ba);
79
92
80
- // This defines the physical box, [0,1] in each direction.
93
+ // This defines the physical box size in each direction
81
94
RealBox real_box ({ AMREX_D_DECL (0 ., 0 ., 0 .)},
82
- { AMREX_D_DECL (1 ., 1 ., 1 . )} );
95
+ { AMREX_D_DECL (prob_hi_x, prob_hi_y, prob_hi_z )} );
83
96
84
97
// periodic in all direction
85
98
Array<int ,AMREX_SPACEDIM> is_periodic{AMREX_D_DECL (1 ,1 ,1 )};
@@ -118,9 +131,9 @@ int main (int argc, char* argv[])
118
131
Real x = (i+0.5 ) * dx[0 ];
119
132
Real y = (j+0.5 ) * dx[1 ];
120
133
Real z = (AMREX_SPACEDIM==3 ) ? (k+0.5 ) * dx[2 ] : 0 .;
121
- phi_ptr (i,j,k) = std::sin (2 *M_PI*x + omega)*std::sin (2 *M_PI*y + omega);
134
+ phi_ptr (i,j,k) = std::sin (4 *M_PI*x/prob_hi_x + omega)*std::sin (124 *M_PI*y/prob_hi_y + omega);
122
135
if (AMREX_SPACEDIM == 3 ) {
123
- phi_ptr *= std::sin (2 *M_PI*z + omega);
136
+ phi_ptr (i,j,k) *= std::sin (2 *M_PI*z/prob_hi_z + omega);
124
137
}
125
138
});
126
139
}
0 commit comments