@@ -13,24 +13,28 @@ int main(int argc, char* argv[]) {
13
13
MPI_Init_thread (&argc, &argv, MPI_THREAD_SERIALIZED, &provided);
14
14
log_set_ranks (MPI_COMM_WORLD);
15
15
if (provided < MPI_THREAD_SERIALIZED) {
16
- log_printf (ERROR, " Not enough thread support level in the MPI library" );
16
+ log_printf (ERROR, " Not enough thread support level in the MPI library" );
17
17
}
18
18
#endif
19
-
19
+
20
20
int arg_index = 0 ;
21
21
std::string msg_string;
22
22
while (arg_index < argc) {
23
23
msg_string += argv[arg_index];
24
24
msg_string += " " ;
25
25
arg_index++;
26
26
}
27
-
27
+
28
28
RuntimeParameters runtime;
29
29
runtime.setRuntimeParameters (argc, argv);
30
-
30
+
31
+ /* Exit early if only asked to display help message */
32
+ if (runtime._print_usage )
33
+ return 0 ;
34
+
31
35
/* stuck here for debug tools to attach */
32
36
while (runtime._debug_flag ) ;
33
-
37
+
34
38
/* Define simulation parameters */
35
39
#ifdef OPENMP
36
40
int num_threads = runtime._num_threads ;
@@ -57,25 +61,25 @@ int main(int argc, char* argv[]) {
57
61
log_printf (ERROR, " No geometry file is provided" );
58
62
geometry->loadFromFile (runtime._geo_filename );
59
63
#ifdef MPIx
60
- geometry->setDomainDecomposition (runtime._NDx , runtime._NDy , runtime._NDz ,
61
- MPI_COMM_WORLD);
64
+ geometry->setDomainDecomposition (runtime._NDx , runtime._NDy , runtime._NDz ,
65
+ MPI_COMM_WORLD);
62
66
#endif
63
67
geometry->setNumDomainModules (runtime._NMx , runtime._NMy , runtime._NMz );
64
68
65
69
if ((runtime._NCx >0 && runtime._NCy > 0 && runtime._NCz > 0 ) ||
66
70
(!runtime._cell_widths_x .empty () && !runtime._cell_widths_y .empty () &&
67
71
!runtime._cell_widths_z .empty ())) {
68
-
72
+
69
73
/* Create CMFD mesh */
70
74
log_printf (NORMAL, " Creating CMFD mesh..." );
71
75
Cmfd* cmfd = new Cmfd ();
72
76
cmfd->setSORRelaxationFactor (runtime._SOR_factor );
73
77
cmfd->setCMFDRelaxationFactor (runtime._CMFD_relaxation_factor );
74
78
if (runtime._cell_widths_x .empty () || runtime._cell_widths_y .empty () ||
75
- runtime._cell_widths_z .empty ())
79
+ runtime._cell_widths_z .empty ())
76
80
cmfd->setLatticeStructure (runtime._NCx , runtime._NCy , runtime._NCz );
77
81
else {
78
- std::vector< std::vector<double > > cmfd_widths{runtime._cell_widths_x ,
82
+ std::vector< std::vector<double > > cmfd_widths{runtime._cell_widths_x ,
79
83
runtime._cell_widths_y , runtime._cell_widths_z };
80
84
cmfd->setWidths (cmfd_widths);
81
85
}
@@ -84,7 +88,7 @@ int main(int argc, char* argv[]) {
84
88
cmfd->setKNearest (runtime._knearest );
85
89
cmfd->setCentroidUpdateOn (runtime._CMFD_centroid_update_on );
86
90
cmfd->useAxialInterpolation (runtime._use_axial_interpolation );
87
-
91
+
88
92
geometry->setCmfd (cmfd);
89
93
}
90
94
@@ -103,7 +107,7 @@ int main(int argc, char* argv[]) {
103
107
104
108
quad->setNumAzimAngles (runtime._num_azim );
105
109
quad->setNumPolarAngles (runtime._num_polar );
106
- TrackGenerator3D track_generator (geometry, runtime._num_azim ,
110
+ TrackGenerator3D track_generator (geometry, runtime._num_azim ,
107
111
runtime._num_polar , runtime._azim_spacing ,
108
112
runtime._polar_spacing );
109
113
track_generator.setNumThreads (num_threads);
@@ -124,7 +128,7 @@ int main(int argc, char* argv[]) {
124
128
solver->setVerboseIterationReport ();
125
129
solver->setNumThreads (num_threads);
126
130
solver->setConvergenceThreshold (runtime._tolerance );
127
- solver->computeEigenvalue (runtime._max_iters ,
131
+ solver->computeEigenvalue (runtime._max_iters ,
128
132
(residualType)runtime._MOC_src_residual_type );
129
133
if (runtime._time_report )
130
134
solver->printTimerReport ();
@@ -135,23 +139,23 @@ int main(int argc, char* argv[]) {
135
139
MPI_Comm_rank (MPI_COMM_WORLD, &my_rank);
136
140
#endif
137
141
std::string rxtype[4 ] = {" FISSION_RX" , " TOTAL_RX" , " ABSORPTION_RX" , " FLUX_RX" };
138
-
142
+
139
143
140
144
for (int m=0 ; m< runtime._output_mesh_lattices .size (); m++) {
141
145
Mesh mesh (solver);
142
- mesh.createLattice (runtime._output_mesh_lattices [m][0 ],
143
- runtime._output_mesh_lattices [m][1 ],
146
+ mesh.createLattice (runtime._output_mesh_lattices [m][0 ],
147
+ runtime._output_mesh_lattices [m][1 ],
144
148
runtime._output_mesh_lattices [m][2 ]);
145
149
Vector3D rx_rates = mesh.getFormattedReactionRates
146
150
((RxType)runtime._output_types [m]);
147
-
151
+
148
152
if (my_rank == 0 ) {
149
- std::cout << " Output " << m << " , reaction type: "
153
+ std::cout << " Output " << m << " , reaction type: "
150
154
<< rxtype[runtime._output_types [m]]
151
155
<< " , lattice: " << runtime._output_mesh_lattices [m][0 ] << " ,"
152
156
<< runtime._output_mesh_lattices [m][1 ] << " ,"
153
157
<< runtime._output_mesh_lattices [m][2 ] << std::endl;
154
- for (int k=0 ; k < rx_rates.at (0 ).at (0 ).size (); k++) {
158
+ for (int k=0 ; k < rx_rates.at (0 ).at (0 ).size (); k++) {
155
159
for (int j=rx_rates.at (0 ).size ()-1 ; j >= 0 ; j--) {
156
160
for (int i=0 ; i < rx_rates.size (); i++) {
157
161
std::cout << rx_rates.at (i).at (j).at (k) << " " ;
@@ -165,17 +169,17 @@ int main(int argc, char* argv[]) {
165
169
for (int m=0 ; m<runtime._non_uniform_mesh_lattices .size (); m++) {
166
170
Mesh mesh (solver);
167
171
Vector3D rx_rates = mesh.getNonUniformFormattedReactionRates
168
- (runtime._non_uniform_mesh_lattices [m],
172
+ (runtime._non_uniform_mesh_lattices [m],
169
173
(RxType)runtime._output_types [m+runtime._output_mesh_lattices .size ()]);
170
174
if (my_rank == 0 ) {
171
- std::cout <<" Output " << m+runtime._output_mesh_lattices .size ()
172
- << " , reaction type: "
175
+ std::cout <<" Output " << m+runtime._output_mesh_lattices .size ()
176
+ << " , reaction type: "
173
177
<< rxtype[runtime._output_types [m+runtime._output_mesh_lattices .size ()]]
174
- << " , lattice: "
178
+ << " , lattice: "
175
179
<< runtime._non_uniform_mesh_lattices [m][0 ].size () << " ,"
176
180
<< runtime._non_uniform_mesh_lattices [m][1 ].size () << " ,"
177
181
<< runtime._non_uniform_mesh_lattices [m][2 ].size () << std::endl;
178
- for (int k=0 ; k < rx_rates.at (0 ).at (0 ).size (); k++) {
182
+ for (int k=0 ; k < rx_rates.at (0 ).at (0 ).size (); k++) {
179
183
for (int j=rx_rates.at (0 ).size ()-1 ; j >= 0 ; j--) {
180
184
for (int i=0 ; i < rx_rates.size (); i++) {
181
185
std::cout << rx_rates.at (i).at (j).at (k) << " " ;
0 commit comments