Branch data Line data Source code
1 : : // *****************************************************************************
2 : : /*!
3 : : \file src/Control/InciterConfig.hpp
4 : : \copyright 2012-2015 J. Bakosi,
5 : : 2016-2018 Los Alamos National Security, LLC.,
6 : : 2019-2021 Triad National Security, LLC.,
7 : : 2022-2025 J. Bakosi
8 : : All rights reserved. See the LICENSE file for details.
9 : : \brief Inciter confguration (parsed from cmdline and control file)
10 : : */
11 : : // *****************************************************************************
12 : : #pragma once
13 : :
14 : : #include <getopt.h>
15 : :
16 : : #include "TaggedTuple.hpp"
17 : :
18 : : namespace tag {
19 : 266 : DEFTAG( commit );
20 : 266 : DEFTAG( input );
21 : 266 : DEFTAG( control );
22 : 266 : DEFTAG( output );
23 : 266 : DEFTAG( diag );
24 : 266 : DEFTAG( diag_iter );
25 : 266 : DEFTAG( diag_precision );
26 : 266 : DEFTAG( diag_format );
27 : 266 : DEFTAG( checkpoint );
28 : 266 : DEFTAG( quiescence );
29 : 266 : DEFTAG( virt );
30 : 266 : DEFTAG( nonblocking );
31 : 266 : DEFTAG( benchmark );
32 : 266 : DEFTAG( feedback );
33 : 266 : DEFTAG( lbfreq );
34 : 266 : DEFTAG( lbtime );
35 : 266 : DEFTAG( rsfreq );
36 : 266 : DEFTAG( nstep );
37 : 266 : DEFTAG( ttyi );
38 : 266 : DEFTAG( term );
39 : 266 : DEFTAG( cfl );
40 : 266 : DEFTAG( rk );
41 : 266 : DEFTAG( theta );
42 : 266 : DEFTAG( t0 );
43 : 266 : DEFTAG( dt );
44 : 266 : DEFTAG( turkel );
45 : 266 : DEFTAG( soundspeed );
46 : 266 : DEFTAG( velinf );
47 : 266 : DEFTAG( pre_iter );
48 : 266 : DEFTAG( pre_tol );
49 : 266 : DEFTAG( pre_verbose );
50 : 266 : DEFTAG( pre_hydrostat );
51 : 266 : DEFTAG( pre_pc );
52 : 266 : DEFTAG( pre_bc_dir );
53 : 266 : DEFTAG( pre_bc_dirval );
54 : 266 : DEFTAG( pre_bc_sym );
55 : 266 : DEFTAG( mom_iter );
56 : 266 : DEFTAG( mom_tol );
57 : 266 : DEFTAG( mom_verbose );
58 : 266 : DEFTAG( mom_pc );
59 : 266 : DEFTAG( reorder );
60 : 266 : DEFTAG( part );
61 : 266 : DEFTAG( zoltan_params );
62 : 266 : DEFTAG( solver );
63 : 266 : DEFTAG( stab );
64 : 266 : DEFTAG( stab2 );
65 : 266 : DEFTAG( stab2coef );
66 : 266 : DEFTAG( fct );
67 : 266 : DEFTAG( fctdif );
68 : 266 : DEFTAG( fctclip );
69 : 266 : DEFTAG( fctsys );
70 : 266 : DEFTAG( fctfreeze );
71 : 266 : DEFTAG( deactivate );
72 : 266 : DEFTAG( deatol );
73 : 266 : DEFTAG( deadif );
74 : 266 : DEFTAG( deafreq );
75 : 266 : DEFTAG( deasys );
76 : 266 : DEFTAG( deatime );
77 : 266 : DEFTAG( flux );
78 : 266 : DEFTAG( steady );
79 : 266 : DEFTAG( residual );
80 : 266 : DEFTAG( rescomp );
81 : 266 : DEFTAG( problem );
82 : 266 : DEFTAG( problem_ncomp );
83 : 266 : DEFTAG( problem_alpha );
84 : 266 : DEFTAG( problem_kappa );
85 : 266 : DEFTAG( problem_beta );
86 : 266 : DEFTAG( problem_r0 );
87 : 266 : DEFTAG( problem_p0 );
88 : 266 : DEFTAG( problem_ce );
89 : 266 : DEFTAG( problem_src );
90 : 266 : DEFTAG( location );
91 : 266 : DEFTAG( radius );
92 : 266 : DEFTAG( release_time );
93 : 266 : DEFTAG( freezeflow );
94 : 266 : DEFTAG( freezetime );
95 : 266 : DEFTAG( fieldout );
96 : 266 : DEFTAG( fieldout_iter );
97 : 266 : DEFTAG( fieldout_time );
98 : 266 : DEFTAG( fieldout_range );
99 : 266 : DEFTAG( histout );
100 : 266 : DEFTAG( histout_iter );
101 : 266 : DEFTAG( histout_time );
102 : 266 : DEFTAG( histout_range );
103 : 266 : DEFTAG( histout_precision );
104 : 266 : DEFTAG( histout_format );
105 : 266 : DEFTAG( integout );
106 : 266 : DEFTAG( integout_iter );
107 : 266 : DEFTAG( integout_time );
108 : 266 : DEFTAG( integout_range );
109 : 266 : DEFTAG( integout_precision );
110 : 266 : DEFTAG( integout_format );
111 : 266 : DEFTAG( integout_integrals );
112 : 266 : DEFTAG( ic );
113 : 6 : DEFTAG( x );
114 : 6 : DEFTAG( y );
115 : 6 : DEFTAG( z );
116 : 272 : DEFTAG( ic_density );
117 : 272 : DEFTAG( ic_pressure );
118 : 272 : DEFTAG( ic_energy );
119 : 272 : DEFTAG( ic_temperature );
120 : 272 : DEFTAG( ic_velocity );
121 : 266 : DEFTAG( bc_dir );
122 : 266 : DEFTAG( bc_dirval );
123 : 266 : DEFTAG( bc_sym );
124 : 266 : DEFTAG( bc_noslip );
125 : 266 : DEFTAG( bc_far );
126 : 266 : DEFTAG( bc_far_density );
127 : 266 : DEFTAG( bc_far_pressure );
128 : 266 : DEFTAG( bc_far_velocity );
129 : 266 : DEFTAG( bc_pre );
130 : 266 : DEFTAG( bc_pre_density );
131 : 266 : DEFTAG( bc_pre_pressure );
132 : 266 : DEFTAG( mat_spec_heat_ratio );
133 : 266 : DEFTAG( mat_spec_heat_const_vol );
134 : 266 : DEFTAG( mat_spec_gas_const );
135 : 266 : DEFTAG( mat_heat_conductivity );
136 : 266 : DEFTAG( mat_dyn_viscosity );
137 : 266 : DEFTAG( mat_dyn_diffusivity );
138 : 266 : DEFTAG( href_t0 );
139 : 266 : DEFTAG( href_dt );
140 : 266 : DEFTAG( href_dtfreq );
141 : 266 : DEFTAG( href_maxlevels );
142 : 266 : DEFTAG( href_error );
143 : 266 : DEFTAG( href_init );
144 : 266 : DEFTAG( href_refvar );
145 : : } // tag::
146 : :
147 : : namespace inciter {
148 : : //! Inciter control facilitating user input to internal data transfer
149 : : namespace ctr {
150 : :
151 : : //! Member data for tagged tuple
152 : : using ConfigMembers = brigand::list<
153 : : tag::commit, std::string
154 : : , tag::input, std::string
155 : : , tag::control, std::string
156 : : , tag::output, std::string
157 : : , tag::diag, std::string
158 : : , tag::diag_iter, uint64_t
159 : : , tag::diag_precision, std::streamsize
160 : : , tag::diag_format, std::string
161 : : , tag::checkpoint, std::string
162 : : , tag::quiescence, bool
163 : : , tag::virt, double
164 : : , tag::nonblocking, bool
165 : : , tag::benchmark, bool
166 : : , tag::feedback, bool
167 : : , tag::lbfreq, uint64_t
168 : : , tag::lbtime, double
169 : : , tag::rsfreq, uint64_t
170 : : , tag::nstep, uint64_t
171 : : , tag::ttyi, uint64_t
172 : : , tag::term, double
173 : : , tag::cfl, double
174 : : , tag::rk, uint64_t
175 : : , tag::theta, double
176 : : , tag::t0, double
177 : : , tag::dt, double
178 : : , tag::turkel, double
179 : : , tag::soundspeed, double
180 : : , tag::velinf, std::vector< double >
181 : : , tag::pre_iter, uint64_t
182 : : , tag::pre_tol, double
183 : : , tag::pre_verbose, uint64_t
184 : : , tag::pre_hydrostat, uint64_t
185 : : , tag::pre_pc, std::string
186 : : , tag::pre_bc_dir, std::vector< std::vector< int > >
187 : : , tag::pre_bc_dirval, std::vector< std::vector< double > >
188 : : , tag::pre_bc_sym, std::vector< int >
189 : : , tag::mom_iter, uint64_t
190 : : , tag::mom_tol, double
191 : : , tag::mom_verbose, uint64_t
192 : : , tag::mom_pc, std::string
193 : : , tag::reorder, bool
194 : : , tag::part, std::string
195 : : , tag::zoltan_params, std::vector< std::string >
196 : : , tag::solver, std::string
197 : : , tag::stab, bool
198 : : , tag::stab2, bool
199 : : , tag::stab2coef, double
200 : : , tag::fct, bool
201 : : , tag::fctdif, double
202 : : , tag::fctclip, bool
203 : : , tag::fctsys, std::vector< uint64_t >
204 : : , tag::fctfreeze, double
205 : : , tag::deactivate, bool
206 : : , tag::deatol, double
207 : : , tag::deadif, double
208 : : , tag::deafreq, uint64_t
209 : : , tag::deasys, std::vector< uint64_t >
210 : : , tag::deatime, double
211 : : , tag::flux, std::string
212 : : , tag::steady, bool
213 : : , tag::residual, double
214 : : , tag::rescomp, uint64_t
215 : : , tag::problem, std::string
216 : : , tag::problem_ncomp, uint64_t
217 : : , tag::problem_alpha, double
218 : : , tag::problem_kappa, double
219 : : , tag::problem_beta, std::vector< double >
220 : : , tag::problem_r0, double
221 : : , tag::problem_p0, double
222 : : , tag::problem_ce, double
223 : : , tag::problem_src, tk::TaggedTuple< brigand::list<
224 : : tag::location, std::vector< double >
225 : : , tag::radius, double
226 : : , tag::release_time, double
227 : : > >
228 : : , tag::freezeflow, double
229 : : , tag::freezetime, double
230 : : , tag::fieldout, std::vector< int >
231 : : , tag::fieldout_iter, uint64_t
232 : : , tag::fieldout_time, double
233 : : , tag::fieldout_range, std::vector< std::vector< double > >
234 : : , tag::histout, std::vector< std::vector< double > >
235 : : , tag::histout_iter, uint64_t
236 : : , tag::histout_time, double
237 : : , tag::histout_range, std::vector< std::vector< double > >
238 : : , tag::histout_precision, std::streamsize
239 : : , tag::histout_format, std::string
240 : : , tag::integout, std::vector< int >
241 : : , tag::integout_iter, uint64_t
242 : : , tag::integout_time, double
243 : : , tag::integout_range, std::vector< std::vector< double > >
244 : : , tag::integout_precision, std::streamsize
245 : : , tag::integout_format, std::string
246 : : , tag::integout_integrals, std::vector< std::string >
247 : : , tag::ic, std::vector<
248 : : tk::TaggedTuple< brigand::list<
249 : : tag::x, std::vector< double >
250 : : , tag::y, std::vector< double >
251 : : , tag::z, std::vector< double >
252 : : , tag::ic_density, double
253 : : , tag::ic_pressure, double
254 : : , tag::ic_energy, double
255 : : , tag::ic_temperature, double
256 : : , tag::ic_velocity, std::vector< double >
257 : : > >
258 : : >
259 : : , tag::ic_density, double
260 : : , tag::ic_pressure, double
261 : : , tag::ic_energy, double
262 : : , tag::ic_temperature, double
263 : : , tag::ic_velocity, std::vector< double >
264 : : , tag::bc_dir, std::vector< std::vector< int > >
265 : : , tag::bc_dirval, std::vector< std::vector< double > >
266 : : , tag::bc_sym, std::vector< int >
267 : : , tag::bc_noslip, std::vector< int >
268 : : , tag::bc_far, std::vector< int >
269 : : , tag::bc_far_density, double
270 : : , tag::bc_far_pressure, double
271 : : , tag::bc_far_velocity, std::vector< double >
272 : : , tag::bc_pre, std::vector< std::vector< int > >
273 : : , tag::bc_pre_density, std::vector< double >
274 : : , tag::bc_pre_pressure, std::vector< double >
275 : : , tag::mat_spec_heat_ratio, double
276 : : , tag::mat_spec_heat_const_vol, double
277 : : , tag::mat_spec_gas_const, double
278 : : , tag::mat_heat_conductivity, double
279 : : , tag::mat_dyn_viscosity, double
280 : : , tag::mat_dyn_diffusivity, double
281 : : , tag::href_t0, bool
282 : : , tag::href_dt, bool
283 : : , tag::href_dtfreq, uint64_t
284 : : , tag::href_maxlevels, uint64_t
285 : : , tag::href_refvar, std::vector< uint64_t >
286 : : , tag::href_error, std::string
287 : : , tag::href_init, std::vector< std::string >
288 : : >;
289 : :
290 : : //! Config is a TaggedTuple specialized to Inciter
291 : : class Config : public tk::TaggedTuple< ConfigMembers > {
292 : :
293 : : public:
294 : : //! Contructor: parse inciter command line
295 : : void cmdline( int argc, char** argv );
296 : :
297 : : //! Parse control file
298 : : void control();
299 : :
300 : : /** @name Pack/Unpack: Serialize Config object for Charm++ */
301 : : ///@{
302 : : //! \brief Pack/Unpack serialize member function
303 : : //! \param[in,out] p Charm++'s PUP::er serializer object reference
304 : 1252 : void pup( PUP::er& p ) { tk::TaggedTuple< ConfigMembers >::pup(p); }
305 : : //! \brief Pack/Unpack serialize operator|
306 : : //! \param[in,out] p Charm++'s PUP::er serializer object reference
307 : : //! \param[in,out] c Config object reference
308 : 1252 : friend void operator|( PUP::er& p, Config& c ) { c.pup(p); }
309 : : //@}
310 : :
311 : : private:
312 : : //! Echo help on command line arguments
313 : : void help( char** argv );
314 : : };
315 : :
316 : : } // ctr::
317 : : } // inciter::
|