Skip to content

Commit f32ef99

Browse files
author
Martin D. Weinberg
committed
Update genslab for variable length slab dimensions
1 parent 5330034 commit f32ef99

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

utils/ICs/genslab.cc

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ main(int argc, char **argv)
4646
{
4747
unsigned int seed;
4848
int Ntable, Number;
49-
double Dratio, Hratio, R, Hmax, DispX, DispZ, fJ;
49+
double Dratio, Hratio, R, Hmax, DispX, DispZ, fJ, Lx, Ly;
5050
std::string outfile, config, modfile, modelType;
5151
bool Mu;
5252

@@ -72,6 +72,10 @@ main(int argc, char **argv)
7272
cxxopts::value<double>(R)->default_value("1.0"))
7373
("H,hmax", "Maximum vertical size in scale heights",
7474
cxxopts::value<double>(Hmax)->default_value("10.0"))
75+
("x,Lx", "Slab length in the x-direction",
76+
cxxopts::value<double>(Lx)->default_value("1.0"))
77+
("y,Ly", "Slab length in the y-direction",
78+
cxxopts::value<double>(Ly)->default_value("1.0"))
7579
("X,DispX", "In-plane velocity variance",
7680
cxxopts::value<double>(DispX)->default_value("1.0"))
7781
("F,fJ", "Ratio of Jeans length to box scale",
@@ -90,6 +94,8 @@ main(int argc, char **argv)
9094

9195
cxxopts::ParseResult vm;
9296

97+
// Parse the command line
98+
//
9399
try {
94100
vm = options.parse(argc, argv);
95101
} catch (cxxopts::OptionException& e) {
@@ -112,7 +118,6 @@ main(int argc, char **argv)
112118
out.precision(6);
113119
out.setf(ios::scientific);
114120

115-
//
116121
// Define model
117122
//
118123
double h = 1.0;
@@ -143,10 +148,8 @@ main(int argc, char **argv)
143148
exit(-1);
144149
}
145150

146-
//
147151
// Jeans' length for selecting scale height
148152
//
149-
150153
double maxZ = model->get_max_radius();
151154
double mu = model->get_mass(maxZ);
152155
double KJ = 2.0*M_PI*mu/DispX;
@@ -163,10 +166,8 @@ main(int argc, char **argv)
163166

164167
cout.fill(prev);
165168

166-
//
167169
// Make mass table
168170
//
169-
170171
std::vector<double> Z(Ntable);
171172
std::vector<double> M(Ntable);
172173
double z, dz = 2.0*maxZ/(Ntable-1.0);
@@ -192,7 +193,7 @@ main(int argc, char **argv)
192193

193194
for (int n=0; n<Number; n++) {
194195

195-
double pos[] = {Unit(gen), Unit(gen), odd2(Unit(gen)*M.back(), M, Z)};
196+
double pos[] = {Lx*Unit(gen), Ly*Unit(gen), odd2(Unit(gen)*M.back(), M, Z)};
196197
double vel[] = {Vh(gen), Vh(gen), Vv(gen)};
197198

198199
KE += vel[2]*vel[2];

0 commit comments

Comments
 (0)