Branch data Line data Source code
1 : : // *****************************************************************************
2 : : /*!
3 : : \file src/Control/Inciter/InputDeck/LuaParser.cpp
4 : : \copyright 2019-2021 Triad National Security, LLC.
5 : : All rights reserved. See the LICENSE file for details.
6 : : \brief Inciter's lua input deck file parser
7 : : \details This file defines the input deck, i.e., control file, parser for
8 : : the computational shock hydrodynamics tool, Inciter.
9 : : */
10 : : // *****************************************************************************
11 : :
12 : : #include <ostream>
13 : : #include <type_traits>
14 : :
15 : : #include "QuinoaConfig.hpp"
16 : :
17 : : #include "NoWarning/pegtl.hpp"
18 : :
19 : : #include "Print.hpp"
20 : : #include "Exception.hpp"
21 : : #include "Inciter/InputDeck/InputDeck.hpp"
22 : : #include "Inciter/InputDeck/LuaParser.hpp"
23 : : #include "PDE/MultiMat/MultiMatIndexing.hpp"
24 : : #include "PDE/MultiSpecies/MultiSpeciesIndexing.hpp"
25 : :
26 : : namespace tk {
27 : : namespace grm {
28 : :
29 : : //! \brief Case-insensitive character comparison functor
30 : : struct CaseInsensitiveCharLess {
31 : : //! Function call operator
32 : : //! \param[in] lhs Left character of the comparitor operand
33 : : //! \param[in] rhs Right character of the comparitor operand
34 : : //! \return Boolean indicating the result of the comparison
35 : : bool operator() ( char lhs, char rhs ) const {
36 [ - + ][ - + ]: 3 : return std::tolower( lhs ) < std::tolower( rhs );
[ + - ]
37 : : }
38 : : };
39 : :
40 : : //! \brief Parser-lifetime storage for dependent variables selected.
41 : : //! \details Used to track the dependent variable of differential equations
42 : : //! (i.e., models) assigned during parsing. It needs to be case insensitive
43 : : //! since we only care about whether the variable is selected or not and not
44 : : //! whether it denotes a full variable (upper case) or a fluctuation (lower
45 : : //! case). This is true for both inserting variables into the set as well as
46 : : //! at matching terms of products in parsing requested statistics.
47 : : static std::set< char, CaseInsensitiveCharLess > depvars;
48 : :
49 : : } // grm::
50 : : } // tk::
51 : :
52 : : using inciter::LuaParser;
53 : :
54 : 192 : LuaParser::LuaParser( const tk::Print& /*print*/,
55 : : const ctr::CmdLine& cmdline,
56 : : ctr::InputDeck& inputdeck ) :
57 : 192 : m_filename( cmdline.get< tag::io, tag::control >() )
58 : : // *****************************************************************************
59 : : // Constructor
60 : : // //! \param[in] print Pretty printer
61 : : //! \param[in] cmdline Command line stack
62 : : //! \param[in,out] inputdeck Input deck stack where data is stored during
63 : : //! parsing
64 : : // *****************************************************************************
65 : : {
66 : : // Make sure there is a filename
67 : : Assert( !m_filename.empty(), "No filename specified" );
68 : :
69 : : // Local file stream handle
70 [ + - ]: 384 : std::ifstream q;
71 : :
72 : : // Check if file exists, throw exception if it does not
73 [ + - ]: 192 : q.open( m_filename, std::ifstream::in );
74 [ - + ][ - - ]: 192 : ErrChk( q.good(), "Failed to open file: " + m_filename );
[ - - ][ - - ]
[ - - ][ - - ]
75 : :
76 : : // Attempt to read a character, throw if it fails
77 : : // It is curious that on some systems opening a directory instead of a file
78 : : // with the above ifstream::open() call does not set the failbit. Thus we get
79 : : // here fine, so we try to read a character from it. If it is a directory or
80 : : // an empty file the read will fail, so we throw. Read more at: http://
81 : : // stackoverflow.com/questions/9591036/
82 : : // ifstream-open-doesnt-set-error-bits-when-argument-is-a-directory.
83 [ + - ]: 192 : q.get();
84 [ - + ][ - - ]: 192 : ErrChk( q.good(), "Failed to read from file: " + m_filename );
[ - - ][ - - ]
[ - - ][ - - ]
85 : :
86 : : // Close it
87 [ + - ]: 192 : q.close();
88 [ - + ][ - - ]: 192 : ErrChk( !q.fail(), "Failed to close file: " + m_filename );
[ - - ][ - - ]
[ - - ][ - - ]
89 : :
90 : : // Create InputDeck (a tagged tuple) to store parsed input
91 [ + - ]: 192 : ctr::InputDeck ideck( cmdline );
92 : :
93 : : // Read lua file into sol object
94 [ + - ]: 384 : sol::state lua_deck;
95 [ + - ][ + - ]: 192 : lua_deck.open_libraries(sol::lib::base);
96 [ + - ]: 192 : lua_deck.script_file(m_filename);
97 : :
98 : : // Store inputdeck parameters from sol object into tagged tuple
99 [ + - ]: 384 : storeInputDeck(lua_deck["inciter"], ideck);
100 : :
101 : : inputdeck = std::move( ideck );
102 : 192 : }
103 : :
104 : : void
105 : 192 : LuaParser::storeInputDeck(
106 : : const sol::table& lua_ideck,
107 : : ctr::InputDeck& gideck )
108 : : // *****************************************************************************
109 : : // Store lua inputdeck in custom struct
110 : : //! \param[in] lua_ideck Lua inputdeck parsed by sol2
111 : : //! \param[in,out] gideck Inciter's inputdeck storage
112 : : // *****************************************************************************
113 : : {
114 : : // TODO: explore replacing storeIfSpecd() and storeOptIfSpecd with sol::get_or()
115 : :
116 [ + - ][ + - ]: 576 : storeIfSpecd< std::string >(
[ + - ][ - + ]
[ - + ][ + - ]
[ - - ]
117 : : lua_ideck, "title", gideck.get< tag::title >(), "No title");
118 : :
119 : : // time stepping options
120 : : // ---------------------------------------------------------------------------
121 [ + - ][ + - ]: 576 : storeIfSpecd< uint64_t >(
[ - + ][ + - ]
[ - - ]
122 : : lua_ideck, "nstep", gideck.get< tag::nstep >(),
123 : : std::numeric_limits< uint64_t >::max());
124 [ + - ][ + - ]: 576 : storeIfSpecd< tk::real >(
[ - + ][ + - ]
[ - - ]
125 : : lua_ideck, "term", gideck.get< tag::term >(),
126 : : std::numeric_limits< tk::real >::max());
127 [ + - ][ + - ]: 576 : storeIfSpecd< tk::real >(
[ - + ][ + - ]
[ - - ]
128 : : lua_ideck, "t0", gideck.get< tag::t0 >(), 0.0);
129 [ + - ][ + - ]: 576 : storeIfSpecd< tk::real >(
[ - + ][ + - ]
[ - - ]
130 : : lua_ideck, "dt", gideck.get< tag::dt >(), 0.0);
131 [ + - ][ + - ]: 576 : storeIfSpecd< tk::real >(
[ - + ][ + - ]
[ - - ]
132 : : lua_ideck, "cfl", gideck.get< tag::cfl >(), 0.0);
133 [ + - ][ + - ]: 576 : storeIfSpecd< uint32_t >(
[ - + ][ + - ]
[ - - ]
134 : : lua_ideck, "ttyi", gideck.get< tag::ttyi >(), 1);
135 [ + - ][ + - ]: 576 : storeIfSpecd< bool >(
[ - + ][ + - ]
[ - - ]
136 : : lua_ideck, "steady_state", gideck.get< tag::steady_state >(), false);
137 [ + - ][ + - ]: 576 : storeIfSpecd< tk::real >(
[ - + ][ + - ]
[ - - ]
138 : : lua_ideck, "residual", gideck.get< tag::residual >(), 1.0e-8);
139 [ + - ][ + - ]: 576 : storeIfSpecd< uint32_t >(
[ - + ][ + - ]
[ - - ]
140 : : lua_ideck, "rescomp", gideck.get< tag::rescomp >(), 1);
141 [ + - ][ + - ]: 768 : storeIfSpecd< uint32_t >(
[ + - ][ + - ]
[ - - ]
142 : : lua_ideck, "imex_runge_kutta", gideck.get< tag::imex_runge_kutta >(), 0);
143 [ + - ][ + - ]: 576 : storeIfSpecd< uint32_t >(
[ - + ][ + - ]
[ - - ]
144 : : lua_ideck, "imex_maxiter", gideck.get< tag::imex_maxiter >(), 50);
145 [ + - ][ + - ]: 576 : storeIfSpecd< tk::real >(
[ - + ][ + - ]
[ - - ]
146 : : lua_ideck, "imex_reltol", gideck.get< tag::imex_reltol >(), 1.0e-02);
147 [ + - ][ + - ]: 576 : storeIfSpecd< tk::real >(
[ - + ][ - - ]
148 : : lua_ideck, "imex_abstol", gideck.get< tag::imex_abstol >(), 1.0e-04);
149 : :
150 [ + + ][ - + ]: 192 : if (gideck.get< tag::dt >() < 1e-12 && gideck.get< tag::cfl >() < 1e-12)
151 [ - - ][ - - ]: 0 : Throw("No time step calculation policy has been selected in the "
[ - - ][ - - ]
[ - - ][ - - ]
152 : : "preceeding block. Use keyword 'dt' to set a constant or 'cfl' to set an "
153 : : "adaptive time step size calculation policy.");
154 : :
155 : : // partitioning/reordering options
156 : : // ---------------------------------------------------------------------------
157 : : storeOptIfSpecd< tk::ctr::PartitioningAlgorithmType,
158 [ + - ][ + - ]: 576 : tk::ctr::PartitioningAlgorithm >(
[ - + ][ + - ]
[ - - ]
159 : : lua_ideck, "partitioning", gideck.get< tag::partitioning >(),
160 : : tk::ctr::PartitioningAlgorithmType::RCB);
161 [ + - ][ + - ]: 576 : storeIfSpecd< bool >(
[ - + ][ + - ]
[ - - ]
162 : : lua_ideck, "pelocal_reorder", gideck.get< tag::pelocal_reorder >(),
163 : : false);
164 [ + - ][ + - ]: 768 : storeIfSpecd< bool >(
[ + - ][ + - ]
[ - - ]
165 : : lua_ideck, "operator_reorder", gideck.get< tag::operator_reorder >(),
166 : : false);
167 : :
168 : : // discretization scheme options
169 : : // ---------------------------------------------------------------------------
170 : : using inciter::ctr::SchemeType;
171 [ + - ][ + - ]: 576 : storeOptIfSpecd< SchemeType, inciter::ctr::Scheme >(
[ - + ][ + - ]
[ - - ]
172 : : lua_ideck, "scheme", gideck.get< tag::scheme >(), SchemeType::ALECG);
173 [ + - ][ + - ]: 576 : storeOptIfSpecd< inciter::ctr::LimiterType, inciter::ctr::Limiter >(
[ - + ][ + - ]
[ - - ]
174 : : lua_ideck, "limiter", gideck.get< tag::limiter >(),
175 : : inciter::ctr::LimiterType::NOLIMITER);
176 [ + - ][ + - ]: 576 : storeIfSpecd< tk::real >(
[ - + ][ + - ]
[ - - ]
177 : : lua_ideck, "cweight", gideck.get< tag::cweight >(), 1.0);
178 [ + - ][ + - ]: 768 : storeIfSpecd< tk::real >(
[ + - ][ + - ]
[ - - ]
179 : : lua_ideck, "shock_detector_coeff",
180 : : gideck.get< tag::shock_detector_coeff >(), 1.0);
181 [ + - ][ + - ]: 576 : storeIfSpecd< bool >(
[ - + ][ + - ]
[ - - ]
182 : : lua_ideck, "accuracy_test", gideck.get< tag::accuracy_test >(), false);
183 [ + - ][ + - ]: 768 : storeIfSpecd< bool >(
[ + - ][ + - ]
[ - - ]
184 : : lua_ideck, "limsol_projection", gideck.get< tag::limsol_projection >(),
185 : : true);
186 [ + - ][ + - ]: 576 : storeIfSpecd< tk::real >(
[ - + ][ - - ]
187 : : lua_ideck, "lowspeed_kp", gideck.get< tag::lowspeed_kp >(), 0.0);
188 : :
189 : : // configure solutions DOFs
190 : 192 : auto scheme = gideck.get< tag::scheme >();
191 : : auto& ndof = gideck.get< tag::ndof >();
192 : : auto& rdof = gideck.get< tag::rdof >();
193 : 192 : ndof = rdof = 1;
194 [ + + ]: 192 : if (scheme == SchemeType::P0P1 || scheme == SchemeType::FV) {
195 : 29 : ndof = 1; rdof = 4;
196 [ + + ]: 163 : } else if (scheme == SchemeType::DGP1) {
197 : 17 : ndof = rdof = 4;
198 [ + + ]: 146 : } else if (scheme == SchemeType::DGP2) {
199 : 8 : ndof = rdof = 10;
200 [ + + ]: 138 : } else if (scheme == SchemeType::PDG) {
201 : 12 : ndof = rdof = 10;
202 : 12 : gideck.get< tag::pref, tag::pref >() = true;
203 : 126 : } else if (scheme != SchemeType::DG &&
204 [ + + ][ - + ]: 126 : scheme != SchemeType::ALECG &&
205 : : scheme != SchemeType::OversetFE) {
206 [ - - ][ - - ]: 0 : Throw("Scheme type not configured in configure_scheme");
[ - - ][ - - ]
[ - - ][ - - ]
207 : : }
208 : :
209 : : // PDE options
210 : : // ---------------------------------------------------------------------------
211 : :
212 : 192 : char depvar_cnt = 'a';
213 : 192 : gideck.get< tag::depvar >().resize(1);
214 : :
215 : : // check transport
216 [ + + ]: 192 : if (lua_ideck["transport"].valid()) {
217 : :
218 [ + - ][ + - ]: 276 : checkBlock< inciter::ctr::transportList::Keys >(lua_ideck["transport"],
[ - + ][ - - ]
219 : : "transport");
220 : :
221 [ + - ]: 92 : gideck.get< tag::pde >() = inciter::ctr::PDEType::TRANSPORT;
222 [ + - ][ + - ]: 276 : storeIfSpecd< std::size_t >(
[ - + ][ + - ]
[ - - ]
223 : : lua_ideck["transport"], "ncomp",
224 : : gideck.get< tag::transport, tag::ncomp >(), 1);
225 [ + - ][ + - ]: 276 : storeIfSpecd< int >(
[ - + ][ + - ]
[ - - ]
226 : : lua_ideck["transport"], "intsharp",
227 : : gideck.get< tag::transport, tag::intsharp >(), 0);
228 [ + - ][ + - ]: 276 : storeIfSpecd< tk::real >(
[ - + ][ + - ]
[ - - ]
229 : : lua_ideck["transport"], "intsharp_param",
230 : : gideck.get< tag::transport, tag::intsharp_param >(), 1.8);
231 [ + - ][ + - ]: 276 : storeOptIfSpecd< inciter::ctr::ProblemType, inciter::ctr::Problem >(
[ - + ][ - - ]
232 : : lua_ideck["transport"], "problem",
233 : : gideck.get< tag::transport, tag::problem >(),
234 : : inciter::ctr::ProblemType::USER_DEFINED);
235 [ + - ][ + - ]: 276 : storeVecIfSpecd< tk::real >(
[ + - ][ - + ]
[ + - ][ - - ]
236 : : lua_ideck["transport"], "diffusivity",
237 : : gideck.get< tag::transport, tag::diffusivity >(), {0.0, 0.0, 0.0});
238 [ + - ][ + - ]: 276 : storeVecIfSpecd< tk::real >(
[ + - ][ - + ]
[ + - ][ - - ]
239 : : lua_ideck["transport"], "u0",
240 : : gideck.get< tag::transport, tag::u0 >(), {0.0, 0.0, 0.0});
241 [ + - ][ + - ]: 276 : storeVecIfSpecd< tk::real >(
[ + - ][ - + ]
[ + - ][ - - ]
242 : : lua_ideck["transport"], "lambda",
243 : : gideck.get< tag::transport, tag::lambda >(), {0.0, 0.0, 0.0});
244 [ + - ]: 92 : gideck.get< tag::depvar >()[0] = 'c';
245 [ + - ][ + - ]: 276 : storeOptIfSpecd< inciter::ctr::FluxType, inciter::ctr::Flux >(
[ - + ][ + - ]
[ - - ]
246 : : lua_ideck, "flux", gideck.get< tag::flux >(),
247 : : inciter::ctr::FluxType::UPWIND);
248 [ + - ][ + - ]: 276 : storeOptIfSpecd< inciter::ctr::PhysicsType, inciter::ctr::Physics >(
[ - + ][ - - ]
249 : : lua_ideck["transport"], "physics",
250 : : gideck.get< tag::transport, tag::physics >(),
251 : : inciter::ctr::PhysicsType::ADVECTION);
252 : :
253 : : // store number of equations in PDE system
254 : 92 : gideck.get< tag::ncomp >() =
255 : 92 : gideck.get< tag::transport, tag::ncomp >();
256 : : }
257 : :
258 : : // check compflow
259 [ + + ]: 192 : if (lua_ideck["compflow"].valid()) {
260 : :
261 [ + - ][ + - ]: 186 : checkBlock< inciter::ctr::compflowList::Keys >(lua_ideck["compflow"],
[ - + ][ - - ]
262 : : "compflow");
263 : :
264 [ + - ]: 62 : gideck.get< tag::pde >() = inciter::ctr::PDEType::COMPFLOW;
265 [ + - ][ + - ]: 186 : storeOptIfSpecd< inciter::ctr::ProblemType, inciter::ctr::Problem >(
[ - + ][ + - ]
[ - - ]
266 : : lua_ideck["compflow"], "problem",
267 : : gideck.get< tag::compflow, tag::problem >(),
268 : : inciter::ctr::ProblemType::USER_DEFINED);
269 [ + - ][ + - ]: 186 : storeOptIfSpecd< inciter::ctr::PhysicsType, inciter::ctr::Physics >(
[ - + ][ + - ]
[ - - ]
270 : : lua_ideck["compflow"], "physics",
271 : : gideck.get< tag::compflow, tag::physics >(),
272 : : inciter::ctr::PhysicsType::EULER);
273 : :
274 : : // problem parameters for MMS
275 [ + - ][ + - ]: 186 : storeIfSpecd< tk::real >(lua_ideck["compflow"], "alpha",
[ - + ][ + - ]
[ - - ]
276 : : gideck.get< tag::compflow, tag::alpha >(), 0.0);
277 [ + - ][ + - ]: 186 : storeIfSpecd< tk::real >(lua_ideck["compflow"], "beta",
[ - + ][ + - ]
[ - - ]
278 : : gideck.get< tag::compflow, tag::beta >(), 0.0);
279 [ + - ][ + - ]: 186 : storeIfSpecd< tk::real >(lua_ideck["compflow"], "betax",
[ - + ][ + - ]
[ - - ]
280 : : gideck.get< tag::compflow, tag::betax >(), 0.0);
281 [ + - ][ + - ]: 186 : storeIfSpecd< tk::real >(lua_ideck["compflow"], "betay",
[ - + ][ + - ]
[ - - ]
282 : : gideck.get< tag::compflow, tag::betay >(), 0.0);
283 [ + - ][ + - ]: 186 : storeIfSpecd< tk::real >(lua_ideck["compflow"], "betaz",
[ - + ][ + - ]
[ - - ]
284 : : gideck.get< tag::compflow, tag::betaz >(), 0.0);
285 [ + - ][ + - ]: 186 : storeIfSpecd< tk::real >(lua_ideck["compflow"], "r0",
[ - + ][ + - ]
[ - - ]
286 : : gideck.get< tag::compflow, tag::r0 >(), 0.0);
287 [ + - ][ + - ]: 186 : storeIfSpecd< tk::real >(lua_ideck["compflow"], "p0",
[ - + ][ + - ]
[ - - ]
288 : : gideck.get< tag::compflow, tag::p0 >(), 0.0);
289 [ + - ][ + - ]: 186 : storeIfSpecd< tk::real >(lua_ideck["compflow"], "ce",
[ - + ][ + - ]
[ - - ]
290 : : gideck.get< tag::compflow, tag::ce >(), 0.0);
291 [ + - ][ + - ]: 186 : storeIfSpecd< tk::real >(lua_ideck["compflow"], "kappa",
[ - + ][ - - ]
292 : : gideck.get< tag::compflow, tag::kappa >(), 0.0);
293 : :
294 [ + - ]: 62 : gideck.get< tag::depvar >()[0] = 'a';
295 [ + - ][ + - ]: 186 : storeOptIfSpecd< inciter::ctr::FluxType, inciter::ctr::Flux >(
[ - + ][ - - ]
296 : : lua_ideck, "flux", gideck.get< tag::flux >(),
297 : : inciter::ctr::FluxType::HLLC);
298 : :
299 : : // store number of equations in PDE system
300 : 62 : gideck.get< tag::ncomp >() = 5;
301 : : }
302 : :
303 : : // check multimat
304 [ + + ]: 192 : if (lua_ideck["multimat"].valid()) {
305 : :
306 [ + - ][ + - ]: 96 : checkBlock< inciter::ctr::multimatList::Keys >(lua_ideck["multimat"],
[ - + ][ - - ]
307 : : "multimat");
308 : :
309 [ + - ]: 32 : gideck.get< tag::pde >() = inciter::ctr::PDEType::MULTIMAT;
310 [ + - ][ + - ]: 96 : storeIfSpecd< std::size_t >(
[ - + ][ + - ]
[ - - ]
311 : : lua_ideck["multimat"], "nmat",
312 : : gideck.get< tag::multimat, tag::nmat >(), 2);
313 [ + - ][ + - ]: 96 : storeIfSpecd< uint64_t >(
[ - + ][ + - ]
[ - - ]
314 : : lua_ideck["multimat"], "prelax",
315 : : gideck.get< tag::multimat, tag::prelax >(), 1);
316 [ + - ][ + - ]: 128 : storeIfSpecd< tk::real >(
[ + - ][ + - ]
[ - - ]
317 : : lua_ideck["multimat"], "prelax_timescale",
318 : : gideck.get< tag::multimat, tag::prelax_timescale >(), 0.25);
319 [ + - ][ + - ]: 96 : storeIfSpecd< int >(
[ - + ][ + - ]
[ - - ]
320 : : lua_ideck["multimat"], "intsharp",
321 : : gideck.get< tag::multimat, tag::intsharp >(), 0);
322 [ + - ][ + - ]: 96 : storeIfSpecd< tk::real >(
[ - + ][ + - ]
[ - - ]
323 : : lua_ideck["multimat"], "intsharp_param",
324 : : gideck.get< tag::multimat, tag::intsharp_param >(), 1.8);
325 [ + - ][ + - ]: 96 : storeIfSpecd< uint64_t >(
[ - + ][ + - ]
[ - - ]
326 : : lua_ideck["multimat"], "rho0constraint",
327 : : gideck.get< tag::multimat, tag::rho0constraint >(), 1);
328 [ + - ][ + - ]: 96 : storeIfSpecd< int >(
[ - + ][ + - ]
[ - - ]
329 : : lua_ideck["multimat"], "dt_sos_massavg",
330 : : gideck.get< tag::multimat, tag::dt_sos_massavg >(), 0);
331 [ + - ][ + - ]: 96 : storeOptIfSpecd< inciter::ctr::ProblemType, inciter::ctr::Problem >(
[ - + ][ + - ]
[ - - ]
332 : : lua_ideck["multimat"], "problem",
333 : : gideck.get< tag::multimat, tag::problem >(),
334 : : inciter::ctr::ProblemType::USER_DEFINED);
335 [ + - ][ + - ]: 96 : storeOptIfSpecd< inciter::ctr::PhysicsType, inciter::ctr::Physics >(
[ - + ][ - - ]
336 : : lua_ideck["multimat"], "physics",
337 : : gideck.get< tag::multimat, tag::physics >(),
338 : : inciter::ctr::PhysicsType::EULER);
339 [ + - ]: 32 : gideck.get< tag::depvar >()[0] = 'a';
340 [ + - ][ + - ]: 96 : storeOptIfSpecd< inciter::ctr::FluxType, inciter::ctr::Flux >(
[ - + ][ - - ]
341 : : lua_ideck, "flux", gideck.get< tag::flux >(),
342 : : inciter::ctr::FluxType::AUSM);
343 : :
344 : : // number of equations in PDE system are determined based on materials
345 : : }
346 : :
347 : : // check multispecies
348 [ + + ]: 192 : if (lua_ideck["multispecies"].valid()) {
349 : :
350 [ + - ][ + - ]: 18 : checkBlock< inciter::ctr::multispeciesList::Keys >(lua_ideck["multispecies"],
[ - + ][ - - ]
351 : : "multispecies");
352 : :
353 [ + - ]: 6 : gideck.get< tag::pde >() = inciter::ctr::PDEType::MULTISPECIES;
354 [ + - ][ + - ]: 18 : storeIfSpecd< std::size_t >(
[ - + ][ + - ]
[ - - ]
355 : : lua_ideck["multispecies"], "nspec",
356 : : gideck.get< tag::multispecies, tag::nspec >(), 1);
357 [ + - ][ + - ]: 18 : storeOptIfSpecd< inciter::ctr::ProblemType, inciter::ctr::Problem >(
[ - + ][ + - ]
[ - - ]
358 : : lua_ideck["multispecies"], "problem",
359 : : gideck.get< tag::multispecies, tag::problem >(),
360 : : inciter::ctr::ProblemType::USER_DEFINED);
361 [ + - ][ + - ]: 18 : storeOptIfSpecd< inciter::ctr::PhysicsType, inciter::ctr::Physics >(
[ - + ][ - - ]
362 : : lua_ideck["multispecies"], "physics",
363 : : gideck.get< tag::multispecies, tag::physics >(),
364 : : inciter::ctr::PhysicsType::EULER);
365 [ + - ]: 6 : gideck.get< tag::depvar >()[0] = 'a';
366 [ + - ][ + - ]: 18 : storeOptIfSpecd< inciter::ctr::FluxType, inciter::ctr::Flux >(
[ - + ][ - - ]
367 : : lua_ideck, "flux", gideck.get< tag::flux >(),
368 : : inciter::ctr::FluxType::AUSM);
369 : :
370 : : // store number of equations in PDE system
371 : : // nspec: species mass conservation equations,
372 : : // 3: momentum equations,
373 : : // 1: total energy equation.
374 : 6 : gideck.get< tag::ncomp >() =
375 : 6 : gideck.get< tag::multispecies, tag::nspec >() + 3 + 1;
376 : : }
377 : :
378 : : // number of species, for future use
379 : : std::size_t nspec(1);
380 [ + + ]: 192 : if (gideck.get< tag::pde >() == inciter::ctr::PDEType::MULTISPECIES)
381 : 6 : nspec = gideck.get< tag::multispecies, tag::nspec >();
382 : :
383 : : // add depvar to deck::depvars so it can be selected as outvar later
384 : 192 : tk::grm::depvars.insert( gideck.get< tag::depvar >()[0] );
385 : :
386 : : // Assemble material blocks
387 : : // ---------------------------------------------------------------------------
388 : :
389 : : // solid counters
390 : : std::size_t tmat(0), imatcntr(0), mtypei(0), isolcntr(0);
391 : : bool is_solid(false);
392 : : std::set< std::size_t > matidset;
393 : :
394 : : // material vector
395 [ + - ][ + + ]: 192 : if (lua_ideck["material"].valid()) {
396 : :
397 : : // size material map vectors
398 : : std::size_t nmat(1);
399 [ + + ]: 100 : if (gideck.get< tag::pde >() == inciter::ctr::PDEType::MULTIMAT)
400 : 32 : nmat = gideck.get< tag::multimat, tag::nmat >();
401 [ + - ]: 100 : gideck.get< tag::matidxmap, tag::eosidx >().resize(nmat);
402 [ + - ]: 100 : gideck.get< tag::matidxmap, tag::matidx >().resize(nmat);
403 [ + - ]: 100 : gideck.get< tag::matidxmap, tag::solidx >().resize(nmat);
404 : :
405 : : // size material vector appropriately
406 : : // size of the material vector is the number of distinct types of materials
407 : : sol::table sol_mat = lua_ideck["material"];
408 [ + - ][ + - ]: 100 : gideck.get< tag::material >().resize(sol_mat.size());
409 : : // species vector size is one, since all species are only of one type for now
410 [ + - ]: 100 : gideck.get< tag::species >().resize(1);
411 : :
412 : : // store material properties
413 [ + + ]: 200 : for (std::size_t i=0; i<gideck.get< tag::material >().size(); ++i) {
414 : :
415 [ + - ][ + - ]: 300 : checkBlock< inciter::ctr::materialList::Keys >(sol_mat[i+1], "material");
[ + - ][ - + ]
[ - - ]
416 : :
417 [ + - ]: 100 : auto& mati_deck = gideck.get< tag::material >()[i];
418 : : // eos
419 [ + - ][ + - ]: 300 : storeOptIfSpecd< inciter::ctr::MaterialType, inciter::ctr::Material >(
[ - + ][ - - ]
420 : : sol_mat[i+1], "eos", mati_deck.get< tag::eos >(),
421 : : inciter::ctr::MaterialType::STIFFENEDGAS);
422 : :
423 : : // material ids in this eos (default is for compflow i.e. single mat)
424 [ + - ][ + - ]: 300 : storeVecIfSpecd< uint64_t >(
[ - + ][ + - ]
[ - - ]
425 : : sol_mat[i+1], "id", mati_deck.get< tag::id >(),
426 [ + - ]: 100 : std::vector< uint64_t >(1,1));
427 : :
428 : : // Track total number of materials in multiple material blocks (eos's)
429 : 100 : tmat += mati_deck.get< tag::id >().size();
430 : :
431 : : // Check for repeating user specified material ids
432 [ + + ]: 252 : for (auto midx : mati_deck.get< tag::id >()) {
433 : : if (!matidset.count(midx))
434 : : matidset.insert(midx);
435 : : else
436 [ - - ][ - - ]: 0 : Throw("Repeating material id specified");
[ - - ][ - - ]
[ - - ][ - - ]
437 : : }
438 : :
439 [ + - ]: 100 : std::size_t ntype = mati_deck.get< tag::id >().size();
440 : : // cv
441 [ + - ][ + + ]: 100 : if (!sol_mat[i+1]["cv"].valid())
442 [ + - ][ - + ]: 148 : sol_mat[i+1]["cv"] = std::vector< tk::real >(ntype, 717.5);
[ - - ]
443 [ + - ][ + - ]: 300 : checkStoreMatProp(sol_mat[i+1], "cv", ntype, mati_deck.get< tag::cv >());
[ - + ][ - - ]
444 : :
445 : : // reset solid-marker
446 : : is_solid = false;
447 : :
448 : : // Stiffened-gas materials
449 [ + + ]: 100 : if (mati_deck.get< tag::eos >() ==
450 : : inciter::ctr::MaterialType::STIFFENEDGAS) {
451 : : // gamma
452 [ + - ][ + - ]: 282 : checkStoreMatProp(sol_mat[i+1], "gamma", ntype,
[ - + ][ + - ]
[ - - ]
453 : : mati_deck.get< tag::gamma >());
454 : :
455 : : // pstiff
456 [ + - ][ + + ]: 94 : if (!sol_mat[i+1]["pstiff"].valid())
457 [ + - ][ - + ]: 182 : sol_mat[i+1]["pstiff"] = std::vector< tk::real >(ntype, 0.0);
[ - - ]
458 [ + - ][ + - ]: 282 : checkStoreMatProp(sol_mat[i+1], "pstiff", ntype,
[ - + ][ + - ]
[ - - ]
459 : : mati_deck.get< tag::pstiff >());
460 : :
461 : : // mu (dynamic viscosity) and 'viscous' keyword
462 [ + - ][ + - ]: 94 : if (!sol_mat[i+1]["mu"].valid())
463 [ + - ][ - + ]: 188 : sol_mat[i+1]["mu"] = std::vector< tk::real >(ntype, 0.0);
[ - - ]
464 : 0 : else gideck.get< tag::multimat, tag::viscous >() = true;
465 [ + - ][ + - ]: 282 : checkStoreMatProp(sol_mat[i+1], "mu", ntype, mati_deck.get< tag::mu >());
[ - + ][ - - ]
466 : : }
467 : : // Small-shear solid materials
468 [ - + ]: 6 : else if (mati_deck.get< tag::eos >() ==
469 : : inciter::ctr::MaterialType::SMALLSHEARSOLID) {
470 : : // gamma
471 [ - - ][ - - ]: 0 : checkStoreMatProp(sol_mat[i+1], "gamma", ntype,
[ - - ][ - - ]
[ - - ]
472 : : mati_deck.get< tag::gamma >());
473 : :
474 : : // pstiff
475 [ - - ][ - - ]: 0 : if (!sol_mat[i+1]["pstiff"].valid())
476 [ - - ][ - - ]: 0 : sol_mat[i+1]["pstiff"] = std::vector< tk::real >(ntype, 0.0);
[ - - ]
477 [ - - ][ - - ]: 0 : checkStoreMatProp(sol_mat[i+1], "pstiff", ntype,
[ - - ][ - - ]
[ - - ]
478 : : mati_deck.get< tag::pstiff >());
479 : :
480 : : // mu
481 [ - - ][ - - ]: 0 : checkStoreMatProp(sol_mat[i+1], "mu", ntype,
[ - - ][ - - ]
[ - - ]
482 : : mati_deck.get< tag::mu >());
483 : :
484 : : // yield_stress
485 [ - - ][ - - ]: 0 : if (!sol_mat[i+1]["yield_stress"].valid())
486 : : sol_mat[i+1]["yield_stress"] =
487 [ - - ][ - - ]: 0 : std::vector< tk::real >(ntype, 300.0e+06);
[ - - ]
488 [ - - ][ - - ]: 0 : checkStoreMatProp(sol_mat[i+1], "yield_stress", ntype,
[ - - ][ - - ]
489 : : mati_deck.get< tag::yield_stress >());
490 : :
491 : : // assign solid
492 : : is_solid = true;
493 : : }
494 : : // Wilkins aluminum materials
495 [ - + ]: 6 : else if (mati_deck.get< tag::eos >() ==
496 : : inciter::ctr::MaterialType::WILKINSALUMINUM) {
497 : : // gamma
498 [ - - ][ - - ]: 0 : checkStoreMatProp(sol_mat[i+1], "gamma", ntype,
[ - - ][ - - ]
[ - - ]
499 : : mati_deck.get< tag::gamma >());
500 : :
501 : : // mu
502 [ - - ][ - - ]: 0 : checkStoreMatProp(sol_mat[i+1], "mu", ntype,
[ - - ][ - - ]
[ - - ]
503 : : mati_deck.get< tag::mu >());
504 : :
505 : : // yield_stress
506 [ - - ][ - - ]: 0 : if (!sol_mat[i+1]["yield_stress"].valid())
507 : : sol_mat[i+1]["yield_stress"] =
508 [ - - ][ - - ]: 0 : std::vector< tk::real >(ntype, 300.0e+06);
[ - - ]
509 [ - - ][ - - ]: 0 : checkStoreMatProp(sol_mat[i+1], "yield_stress", ntype,
[ - - ][ - - ]
510 : : mati_deck.get< tag::yield_stress >());
511 : :
512 : : // assign solid
513 : : is_solid = true;
514 : : }
515 : : // Godunov-Romenski materials
516 [ - + ]: 6 : else if (mati_deck.get< tag::eos >() ==
517 : : inciter::ctr::MaterialType::GODUNOVROMENSKI) {
518 : : // gamma
519 [ - - ][ - - ]: 0 : checkStoreMatProp(sol_mat[i+1], "gamma", ntype,
[ - - ][ - - ]
[ - - ]
520 : : mati_deck.get< tag::gamma >());
521 : :
522 : : // mu
523 [ - - ][ - - ]: 0 : checkStoreMatProp(sol_mat[i+1], "mu", ntype,
[ - - ][ - - ]
[ - - ]
524 : : mati_deck.get< tag::mu >());
525 : :
526 : : // rho0_jwl
527 [ - - ][ - - ]: 0 : checkStoreMatProp(sol_mat[i+1], "rho0_jwl", ntype,
[ - - ][ - - ]
[ - - ]
528 : : mati_deck.get< tag::rho0_jwl >());
529 : :
530 : : // alpha
531 [ - - ][ - - ]: 0 : checkStoreMatProp(sol_mat[i+1], "alpha", ntype,
[ - - ][ - - ]
[ - - ]
532 : : mati_deck.get< tag::alpha >());
533 : :
534 : : // K0
535 [ - - ][ - - ]: 0 : checkStoreMatProp(sol_mat[i+1], "K0", ntype,
[ - - ][ - - ]
[ - - ]
536 : : mati_deck.get< tag::K0 >());
537 : :
538 : : // yield_stress
539 [ - - ][ - - ]: 0 : if (!sol_mat[i+1]["yield_stress"].valid())
540 : : sol_mat[i+1]["yield_stress"] =
541 [ - - ][ - - ]: 0 : std::vector< tk::real >(ntype, 300.0e+06);
[ - - ]
542 [ - - ][ - - ]: 0 : checkStoreMatProp(sol_mat[i+1], "yield_stress", ntype,
[ - - ][ - - ]
543 : : mati_deck.get< tag::yield_stress >());
544 : :
545 : : // assign solid
546 : : is_solid = true;
547 : : }
548 : : // JWL materials
549 [ - + ]: 6 : else if (mati_deck.get< tag::eos >() == inciter::ctr::MaterialType::JWL) {
550 : : // w_gru
551 [ - - ][ - - ]: 0 : checkStoreMatProp(sol_mat[i+1], "w_gru", ntype,
[ - - ][ - - ]
[ - - ]
552 : : mati_deck.get< tag::w_gru >());
553 : :
554 : : // a_jwl
555 [ - - ][ - - ]: 0 : checkStoreMatProp(sol_mat[i+1], "A_jwl", ntype,
[ - - ][ - - ]
[ - - ]
556 : : mati_deck.get< tag::A_jwl >());
557 : :
558 : : // b_jwl
559 [ - - ][ - - ]: 0 : checkStoreMatProp(sol_mat[i+1], "B_jwl", ntype,
[ - - ][ - - ]
[ - - ]
560 : : mati_deck.get< tag::B_jwl >());
561 : :
562 : : // R1_jwl
563 [ - - ][ - - ]: 0 : checkStoreMatProp(sol_mat[i+1], "R1_jwl", ntype,
[ - - ][ - - ]
[ - - ]
564 : : mati_deck.get< tag::R1_jwl >());
565 : :
566 : : // R2_jwl
567 [ - - ][ - - ]: 0 : checkStoreMatProp(sol_mat[i+1], "R2_jwl", ntype,
[ - - ][ - - ]
[ - - ]
568 : : mati_deck.get< tag::R2_jwl >());
569 : :
570 : : // rho0_jwl
571 [ - - ][ - - ]: 0 : checkStoreMatProp(sol_mat[i+1], "rho0_jwl", ntype,
[ - - ][ - - ]
[ - - ]
572 : : mati_deck.get< tag::rho0_jwl >());
573 : :
574 : : // de_jwl
575 [ - - ][ - - ]: 0 : checkStoreMatProp(sol_mat[i+1], "de_jwl", ntype,
[ - - ][ - - ]
[ - - ]
576 : : mati_deck.get< tag::de_jwl >());
577 : :
578 : : // Pr_jwl
579 [ - - ][ - - ]: 0 : checkStoreMatProp(sol_mat[i+1], "Pr_jwl", ntype,
[ - - ][ - - ]
[ - - ]
580 : : mati_deck.get< tag::Pr_jwl >());
581 : :
582 : : // rhor_jwl
583 [ - - ][ - - ]: 0 : if (sol_mat[i+1]["rhor_jwl"].valid()) {
584 [ - - ][ - - ]: 0 : checkStoreMatProp(sol_mat[i+1], "rhor_jwl", ntype,
[ - - ][ - - ]
585 : : mati_deck.get< tag::rhor_jwl >());
586 : : }
587 : : // Tr_jwl
588 [ - - ][ - - ]: 0 : else if (sol_mat[i+1]["Tr_jwl"].valid()) {
589 [ - - ][ - - ]: 0 : checkStoreMatProp(sol_mat[i+1], "Tr_jwl", ntype,
[ - - ][ - - ]
590 : : mati_deck.get< tag::Tr_jwl >());
591 : : }
592 : : else
593 [ - - ][ - - ]: 0 : Throw("Either reference density or reference temperature must be "
[ - - ][ - - ]
[ - - ][ - - ]
594 : : "specified for JWL equation of state (EOS).");
595 : : }
596 : : // Thermally-perfect gas materials
597 [ + - ]: 6 : else if (mati_deck.get< tag::eos >() ==
598 : : inciter::ctr::MaterialType::THERMALLYPERFECTGAS) {
599 : :
600 [ + - ][ - + ]: 6 : if (!lua_ideck["species"].valid())
[ - - ]
601 [ - - ][ - - ]: 0 : Throw("Species block must be specified for thermally perfect gas");
[ - - ][ - - ]
[ - - ][ - - ]
602 : : sol::table sol_spc = lua_ideck["species"];
603 : :
604 : : // We have assumed that nmat == 1 always for multi species, and that
605 : : // all species are of a single type, so that the outer species vector
606 : : // is of size one
607 : 6 : auto& spci_deck = gideck.get< tag::species >()[0];
608 : :
609 : : // species ids (default is for single species)
610 [ + - ][ + - ]: 18 : storeVecIfSpecd< uint64_t >(
[ - + ][ + - ]
[ - - ]
611 : : sol_spc[i+1], "id", spci_deck.get< tag::id >(),
612 [ + - ][ + - ]: 12 : std::vector< uint64_t >(1,1));
[ - - ]
613 : :
614 : : Assert(nspec == spci_deck.get< tag::id >().size(),
615 : : "Number of ids in species-block not equal to number of species");
616 : :
617 : : // gamma
618 [ + - ][ + - ]: 18 : checkStoreMatProp(sol_spc[i+1], "gamma", nspec,
[ - + ][ + - ]
[ - - ]
619 : : spci_deck.get< tag::gamma >());
620 : : // R
621 [ + - ][ + - ]: 18 : checkStoreMatProp(sol_spc[i+1], "R", nspec,
[ - + ][ + - ]
[ - - ]
622 : : spci_deck.get< tag::R >());
623 : : // cp_coeff
624 [ + - ][ + - ]: 18 : checkStoreMatPropVecVec(sol_spc[i+1], "cp_coeff", nspec, 3, 8,
[ - + ][ + - ]
[ - - ]
625 : : spci_deck.get< tag::cp_coeff >());
626 : : // t_range
627 [ + - ][ + - ]: 18 : checkStoreMatPropVec(sol_spc[i+1], "t_range", nspec, 4,
[ - + ][ + - ]
[ - - ]
628 : : spci_deck.get< tag::t_range >());
629 : : // dH_ref
630 [ + - ][ + - ]: 18 : checkStoreMatProp(sol_spc[i+1], "dH_ref", nspec,
[ - + ][ + - ]
[ - - ]
631 : : spci_deck.get< tag::dH_ref >());
632 : : }
633 : :
634 : : // Generate mapping between material index and eos parameter index
635 : : auto& eosmap = gideck.get< tag::matidxmap, tag::eosidx >();
636 : : auto& idxmap = gideck.get< tag::matidxmap, tag::matidx >();
637 : : auto& solidxmap = gideck.get< tag::matidxmap, tag::solidx >();
638 [ + + ]: 252 : for (auto midx : mati_deck.get< tag::id >()) {
639 : 152 : midx -= 1;
640 [ - + ]: 152 : eosmap[midx] = mtypei;
641 : 152 : idxmap[midx] = imatcntr;
642 [ - + ]: 152 : if (is_solid) {
643 : : // add to solid-counter
644 : 0 : ++isolcntr;
645 : 0 : solidxmap[midx] = isolcntr;
646 : : }
647 : 152 : ++imatcntr;
648 : : }
649 : : // end of materials for this eos, thus reset index counter
650 : : imatcntr = 0;
651 : : // increment material-type/eos-type index counter
652 : : ++mtypei;
653 : : }
654 : :
655 : : // Error checking on material ids
656 : : // -------------------------------------------------------------------------
657 : :
658 : : // Total number of materials
659 [ - + ]: 100 : if (tmat != nmat)
660 [ - - ][ - - ]: 0 : Throw("The total number of materials in all the material blocks (" +
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
661 : : std::to_string(tmat) +
662 : : ") is not equal to the number of materials specified 'nmat'.");
663 : :
664 : : // Contiguous and 1-based material ids
665 [ - + ]: 100 : if (*matidset.begin() != 1)
666 [ - - ][ - - ]: 0 : Throw("Material ids specified in material blocks not one-based. "
[ - - ][ - - ]
[ - - ][ - - ]
667 : : "Material ids must begin with one.");
668 : : std::size_t icount(1);
669 [ + + ]: 252 : for (auto midx : matidset) {
670 [ - + ]: 152 : if (midx != icount)
671 [ - - ][ - - ]: 0 : Throw("Material ids specified in material blocks have a gap. "
[ - - ][ - - ]
[ - - ][ - - ]
672 : : "Material ids must be contiguous.");
673 : 152 : ++icount;
674 : : }
675 : :
676 : : // Set up number of PDEs for multimat
677 [ + + ]: 100 : if (gideck.get< tag::pde >() == inciter::ctr::PDEType::MULTIMAT) {
678 : 32 : auto ntot = nmat + nmat + 3 + nmat;
679 : : // if solid EOS, add components
680 : : const auto& solidx = gideck.get< tag::matidxmap, tag::solidx >();
681 [ + + ]: 116 : for (std::size_t i=0; i<solidx.size(); ++i) {
682 [ - + ]: 84 : if (solidx[i] > 0)
683 : 0 : ntot += 9;
684 : : }
685 : 32 : gideck.get< tag::ncomp >() = ntot;
686 : : }
687 : : }
688 : :
689 : : // Mesh specification block (for overset)
690 : : // ---------------------------------------------------------------------------
691 [ + - ][ + + ]: 192 : if (lua_ideck["mesh"].valid()) {
692 : : const sol::table& lua_mesh = lua_ideck["mesh"];
693 : : auto& mesh_deck = gideck.get< tag::mesh >();
694 [ + - ][ + - ]: 11 : mesh_deck.resize(lua_mesh.size());
695 : :
696 [ + + ]: 23 : for (std::size_t i=0; i<mesh_deck.size(); ++i) {
697 : :
698 [ + - ][ + - ]: 36 : checkBlock< inciter::ctr::meshList::Keys >(lua_mesh[i+1], "mesh");
[ + - ][ - + ]
[ - - ]
699 : :
700 : : // filename
701 [ + - ][ + - ]: 48 : storeIfSpecd< std::string >(lua_mesh[i+1], "filename",
[ + - ][ - + ]
[ - + ][ - - ]
702 [ + - ]: 12 : mesh_deck[i].get< tag::filename >(), "");
703 : :
704 : : // location
705 [ + - ][ + - ]: 48 : storeVecIfSpecd< tk::real >(lua_mesh[i+1], "location",
[ + - ][ - + ]
[ + - ][ - - ]
706 [ + - ]: 12 : mesh_deck[i].get< tag::location >(), {0.0, 0.0, 0.0});
707 [ - + ]: 12 : if (mesh_deck[i].get< tag::location >().size() != 3)
708 [ - - ][ - - ]: 0 : Throw("Mesh location requires 3 coordinates.");
[ - - ][ - - ]
[ - - ][ - - ]
709 : :
710 : : // orientation
711 [ + - ][ + - ]: 48 : storeVecIfSpecd< tk::real >(lua_mesh[i+1], "orientation",
[ + - ][ - + ]
[ + - ][ - - ]
712 [ + - ]: 12 : mesh_deck[i].get< tag::orientation >(), {0.0, 0.0, 0.0});
713 [ - + ]: 12 : if (mesh_deck[i].get< tag::orientation >().size() != 3)
714 [ - - ][ - - ]: 0 : Throw("Mesh orientation requires 3 rotation angles.");
[ - - ][ - - ]
[ - - ][ - - ]
715 : :
716 : : // mass
717 [ + - ][ + - ]: 36 : storeIfSpecd< tk::real >(lua_mesh[i+1], "mass",
[ + - ][ - + ]
[ - - ]
718 : : mesh_deck[i].get< tag::mass >(), 0.0);
719 : :
720 : : // moment of inertia. this is currently only configured for planar motion
721 [ + - ][ + - ]: 36 : storeIfSpecd< tk::real >(lua_mesh[i+1], "moment_of_inertia",
[ + - ][ - - ]
722 [ + - ]: 12 : mesh_deck[i].get< tag::moment_of_inertia >(), 0.0);
723 : :
724 : : // center of mass
725 [ + - ][ + - ]: 48 : storeVecIfSpecd< tk::real >(lua_mesh[i+1], "center_of_mass",
[ + - ][ - + ]
[ + - ][ - - ]
726 [ + - ]: 12 : mesh_deck[i].get< tag::center_of_mass >(), {0.0, 0.0, 0.0});
727 [ - + ]: 12 : if (mesh_deck[i].get< tag::center_of_mass >().size() != 3)
728 [ - - ][ - - ]: 0 : Throw("Mesh center of mass requires 3 coordinates.");
[ - - ][ - - ]
[ - - ][ - - ]
729 : :
730 : : // Transfer object
731 [ + + ]: 12 : if (i > 0) {
732 [ + - ][ - - ]: 1 : gideck.get< tag::transfer >().emplace_back( 0, i );
733 : :
734 : : // assign depvar
735 : 1 : ++depvar_cnt;
736 [ + - ]: 1 : gideck.get< tag::depvar >().push_back(depvar_cnt);
737 : :
738 : : // add depvar to deck::depvars so it can be selected as outvar later
739 : : tk::grm::depvars.insert(depvar_cnt);
740 : : }
741 : : }
742 : : }
743 : : else {
744 : : // TODO: remove double-specification of defaults
745 : : auto& mesh_deck = gideck.get< tag::mesh >();
746 [ + - ]: 181 : mesh_deck.resize(1);
747 [ + - ]: 181 : mesh_deck[0].get< tag::filename >() =
748 : : gideck.get< tag::cmd, tag::io, tag::input >();
749 [ + - ]: 181 : mesh_deck[0].get< tag::location >() = {0.0, 0.0, 0.0};
750 [ + - ]: 181 : mesh_deck[0].get< tag::orientation >() = {0.0, 0.0, 0.0};
751 : 181 : mesh_deck[0].get< tag::mass >() = 0.0;
752 : 181 : mesh_deck[0].get< tag::moment_of_inertia >() = 0.0;
753 [ + - ]: 181 : mesh_deck[0].get< tag::center_of_mass >() = {0.0, 0.0, 0.0};
754 : : }
755 : :
756 : : Assert(gideck.get< tag::mesh >().size() == gideck.get< tag::depvar >().size(),
757 : : "Number of depvar not equal to the number of meshes.");
758 : :
759 : : // Rigid body motion block for overset meshes
760 : : // ---------------------------------------------------------------------------
761 [ + - ][ - + ]: 192 : if (lua_ideck["rigid_body_motion"].valid()) {
762 : :
763 : : Assert(gideck.get< tag::mesh >().size() > 1,
764 : : "Multiple meshes (overset) needed for rigid body motion.");
765 : :
766 : : // check that rigid body mass is provided
767 [ - - ]: 0 : const auto mesh_deck = gideck.get< tag::mesh >();
768 [ - - ]: 0 : for (std::size_t i=1; i<mesh_deck.size(); ++i) {
769 : : Assert(mesh_deck[i].get< tag::mass >() > 1e-10,
770 : : "Mass of body required for overset meshes with rigid body motion.");
771 : : }
772 : :
773 : : auto& rbm_deck = gideck.get< tag::rigid_body_motion >();
774 : :
775 [ - - ]: 0 : rbm_deck.get< tag::rigid_body_movt >() = true;
776 : :
777 : : // degrees of freedom
778 [ - - ][ - - ]: 0 : storeIfSpecd< std::size_t >(
[ - - ][ - - ]
779 : : lua_ideck["rigid_body_motion"], "rigid_body_dof",
780 : : rbm_deck.get< tag::rigid_body_dof >(), 3);
781 [ - - ][ - - ]: 0 : if (rbm_deck.get< tag::rigid_body_dof >() != 3 &&
782 : : rbm_deck.get< tag::rigid_body_dof >() != 6)
783 [ - - ][ - - ]: 0 : Throw("Only 3 or 6 rigid body DOFs supported.");
[ - - ][ - - ]
[ - - ][ - - ]
784 : :
785 : : // symmetry plane
786 [ - - ][ - - ]: 0 : storeIfSpecd< std::size_t >(
[ - - ][ - - ]
787 : : lua_ideck["rigid_body_motion"], "symmetry_plane",
788 : : rbm_deck.get< tag::symmetry_plane >(), 0);
789 [ - - ]: 0 : if (rbm_deck.get< tag::symmetry_plane >() > 3)
790 [ - - ][ - - ]: 0 : Throw("Rigid body motion symmetry plane must be 1(x), 2(y), or 3(z).");
[ - - ][ - - ]
[ - - ][ - - ]
791 [ - - ]: 0 : if (rbm_deck.get< tag::symmetry_plane >() == 0 &&
792 [ - - ]: 0 : rbm_deck.get< tag::rigid_body_dof >() == 3)
793 [ - - ][ - - ]: 0 : Throw(
[ - - ][ - - ]
[ - - ][ - - ]
794 : : "Rigid body motion symmetry plane must be specified for 3 DOF motion.");
795 : : // reset to 0-based indexing
796 : 0 : rbm_deck.get< tag::symmetry_plane >() -= 1;
797 : : }
798 : : else {
799 : : // TODO: remove double-specification of defaults
800 : : auto& rbm_deck = gideck.get< tag::rigid_body_motion >();
801 : 192 : rbm_deck.get< tag::rigid_body_movt >() = false;
802 : 192 : rbm_deck.get< tag::rigid_body_dof >() = 0;
803 : 192 : rbm_deck.get< tag::symmetry_plane >() = 0;
804 : : }
805 : :
806 : : // Field output block
807 : : // ---------------------------------------------------------------------------
808 [ + - ][ + - ]: 192 : if (lua_ideck["field_output"].valid()) {
809 : :
810 [ + - ][ + - ]: 576 : checkBlock< inciter::ctr::fieldOutputList::Keys >(lua_ideck["field_output"],
[ - + ][ + - ]
[ - - ]
811 : : "field_output");
812 : :
813 : : auto& fo_deck = gideck.get< tag::field_output >();
814 : :
815 : : // interval iteration
816 [ + - ][ + - ]: 576 : storeIfSpecd< uint32_t >(
[ - + ][ + - ]
[ - - ]
817 : : lua_ideck["field_output"], "interval",
818 : : fo_deck.get< tag::interval >(),
819 : : std::numeric_limits< uint32_t >::max());
820 : :
821 : : // interval physical time
822 [ + - ][ + - ]: 576 : storeIfSpecd< tk::real >(
[ - + ][ + - ]
[ - - ]
823 : : lua_ideck["field_output"], "time_interval",
824 : : fo_deck.get< tag::time_interval >(),
825 : : std::numeric_limits< tk::real >::max());
826 : :
827 : : // interval time range
828 [ + - ][ + - ]: 576 : storeVecIfSpecd< tk::real >(
[ - + ][ - + ]
[ + - ][ - - ]
829 : : lua_ideck["field_output"], "time_range",
830 : : fo_deck.get< tag::time_range >(), {});
831 : :
832 : : // refined mesh field output
833 [ + - ][ + - ]: 576 : storeIfSpecd< bool >(
[ - + ][ - - ]
834 : : lua_ideck["field_output"], "refined", fo_deck.get< tag::refined >(),
835 : : false);
836 [ + - ]: 192 : gideck.get< tag::cmd, tag::io, tag::refined >() = fo_deck.get< tag::refined >();
837 : :
838 : : // filetype
839 [ + - ][ + - ]: 576 : storeOptIfSpecd< tk::ctr::FieldFileType, tk::ctr::FieldFile >(
[ - + ][ + - ]
[ - - ]
840 : : lua_ideck["field_output"], "filetype", fo_deck.get< tag::filetype >(),
841 : : tk::ctr::FieldFileType::EXODUSII);
842 : :
843 : : // sidesets for field output
844 [ + - ][ + - ]: 576 : storeVecIfSpecd< uint64_t >(
[ - + ][ - + ]
[ + + ][ - - ]
845 : : lua_ideck["field_output"], "sideset", fo_deck.get< tag::sideset >(), {});
846 : :
847 : : // Assign outvar
848 : : auto& foutvar = fo_deck.get< tag::outvar >();
849 : : std::size_t nevar(0), nnvar(0), tensorcompvar(0);
850 : : std::size_t nmat(1);
851 [ + + ]: 192 : if (gideck.get< tag::pde >() == inciter::ctr::PDEType::MULTIMAT)
852 : 32 : nmat = gideck.get< tag::multimat, tag::nmat >();
853 : :
854 : : // elem aliases
855 : 192 : std::vector< std::string > elemalias;
856 [ + - ][ + + ]: 192 : if (lua_ideck["field_output"]["elemvar"].valid())
857 [ + - ]: 178 : nevar = sol::table(lua_ideck["field_output"]["elemvar"]).size();
858 [ + - ][ + - ]: 576 : storeVecIfSpecd< std::string >(
[ - + ][ - - ]
859 : : lua_ideck["field_output"], "elemalias", elemalias,
860 [ + - ][ + - ]: 384 : std::vector< std::string >(nevar, ""));
[ - + ][ + - ]
[ - - ]
861 : :
862 : : // node aliases
863 : 192 : std::vector< std::string > nodealias;
864 [ + - ][ + + ]: 192 : if (lua_ideck["field_output"]["nodevar"].valid())
865 [ + - ]: 76 : nnvar = sol::table(lua_ideck["field_output"]["nodevar"]).size();
866 [ + - ][ + - ]: 576 : storeVecIfSpecd< std::string >(
[ - + ][ - - ]
867 : : lua_ideck["field_output"], "nodealias", nodealias,
868 [ + - ][ + - ]: 384 : std::vector< std::string >(nnvar, ""));
[ - + ][ - - ]
869 : :
870 : : // error check on aliases
871 [ - + ]: 192 : if (elemalias.size() != nevar)
872 [ - - ][ - - ]: 0 : Throw("elemalias should have the same size as elemvar.");
[ - - ][ - - ]
[ - - ][ - - ]
873 [ - + ]: 192 : if (nodealias.size() != nnvar)
874 [ - - ][ - - ]: 0 : Throw("nodealias should have the same size as nodevar.");
[ - - ][ - - ]
[ - - ][ - - ]
875 : :
876 : : // element variables
877 [ + - ][ + + ]: 192 : if (lua_ideck["field_output"]["elemvar"].valid()) {
878 [ + + ]: 510 : for (std::size_t i=0; i<nevar; ++i) {
879 [ + - ]: 421 : std::string varname(lua_ideck["field_output"]["elemvar"][i+1]);
880 [ + - ]: 421 : std::string alias(elemalias[i]);
881 : : // add extra outvars for tensor components
882 : : if (varname.find("_tensor") != std::string::npos) tensorcompvar += 8;
883 [ + - ]: 421 : addOutVar(varname, alias, gideck.get< tag::depvar >(), nmat,
884 : : nspec, gideck.get< tag::pde >(), tk::Centering::ELEM, foutvar);
885 : : }
886 : : }
887 : :
888 : : // node variables
889 [ + - ][ + + ]: 192 : if (lua_ideck["field_output"]["nodevar"].valid()) {
890 [ + + ]: 244 : for (std::size_t i=0; i<nnvar; ++i) {
891 [ + - ]: 206 : std::string varname(lua_ideck["field_output"]["nodevar"][i+1]);
892 [ + - ]: 206 : std::string alias(nodealias[i]);
893 : : // add extra outvars for tensor components
894 : : if (varname.find("_tensor") != std::string::npos) tensorcompvar += 8;
895 [ + - ]: 206 : addOutVar(varname, alias, gideck.get< tag::depvar >(), nmat,
896 : : nspec, gideck.get< tag::pde >(), tk::Centering::NODE, foutvar);
897 : : }
898 : : }
899 : :
900 : : Assert(foutvar.size() == (nevar + nnvar + tensorcompvar),
901 : : "Incorrectly sized outvar vector.");
902 : : }
903 : : else {
904 : : // TODO: remove double-specification of defaults
905 : : auto& fo_deck = gideck.get< tag::field_output >();
906 : 0 : fo_deck.get< tag::interval >() =
907 : : std::numeric_limits< uint32_t >::max();
908 [ - - ]: 0 : fo_deck.get< tag::time_interval >() =
909 : : std::numeric_limits< tk::real >::max();
910 : : fo_deck.get< tag::time_range >() = {};
911 : 0 : fo_deck.get< tag::refined >() = false;
912 [ - - ]: 0 : fo_deck.get< tag::filetype >() = tk::ctr::FieldFileType::EXODUSII;
913 : : fo_deck.get< tag::sideset >() = {};
914 : : }
915 : :
916 : : // Diagnostics output block
917 : : // ---------------------------------------------------------------------------
918 [ + - ][ + + ]: 192 : if (lua_ideck["diagnostics"].valid()) {
919 : :
920 [ + - ][ + - ]: 312 : checkBlock< inciter::ctr::diagnosticsList::Keys >(lua_ideck["diagnostics"],
[ - + ][ + - ]
[ - - ]
921 : : "diagnostics");
922 : :
923 : : auto& diag_deck = gideck.get< tag::diagnostics >();
924 : :
925 : : // interval iteration
926 [ + - ][ + - ]: 312 : storeIfSpecd< uint32_t >(
[ - + ][ + - ]
[ - - ]
927 : : lua_ideck["diagnostics"], "interval",
928 : : diag_deck.get< tag::interval >(), 1);
929 : :
930 : : // error norm
931 [ + - ][ + - ]: 312 : storeOptIfSpecd< tk::ctr::ErrorType, tk::ctr::Error >(
[ - + ][ + - ]
[ - - ]
932 : : lua_ideck["diagnostics"], "error", diag_deck.get< tag::error >(),
933 : : tk::ctr::ErrorType::L2);
934 : :
935 : : // float format
936 [ + - ][ + - ]: 312 : storeOptIfSpecd< tk::ctr::TxtFloatFormatType, tk::ctr::TxtFloatFormat >(
[ - + ][ - - ]
937 : : lua_ideck["diagnostics"], "format", diag_deck.get< tag::format >(),
938 : : tk::ctr::TxtFloatFormatType::DEFAULT);
939 : :
940 : : // precision
941 [ + - ][ + - ]: 312 : storeIfSpecd< std::streamsize >(
[ - + ][ - - ]
942 : : lua_ideck["diagnostics"], "precision",
943 : : diag_deck.get< tag::precision >(), std::cout.precision());
944 : : }
945 : : else {
946 : : // TODO: remove double-specification of defaults
947 : : auto& diag_deck = gideck.get< tag::diagnostics >();
948 : 88 : diag_deck.get< tag::interval >() = 1;
949 : 88 : diag_deck.get< tag::error >() = tk::ctr::ErrorType::L2;
950 : 88 : diag_deck.get< tag::format >() = tk::ctr::TxtFloatFormatType::DEFAULT;
951 : 88 : diag_deck.get< tag::precision >() = std::cout.precision();
952 : : }
953 : :
954 : : // History output block
955 : : // ---------------------------------------------------------------------------
956 [ + - ][ + + ]: 192 : if (lua_ideck["history_output"].valid()) {
957 : :
958 [ + - ][ + - ]: 12 : checkBlock< inciter::ctr::historyOutputList::Keys >(
[ - + ][ + - ]
[ - - ]
959 : : lua_ideck["history_output"], "history_output");
960 : :
961 : : auto& hist_deck = gideck.get< tag::history_output >();
962 : :
963 : : // interval iteration
964 [ + - ][ + - ]: 12 : storeIfSpecd< uint32_t >(
[ - + ][ + - ]
[ - - ]
965 : : lua_ideck["history_output"], "interval",
966 : : hist_deck.get< tag::interval >(),
967 : : std::numeric_limits< uint32_t >::max());
968 : :
969 : : // interval time
970 [ + - ][ + - ]: 12 : storeIfSpecd< tk::real >(
[ - + ][ + - ]
[ - - ]
971 : : lua_ideck["history_output"], "time_interval",
972 : : hist_deck.get< tag::time_interval >(),
973 : : std::numeric_limits< tk::real >::max());
974 : :
975 : : // interval time range
976 [ + - ][ + - ]: 12 : storeVecIfSpecd< tk::real >(
[ - + ][ - + ]
[ + - ][ - - ]
977 : : lua_ideck["history_output"], "time_range",
978 : : hist_deck.get< tag::time_range >(), {});
979 : :
980 : : // point probes
981 [ + - ][ + - ]: 4 : if (lua_ideck["history_output"]["point"].valid()) {
982 : : const sol::table& sol_pt = lua_ideck["history_output"]["point"];
983 [ + - ][ + - ]: 4 : hist_deck.get< tag::point >().resize(sol_pt.size());
984 : :
985 [ + + ]: 12 : for (std::size_t i=0; i<hist_deck.get< tag::point >().size(); ++i) {
986 : : auto& pti = hist_deck.get< tag::point >()[i];
987 [ + - ][ + - ]: 24 : storeIfSpecd< std::string >(
[ + - ][ - + ]
[ - + ][ + - ]
[ - - ]
988 [ + - ]: 8 : sol_pt[i+1], "id", pti.get< tag::id >(), "p");
989 [ + - ][ + - ]: 24 : storeVecIfSpecd< tk::real >(
[ - + ][ - + ]
[ - - ][ - - ]
990 : : sol_pt[i+1], "coord", pti.get< tag::coord >(), {});
991 : : }
992 : : }
993 : :
994 : : // float format
995 [ + - ][ + - ]: 12 : storeOptIfSpecd< tk::ctr::TxtFloatFormatType, tk::ctr::TxtFloatFormat >(
[ - + ][ - - ]
996 : : lua_ideck["history_output"], "format", hist_deck.get< tag::format >(),
997 : : tk::ctr::TxtFloatFormatType::DEFAULT);
998 : :
999 : : // precision
1000 [ + - ][ + - ]: 12 : storeIfSpecd< std::streamsize >(
[ - + ][ - - ]
1001 : : lua_ideck["history_output"], "precision",
1002 : : hist_deck.get< tag::precision >(), std::cout.precision());
1003 : :
1004 : : // error check point
1005 [ + + ]: 12 : for (std::size_t i=0; i<hist_deck.get< tag::point >().size(); ++i) {
1006 [ - + ]: 8 : if (hist_deck.get< tag::point >()[i].get< tag::coord >().size() != 3)
1007 [ - - ][ - - ]: 0 : Throw("Three reals required for point coordinates in history_output.");
[ - - ][ - - ]
[ - - ][ - - ]
1008 : : }
1009 : : }
1010 : : else {
1011 : : // TODO: remove double-specification of defaults
1012 : : auto& hist_deck = gideck.get< tag::history_output >();
1013 : 188 : hist_deck.get< tag::interval >() =
1014 : : std::numeric_limits< uint32_t >::max();
1015 [ + - ]: 188 : hist_deck.get< tag::time_interval >() =
1016 : : std::numeric_limits< tk::real >::max();
1017 : : hist_deck.get< tag::time_range >() = {};
1018 [ + - ]: 188 : hist_deck.get< tag::precision >() = std::cout.precision();
1019 [ + - ]: 188 : hist_deck.get< tag::point >().resize(0);
1020 : : }
1021 : :
1022 : : // ALE block
1023 : : // ---------------------------------------------------------------------------
1024 [ + - ]: 192 : gideck.get< tag::ale, tag::ale >() = false;
1025 [ + - ][ + + ]: 192 : if (lua_ideck["ale"].valid()) {
1026 : : auto& ale_deck = gideck.get< tag::ale >();
1027 [ + - ]: 10 : ale_deck.get< tag::ale >() = true;
1028 : :
1029 : : // Mesh velocity smoother
1030 : : storeOptIfSpecd< inciter::ctr::MeshVelocitySmootherType,
1031 [ + - ][ + - ]: 30 : inciter::ctr::MeshVelocitySmoother >(lua_ideck["ale"], "smoother",
[ - + ][ + - ]
[ - - ]
1032 : : ale_deck.get< tag::smoother >(), inciter::ctr::MeshVelocitySmootherType::NONE);
1033 : :
1034 : : // Mesh velocity
1035 : : storeOptIfSpecd< inciter::ctr::MeshVelocityType,
1036 [ + - ][ + - ]: 30 : inciter::ctr::MeshVelocity >(lua_ideck["ale"], "mesh_velocity",
[ - + ][ - - ]
1037 : : ale_deck.get< tag::mesh_velocity >(), inciter::ctr::MeshVelocityType::SINE);
1038 : :
1039 : : // Mesh motion direction
1040 [ + - ][ + - ]: 30 : storeVecIfSpecd< std::size_t >(lua_ideck["ale"], "mesh_motion",
[ + - ][ - + ]
[ + - ][ - - ]
1041 : : ale_deck.get< tag::mesh_motion >(), { 0, 1, 2 });
1042 : :
1043 : : // Mesh force
1044 [ + - ][ + - ]: 40 : storeVecIfSpecd< tk::real >(lua_ideck["ale"], "meshforce",
[ + - ][ - + ]
[ + - ][ + - ]
[ - - ]
1045 : : ale_deck.get< tag::meshforce >(), { 0, 0, 0, 0 });
1046 : :
1047 : : // Dirichlet
1048 [ + - ][ + - ]: 30 : storeVecIfSpecd< std::size_t >(lua_ideck["ale"], "dirichlet",
[ - + ][ - + ]
[ + - ][ - - ]
1049 : : ale_deck.get< tag::dirichlet >(), {});
1050 : :
1051 : : // Symmetry
1052 [ + - ][ + - ]: 30 : storeVecIfSpecd< std::size_t >(lua_ideck["ale"], "symmetry",
[ - + ][ - + ]
[ + - ][ - - ]
1053 : : ale_deck.get< tag::symmetry >(), {});
1054 : :
1055 : : // Move sidesets with user defined function
1056 [ + - ][ + + ]: 10 : if (lua_ideck["ale"]["move"].valid()) {
1057 : : const sol::table& sol_mv = lua_ideck["ale"]["move"];
1058 [ + - ][ + - ]: 2 : ale_deck.get< tag::move >().resize(sol_mv.size());
1059 : :
1060 [ + + ]: 4 : for (std::size_t i=0; i<ale_deck.get< tag::move >().size(); ++i) {
1061 : : auto& mvi = ale_deck.get< tag::move >()[i];
1062 [ + - ][ + - ]: 6 : storeOptIfSpecd< tk::ctr::UserTableType, tk::ctr::UserTable >(
[ - + ][ + - ]
[ - - ]
1063 [ + - ]: 2 : sol_mv[i+1], "fntype", mvi.get< tag::fntype >(),
1064 : : tk::ctr::UserTableType::POSITION);
1065 [ + - ][ + - ]: 6 : storeVecIfSpecd< uint64_t >(
[ - + ][ - + ]
[ + - ][ - - ]
1066 : : sol_mv[i+1], "sideset", mvi.get< tag::sideset >(), {});
1067 [ + - ][ + - ]: 6 : storeVecIfSpecd< tk::real >(
[ - + ][ - + ]
[ - - ][ - - ]
1068 : : sol_mv[i+1], "fn", mvi.get< tag::fn >(), {});
1069 : :
1070 : : // error checking on user-def function
1071 [ + - ]: 2 : if (mvi.get< tag::fn >().size() % 4 != 0)
1072 [ - - ][ - - ]: 0 : Throw("Incomplete user-defined function for ALE sideset movement. An "
[ - - ][ - - ]
[ - - ][ - - ]
1073 : : "R->R^3 function is expected, the number of descrete entries must be "
1074 : : "divisible by 4: one 'column' for the abscissa, and 3 for the "
1075 : : "ordinate.");
1076 : : }
1077 : : }
1078 : :
1079 : : // dv-CFL
1080 [ + - ][ + - ]: 30 : storeIfSpecd< tk::real >(lua_ideck["ale"], "dvcfl", ale_deck.get< tag::dvcfl >(),
[ - + ][ + - ]
[ - - ]
1081 : : 0.01);
1082 : :
1083 : : // Vorticity multiplier
1084 [ + - ][ + - ]: 30 : storeIfSpecd< tk::real >(lua_ideck["ale"], "vortmult",
[ - + ][ + - ]
[ - - ]
1085 : : ale_deck.get< tag::vortmult >(), 0.0);
1086 : :
1087 : : // Mesh velocity max iterations
1088 [ + - ][ + - ]: 30 : storeIfSpecd< std::size_t >(lua_ideck["ale"], "maxit",
[ - + ][ + - ]
[ - - ]
1089 : : ale_deck.get< tag::maxit >(), 5);
1090 : :
1091 : : // Mesh velocity max iterations
1092 [ + - ][ + - ]: 30 : storeIfSpecd< tk::real >(lua_ideck["ale"], "tolerance",
[ - + ][ - - ]
1093 : : ale_deck.get< tag::tolerance >(), 1e-2);
1094 : : }
1095 : :
1096 : : // AMR block
1097 : : // ---------------------------------------------------------------------------
1098 : 192 : gideck.get< tag::amr, tag::amr >() = false;
1099 [ + - ]: 192 : gideck.get< tag::amr, tag::maxlevels >() = 2; // this is needed for outref
1100 [ + - ][ + + ]: 192 : if (lua_ideck["amr"].valid()) {
1101 : : auto& amr_deck = gideck.get< tag::amr >();
1102 [ + - ]: 20 : amr_deck.get< tag::amr >() = true;
1103 : :
1104 : : // Initial refinement toggle
1105 [ + - ][ + - ]: 60 : storeIfSpecd< bool >(lua_ideck["amr"], "t0ref", amr_deck.get< tag::t0ref >(),
[ - + ][ + - ]
[ - - ]
1106 : : false);
1107 : :
1108 : : // Mesh refinement during time-stepping toggle
1109 [ + - ][ + - ]: 60 : storeIfSpecd< bool >(lua_ideck["amr"], "dtref", amr_deck.get< tag::dtref >(),
[ - + ][ + - ]
[ - - ]
1110 : : false);
1111 : :
1112 : : // Uniform mesh refinement during time-stepping toggle
1113 [ + - ][ + - ]: 60 : storeIfSpecd< bool >(lua_ideck["amr"], "dtref_uniform",
[ - + ][ + - ]
[ - - ]
1114 : : amr_deck.get< tag::dtref_uniform >(), false);
1115 : :
1116 : : // Mesh refinement frequency during time-stepping toggle
1117 [ + - ][ + - ]: 60 : storeIfSpecd< std::size_t >(lua_ideck["amr"], "dtfreq",
[ - + ][ + - ]
[ - - ]
1118 : : amr_deck.get< tag::dtfreq >(), 3);
1119 : :
1120 : : // Maximum AMR levels
1121 [ + - ][ + - ]: 60 : storeIfSpecd< std::size_t >(lua_ideck["amr"], "maxlevels",
[ - + ][ + - ]
[ - - ]
1122 : : amr_deck.get< tag::maxlevels >(), 2);
1123 : :
1124 : : // Initial AMR steps
1125 [ + - ][ + - ]: 60 : storeOptVecIfSpecd< inciter::ctr::AMRInitialType, inciter::ctr::AMRInitial >(
[ - + ][ - + ]
[ + - ][ - - ]
1126 : : lua_ideck["amr"], "initial", amr_deck.get< tag::initial >(), {});
1127 : :
1128 : : // Initial AMR coordinate based
1129 [ + - ][ + + ]: 20 : if (lua_ideck["amr"]["coords"].valid()) {
1130 : : auto rmax = std::numeric_limits< tk::real >::max() / 100;
1131 : :
1132 [ + - ][ + - ]: 3 : storeIfSpecd< tk::real >(lua_ideck["amr"]["coords"], "xminus",
[ - + ][ + - ]
[ - - ]
1133 : : amr_deck.get< tag::coords, tag::xminus >(), rmax);
1134 [ + - ][ + - ]: 3 : storeIfSpecd< tk::real >(lua_ideck["amr"]["coords"], "xplus",
[ - + ][ + - ]
[ - - ]
1135 : : amr_deck.get< tag::coords, tag::xplus >(), -rmax);
1136 : :
1137 [ + - ][ + - ]: 3 : storeIfSpecd< tk::real >(lua_ideck["amr"]["coords"], "yminus",
[ - + ][ + - ]
[ - - ]
1138 : : amr_deck.get< tag::coords, tag::yminus >(), rmax);
1139 [ + - ][ + - ]: 3 : storeIfSpecd< tk::real >(lua_ideck["amr"]["coords"], "yplus",
[ - + ][ + - ]
[ - - ]
1140 : : amr_deck.get< tag::coords, tag::yplus >(), -rmax);
1141 : :
1142 [ + - ][ + - ]: 3 : storeIfSpecd< tk::real >(lua_ideck["amr"]["coords"], "zminus",
[ - + ][ + - ]
[ - - ]
1143 : : amr_deck.get< tag::coords, tag::zminus >(), rmax);
1144 [ + - ][ + - ]: 3 : storeIfSpecd< tk::real >(lua_ideck["amr"]["coords"], "zplus",
[ - + ][ - - ]
1145 : : amr_deck.get< tag::coords, tag::zplus >(), -rmax);
1146 : : }
1147 : :
1148 : : // Initial AMR edgelist based
1149 [ + - ][ + - ]: 60 : storeVecIfSpecd< std::size_t >(lua_ideck["amr"], "edgelist",
[ - + ][ - + ]
[ - - ]
1150 : : amr_deck.get< tag::edgelist >(), {});
1151 [ - + ]: 20 : if (amr_deck.get< tag::edgelist >().size() % 2 != 0)
1152 [ - - ][ - - ]: 0 : Throw("The number of edge-nodes, marking edges as pairs of nodes, used "
[ - - ][ - - ]
[ - - ][ - - ]
1153 : : "for explicit tagging of edges for initial mesh refineoment, is odd "
1154 : : "(it must be even).");
1155 : :
1156 : : // Error type for AMR
1157 [ + - ][ + - ]: 60 : storeOptIfSpecd< inciter::ctr::AMRErrorType, inciter::ctr::AMRError >(
[ - + ][ + - ]
[ - - ]
1158 : : lua_ideck["amr"], "error", amr_deck.get< tag::error >(),
1159 : : inciter::ctr::AMRErrorType::JUMP);
1160 : :
1161 : : // Tolerances for refine/de-refine
1162 [ + - ][ + - ]: 60 : storeIfSpecd< tk::real >(lua_ideck["amr"], "tol_refine",
[ - + ][ + - ]
[ - - ]
1163 : : amr_deck.get< tag::tol_refine >(), 0.2);
1164 [ + - ][ + - ]: 60 : storeIfSpecd< tk::real >(lua_ideck["amr"], "tol_derefine",
[ - + ][ - - ]
1165 : : amr_deck.get< tag::tol_derefine >(), 0.05);
1166 : : }
1167 : :
1168 : : // p-refinement block
1169 : : // ---------------------------------------------------------------------------
1170 [ + - ]: 192 : gideck.get< tag::pref, tag::pref >() = false;
1171 [ + - ][ + + ]: 192 : if (lua_ideck["pref"].valid()) {
1172 : : auto& pref_deck = gideck.get< tag::pref >();
1173 [ + - ]: 12 : pref_deck.get< tag::pref >() = true;
1174 : :
1175 : : // p-ref indicator type
1176 : : storeOptIfSpecd< inciter::ctr::PrefIndicatorType,
1177 [ + - ][ + - ]: 36 : inciter::ctr::PrefIndicator >(lua_ideck["pref"], "indicator",
[ - + ][ + - ]
[ - - ]
1178 : : pref_deck.get< tag::indicator >(),
1179 : : inciter::ctr::PrefIndicatorType::SPECTRAL_DECAY);
1180 : :
1181 : : // p-ref max degrees-of-freedom per cell
1182 [ + - ][ + - ]: 36 : storeIfSpecd< std::size_t >(lua_ideck["pref"], "ndofmax",
[ - + ][ + - ]
[ - - ]
1183 : : pref_deck.get< tag::ndofmax >(), 10);
1184 : :
1185 : : // p-ref tolerance
1186 [ + - ][ + - ]: 36 : storeIfSpecd< tk::real >(lua_ideck["pref"], "tolref",
[ - + ][ - - ]
1187 : : pref_deck.get< tag::tolref >(), 0.5);
1188 : :
1189 : : // error checking on the tolerance
1190 [ + - ][ - + ]: 12 : if (pref_deck.get< tag::tolref >() < 0.0 || pref_deck.get< tag::tolref >() > 1.0)
1191 [ - - ][ - - ]: 0 : Throw("The p-refinement tolerance must be a real number "
[ - - ][ - - ]
[ - - ][ - - ]
1192 : : "between 0.0 and 1.0, both inclusive.");
1193 : : }
1194 : :
1195 : : // Boundary conditions block
1196 : : // ---------------------------------------------------------------------------
1197 [ + - ][ + + ]: 192 : if (lua_ideck["bc"].valid()) {
1198 : : std::set< std::size_t > totalmesh;
1199 : : const sol::table& sol_bc = lua_ideck["bc"];
1200 : : auto& bc_deck = gideck.get< tag::bc >();
1201 [ + - ][ + - ]: 142 : bc_deck.resize(sol_bc.size());
1202 : :
1203 [ + + ]: 285 : for (std::size_t i=0; i<bc_deck.size(); ++i) {
1204 : :
1205 [ + - ][ + - ]: 429 : checkBlock< inciter::ctr::bcList::Keys >(sol_bc[i+1], "bc");
[ + - ][ - + ]
[ - - ]
1206 : :
1207 [ + - ][ + - ]: 429 : storeVecIfSpecd< std::size_t >(sol_bc[i+1], "mesh",
[ + - ][ - + ]
[ + - ][ - - ]
1208 [ + - ]: 143 : bc_deck[i].get< tag::mesh >(), {1});
1209 : : // collect meshes for error checking
1210 : : totalmesh.insert(bc_deck[i].get< tag::mesh >().begin(),
1211 : 143 : bc_deck[i].get< tag::mesh >().end());
1212 : :
1213 [ + - ][ + - ]: 429 : storeVecIfSpecd< uint64_t >(sol_bc[i+1], "dirichlet",
[ - + ][ - + ]
[ + - ][ - - ]
1214 [ + - ]: 143 : bc_deck[i].get< tag::dirichlet >(), {});
1215 : :
1216 [ + - ][ + - ]: 429 : storeVecIfSpecd< uint64_t >(sol_bc[i+1], "symmetry",
[ - + ][ - + ]
[ + - ][ - - ]
1217 [ + - ]: 143 : bc_deck[i].get< tag::symmetry >(), {});
1218 : :
1219 [ + - ][ + + ]: 143 : if (sol_bc[i+1]["inlet"].valid()) {
1220 : 9 : const sol::table& sol_inbc = sol_bc[i+1]["inlet"];
1221 [ + - ]: 9 : auto& inbc_deck = bc_deck[i].get< tag::inlet >();
1222 [ + - ][ + - ]: 9 : inbc_deck.resize(sol_inbc.size());
1223 : :
1224 [ + + ]: 18 : for (std::size_t j=0; j<inbc_deck.size(); ++j) {
1225 [ + - ][ + - ]: 27 : storeVecIfSpecd< uint64_t >(sol_inbc[j+1], "sideset",
[ + - ][ - + ]
[ - + ][ - - ]
1226 : : inbc_deck[j].get< tag::sideset >(), {});
1227 : :
1228 [ + - ][ + - ]: 27 : storeVecIfSpecd< tk::real >(sol_inbc[j+1], "velocity",
[ + - ][ - + ]
[ + - ][ - - ]
[ - - ]
1229 [ + - ]: 9 : inbc_deck[j].get< tag::velocity >(), {0.0, 0.0, 0.0});
1230 [ - + ]: 9 : if (inbc_deck[j].get< tag::velocity >().size() != 3)
1231 [ - - ][ - - ]: 0 : Throw("Inlet velocity requires 3 components.");
[ - - ][ - - ]
[ - - ][ - - ]
1232 : :
1233 [ + - ][ + - ]: 27 : storeIfSpecd< tk::real >(sol_inbc[j+1], "pressure",
[ - + ][ - - ]
1234 : : inbc_deck[j].get< tag::pressure >(), 0.0);
1235 : :
1236 [ + - ][ + - ]: 27 : storeIfSpecd< tk::real >(sol_inbc[j+1], "temperature",
[ - + ][ - - ]
1237 [ + - ]: 9 : inbc_deck[j].get< tag::temperature >(), 0.0);
1238 : :
1239 [ + - ][ + - ]: 27 : storeIfSpecd< std::size_t >(sol_inbc[j+1], "materialid",
[ - + ][ - - ]
1240 [ + - ]: 9 : inbc_deck[j].get< tag::materialid >(), 1);
1241 : : }
1242 : : }
1243 : :
1244 [ + - ][ + - ]: 429 : storeVecIfSpecd< uint64_t >(sol_bc[i+1], "outlet",
[ - + ][ - + ]
[ + - ][ - - ]
1245 [ + - ]: 143 : bc_deck[i].get< tag::outlet >(), {});
1246 : :
1247 [ + - ][ + - ]: 429 : storeVecIfSpecd< uint64_t >(sol_bc[i+1], "farfield",
[ - + ][ - + ]
[ + - ][ - - ]
1248 [ + - ]: 143 : bc_deck[i].get< tag::farfield >(), {});
1249 : :
1250 [ + - ][ + - ]: 429 : storeVecIfSpecd< uint64_t >(sol_bc[i+1], "extrapolate",
[ - + ][ - + ]
[ + - ][ - - ]
1251 [ + - ]: 143 : bc_deck[i].get< tag::extrapolate >(), {});
1252 : :
1253 [ + - ][ + - ]: 429 : storeVecIfSpecd< uint64_t >(sol_bc[i+1], "noslipwall",
[ - + ][ - + ]
[ + - ][ - - ]
1254 [ + - ]: 143 : bc_deck[i].get< tag::noslipwall >(), {});
1255 : :
1256 : : // Time-dependent BC
1257 [ + - ][ + + ]: 143 : if (sol_bc[i+1]["timedep"].valid()) {
1258 : 2 : const sol::table& sol_tdbc = sol_bc[i+1]["timedep"];
1259 [ + - ]: 2 : auto& tdbc_deck = bc_deck[i].get< tag::timedep >();
1260 [ + - ][ + - ]: 2 : tdbc_deck.resize(sol_tdbc.size());
1261 : :
1262 [ + + ]: 4 : for (std::size_t j=0; j<tdbc_deck.size(); ++j) {
1263 [ + - ][ + - ]: 6 : storeVecIfSpecd< uint64_t >(sol_tdbc[j+1], "sideset",
[ + - ][ - + ]
[ - + ][ + - ]
[ - - ]
1264 : : tdbc_deck[j].get< tag::sideset >(), {});
1265 [ + - ][ + - ]: 6 : storeVecIfSpecd< tk::real >(sol_tdbc[j+1], "fn",
[ - + ][ - + ]
[ - - ][ - - ]
1266 [ + - ]: 2 : tdbc_deck[j].get< tag::fn >(), {});
1267 : :
1268 : : // error checking on user-def function
1269 [ + - ]: 2 : if (tdbc_deck[j].get< tag::fn >().size() % 6 != 0)
1270 [ - - ][ - - ]: 0 : Throw("Incomplete user-defined function for time-dependent BC. An "
[ - - ][ - - ]
[ - - ][ - - ]
1271 : : "R->R^5 function is expected, the number of descrete entries must "
1272 : : "be divisible by 6: one 'column' for the abscissa, and 5 for the "
1273 : : "ordinate.");
1274 : : }
1275 : : }
1276 : :
1277 : : // Velocity for inlet/farfield
1278 [ + - ][ + - ]: 429 : storeVecIfSpecd< tk::real >(sol_bc[i+1], "velocity",
[ + - ][ - + ]
[ + - ][ - - ]
1279 [ + - ]: 143 : bc_deck[i].get< tag::velocity >(), {0.0, 0.0, 0.0});
1280 [ - + ]: 143 : if (bc_deck[i].get< tag::velocity >().size() != 3)
1281 [ - - ][ - - ]: 0 : Throw("BC velocity requires 3 components.");
[ - - ][ - - ]
[ - - ][ - - ]
1282 : :
1283 : : // Pressure for inlet/outlet/farfield
1284 [ + - ][ + - ]: 429 : storeIfSpecd< tk::real >(sol_bc[i+1], "pressure",
[ - + ][ - - ]
1285 : : bc_deck[i].get< tag::pressure >(), 0.0);
1286 : :
1287 : : // Density for inlet/outlet/farfield
1288 [ + - ][ + - ]: 429 : storeIfSpecd< tk::real >(sol_bc[i+1], "density",
[ - + ][ - - ]
1289 [ + - ]: 143 : bc_deck[i].get< tag::density >(), 0.0);
1290 : :
1291 : : // Temperature for inlet/outlet/farfield
1292 [ + - ][ + - ]: 429 : storeIfSpecd< tk::real >(sol_bc[i+1], "temperature",
[ - + ][ - - ]
1293 [ + - ]: 143 : bc_deck[i].get< tag::temperature >(), 0.0);
1294 : :
1295 : : // Mass fractions for inlet/farfield
1296 [ + - ][ + - ]: 429 : storeVecIfSpecd< tk::real >(sol_bc[i+1], "mass_fractions",
[ - + ][ + - ]
[ - - ]
1297 [ + - ]: 143 : bc_deck[i].get< tag::mass_fractions >(),
1298 [ + - ][ - - ]: 143 : std::vector< tk::real >(nspec, 1.0/static_cast<tk::real>(nspec)));
1299 [ - + ]: 143 : if (bc_deck[i].get< tag::mass_fractions >().size() != nspec)
1300 [ - - ][ - - ]: 0 : Throw("BC mass fraction has incorrect number of species. "
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ]
1301 : : "Expected " + std::to_string(nspec));
1302 : :
1303 : : // Material-id for inlet/outlet/farfield
1304 [ + - ][ + - ]: 429 : storeIfSpecd< std::size_t >(sol_bc[i+1], "materialid",
[ - + ][ - - ]
1305 : : bc_deck[i].get< tag::materialid >(), 1);
1306 : : }
1307 : :
1308 : : // error checking on number of meshes
1309 [ - + ]: 142 : if (totalmesh.size() != gideck.get< tag::mesh >().size())
1310 [ - - ][ - - ]: 0 : Throw("Total meshes (" + std::to_string(gideck.get< tag::mesh >().size()) +
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
1311 : : ") not equal to the meshes on which BC's are specified (" +
1312 : : std::to_string(totalmesh.size()));
1313 : :
1314 : : // error checking on mesh ids
1315 : : std::size_t ic(1);
1316 [ + + ]: 285 : for (const auto& im : totalmesh) {
1317 [ - + ][ - - ]: 143 : if (im != ic) Throw("Non-contiguous mesh ids in BC-mesh");
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ]
1318 : 143 : ++ic;
1319 : : }
1320 : : }
1321 [ + + ][ - + ]: 50 : else if (gideck.get< tag::scheme >() == inciter::ctr::SchemeType::ALECG ||
1322 : : gideck.get< tag::scheme >() == inciter::ctr::SchemeType::OversetFE)
1323 [ + - ]: 50 : gideck.get< tag::bc >().resize(1);
1324 : : // error checking for unspecified BC's
1325 : : else
1326 [ - - ][ - - ]: 0 : Throw("No boundary conditions specified in input file.");
[ - - ][ - - ]
[ - - ][ - - ]
1327 : :
1328 : : // Initial condition block
1329 : : // ---------------------------------------------------------------------------
1330 [ + - ][ + + ]: 192 : if (lua_ideck["ic"].valid()) {
1331 : : auto& ic_deck = gideck.get< tag::ic >();
1332 : :
1333 [ + - ][ + - ]: 45 : checkBlock< inciter::ctr::icList::Keys >(lua_ideck["ic"], "ic");
[ - + ][ + - ]
[ - - ]
1334 : :
1335 : : // background IC values
1336 [ + - ][ + - ]: 45 : storeIfSpecd< std::size_t >(lua_ideck["ic"], "materialid",
[ - + ][ + - ]
[ - - ]
1337 : : ic_deck.get< tag::materialid >(), 1);
1338 : :
1339 [ + - ][ + - ]: 45 : storeIfSpecd< tk::real >(lua_ideck["ic"], "pressure",
[ - + ][ + - ]
[ - - ]
1340 : : ic_deck.get< tag::pressure >(), 0.0);
1341 : :
1342 [ + - ][ + - ]: 45 : storeIfSpecd< tk::real >(lua_ideck["ic"], "temperature",
[ - + ][ - - ]
1343 : : ic_deck.get< tag::temperature >(), 0.0);
1344 : :
1345 [ + - ][ + - ]: 45 : storeVecIfSpecd< tk::real >(lua_ideck["ic"], "mass_fractions",
[ - + ][ + - ]
[ - - ]
1346 : : ic_deck.get< tag::mass_fractions >(),
1347 [ + - ]: 15 : std::vector< tk::real >(nspec, 1.0/static_cast<tk::real>(nspec)));
1348 [ - + ]: 15 : if (ic_deck.get< tag::mass_fractions >().size() != nspec)
1349 [ - - ][ - - ]: 0 : Throw("IC mass fraction has incorrect number of species. "
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ]
1350 : : "Expected " + std::to_string(nspec));
1351 : :
1352 [ + - ][ + - ]: 45 : storeIfSpecd< tk::real >(lua_ideck["ic"], "density",
[ - + ][ + - ]
[ - - ]
1353 : : ic_deck.get< tag::density >(), 0.0);
1354 : :
1355 [ + - ][ + - ]: 45 : storeIfSpecd< tk::real >(lua_ideck["ic"], "energy",
[ - + ][ - - ]
1356 : : ic_deck.get< tag::energy >(), 0.0);
1357 : :
1358 [ + - ][ + - ]: 45 : storeVecIfSpecd< tk::real >(lua_ideck["ic"], "velocity",
[ + - ][ - + ]
[ + - ][ - - ]
1359 : : ic_deck.get< tag::velocity >(), {0.0, 0.0, 0.0});
1360 [ - + ]: 15 : if (ic_deck.get< tag::velocity >().size() != 3)
1361 [ - - ][ - - ]: 0 : Throw("Velocity in IC requires 3 components.");
[ - - ][ - - ]
[ - - ][ - - ]
1362 : :
1363 : : // IC box
1364 [ + - ][ + + ]: 15 : if (lua_ideck["ic"]["box"].valid()) {
1365 : : const sol::table& lua_box = lua_ideck["ic"]["box"];
1366 : : auto& box_deck = ic_deck.get< tag::box >();
1367 [ + - ][ + - ]: 8 : box_deck.resize(lua_box.size());
1368 : :
1369 [ + + ]: 17 : for (std::size_t i=0; i<box_deck.size(); ++i) {
1370 : :
1371 [ + - ][ + - ]: 27 : checkBlock< inciter::ctr::boxList::Keys >(lua_box[i+1], "box");
[ + - ][ - + ]
[ - - ]
1372 : :
1373 [ + - ][ + - ]: 27 : storeIfSpecd< std::size_t >(lua_box[i+1], "materialid",
[ - + ][ - - ]
1374 [ + - ]: 9 : box_deck[i].get< tag::materialid >(), 1);
1375 : :
1376 [ + - ][ + - ]: 27 : storeIfSpecd< tk::real >(lua_box[i+1], "volume",
[ - + ][ - - ]
1377 [ + - ]: 9 : box_deck[i].get< tag::volume >(), 0.0);
1378 : :
1379 [ + - ][ + - ]: 27 : storeIfSpecd< tk::real >(lua_box[i+1], "mass",
[ - + ][ - - ]
1380 [ + - ]: 9 : box_deck[i].get< tag::mass >(), 0.0);
1381 : :
1382 [ + - ][ + - ]: 27 : storeIfSpecd< tk::real >(lua_box[i+1], "density",
[ - + ][ - - ]
1383 [ + - ]: 9 : box_deck[i].get< tag::density >(), 0.0);
1384 : :
1385 [ + - ][ + - ]: 27 : storeVecIfSpecd< tk::real >(lua_box[i+1], "velocity",
[ + - ][ - + ]
[ + - ][ - - ]
1386 [ + - ]: 9 : box_deck[i].get< tag::velocity >(), {0.0, 0.0, 0.0});
1387 [ - + ]: 9 : if (box_deck[i].get< tag::velocity >().size() != 3)
1388 [ - - ][ - - ]: 0 : Throw("Velocity in IC box requires 3 components.");
[ - - ][ - - ]
[ - - ][ - - ]
1389 : :
1390 [ + - ][ + - ]: 27 : storeIfSpecd< tk::real >(lua_box[i+1], "pressure",
[ - + ][ - - ]
1391 : : box_deck[i].get< tag::pressure >(), 0.0);
1392 : :
1393 [ + - ][ + - ]: 27 : storeIfSpecd< tk::real >(lua_box[i+1], "energy",
[ - + ][ - - ]
1394 [ + - ]: 9 : box_deck[i].get< tag::energy >(), 0.0);
1395 : :
1396 [ + - ][ + - ]: 27 : storeIfSpecd< tk::real >(lua_box[i+1], "energy_content",
[ - + ][ - - ]
1397 [ + - ]: 9 : box_deck[i].get< tag::energy_content >(), 0.0);
1398 : :
1399 [ + - ][ + - ]: 27 : storeIfSpecd< tk::real >(lua_box[i+1], "temperature",
[ - + ][ - - ]
1400 [ + - ]: 9 : box_deck[i].get< tag::temperature >(), 0.0);
1401 : :
1402 [ + - ][ + - ]: 27 : storeVecIfSpecd< tk::real >(lua_box[i+1], "mass_fractions",
[ - + ][ + - ]
[ - - ]
1403 [ + - ]: 9 : box_deck[i].get< tag::mass_fractions >(),
1404 [ + - ]: 9 : std::vector< tk::real >(nspec, 1.0/static_cast<tk::real>(nspec)));
1405 [ - + ]: 9 : if (box_deck[i].get< tag::mass_fractions >().size() != nspec)
1406 [ - - ][ - - ]: 0 : Throw("IC box mass fraction has incorrect number of species. "
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ]
1407 : : "Expected " + std::to_string(nspec));
1408 : :
1409 [ + - ][ + - ]: 27 : storeIfSpecd< tk::real >(lua_box[i+1], "xmin",
[ - + ][ - - ]
1410 : : box_deck[i].get< tag::xmin >(), 0.0);
1411 : :
1412 [ + - ][ + - ]: 27 : storeIfSpecd< tk::real >(lua_box[i+1], "xmax",
[ - + ][ - - ]
1413 [ + - ]: 9 : box_deck[i].get< tag::xmax >(), 0.0);
1414 : :
1415 [ + - ][ + - ]: 27 : storeIfSpecd< tk::real >(lua_box[i+1], "ymin",
[ - + ][ - - ]
1416 [ + - ]: 9 : box_deck[i].get< tag::ymin >(), 0.0);
1417 : :
1418 [ + - ][ + - ]: 27 : storeIfSpecd< tk::real >(lua_box[i+1], "ymax",
[ - + ][ - - ]
1419 [ + - ]: 9 : box_deck[i].get< tag::ymax >(), 0.0);
1420 : :
1421 [ + - ][ + - ]: 27 : storeIfSpecd< tk::real >(lua_box[i+1], "zmin",
[ - + ][ - - ]
1422 [ + - ]: 9 : box_deck[i].get< tag::zmin >(), 0.0);
1423 : :
1424 [ + - ][ + - ]: 27 : storeIfSpecd< tk::real >(lua_box[i+1], "zmax",
[ - + ][ - - ]
1425 [ + - ]: 9 : box_deck[i].get< tag::zmax >(), 0.0);
1426 : :
1427 [ + - ][ + - ]: 27 : storeVecIfSpecd< tk::real >(lua_box[i+1], "orientation",
[ + - ][ - + ]
[ + - ][ - - ]
1428 [ + - ]: 9 : box_deck[i].get< tag::orientation >(), {0.0, 0.0, 0.0});
1429 [ - + ]: 9 : if (box_deck[i].get< tag::orientation >().size() != 3)
1430 [ - - ][ - - ]: 0 : Throw("Orientation in IC box requires 3 rotation angles.");
[ - - ][ - - ]
[ - - ][ - - ]
1431 : :
1432 [ + - ][ + - ]: 27 : storeOptIfSpecd< inciter::ctr::InitiateType, inciter::ctr::Initiate >(
[ - + ][ - - ]
1433 : : lua_box[i+1], "initiate", box_deck[i].get< tag::initiate >(),
1434 : : inciter::ctr::InitiateType::IMPULSE);
1435 : :
1436 [ + - ][ + - ]: 27 : storeVecIfSpecd< tk::real >(lua_box[i+1], "point",
[ + - ][ - + ]
[ + - ][ - - ]
[ - - ]
1437 [ + - ]: 9 : box_deck[i].get< tag::point >(), {0.0, 0.0, 0.0});
1438 [ - + ]: 9 : if (box_deck[i].get< tag::point >().size() != 3)
1439 [ - - ][ - - ]: 0 : Throw("Point in IC box requires 3 coordinates.");
[ - - ][ - - ]
[ - - ][ - - ]
1440 : :
1441 [ + - ][ + - ]: 27 : storeIfSpecd< tk::real >(lua_box[i+1], "init_time",
[ - + ][ - - ]
1442 : : box_deck[i].get< tag::init_time >(), 0.0);
1443 : :
1444 [ + - ][ + - ]: 27 : storeIfSpecd< tk::real >(lua_box[i+1], "front_width",
[ - + ][ - - ]
1445 [ + - ]: 9 : box_deck[i].get< tag::front_width >(), 0.0);
1446 : :
1447 [ + - ][ + - ]: 27 : storeIfSpecd< tk::real >(lua_box[i+1], "front_speed",
[ - + ][ - - ]
1448 [ + - ]: 9 : box_deck[i].get< tag::front_speed >(), 0.0);
1449 : : }
1450 : : }
1451 : :
1452 : : // IC mesh-block
1453 [ + - ][ - + ]: 15 : if (lua_ideck["ic"]["meshblock"].valid()) {
1454 : : const sol::table& lua_meshblock = lua_ideck["ic"]["meshblock"];
1455 : : auto& mblk_deck = ic_deck.get< tag::meshblock >();
1456 [ - - ][ - - ]: 0 : mblk_deck.resize(lua_meshblock.size());
1457 : :
1458 [ - - ]: 0 : for (std::size_t i=0; i<mblk_deck.size(); ++i) {
1459 : :
1460 [ - - ][ - - ]: 0 : checkBlock< inciter::ctr::meshblockList::Keys >(lua_meshblock[i+1],
[ - - ][ - - ]
[ - - ]
1461 : : "meshblock");
1462 : :
1463 [ - - ][ - - ]: 0 : storeIfSpecd< std::size_t >(lua_meshblock[i+1], "blockid",
[ - - ][ - - ]
1464 [ - - ]: 0 : mblk_deck[i].get< tag::blockid >(), 0);
1465 [ - - ]: 0 : if (mblk_deck[i].get< tag::blockid >() == 0)
1466 [ - - ][ - - ]: 0 : Throw("Each IC mesh block must specify the mesh block id.");
[ - - ][ - - ]
[ - - ][ - - ]
1467 : :
1468 [ - - ][ - - ]: 0 : storeIfSpecd< std::size_t >(lua_meshblock[i+1], "materialid",
[ - - ][ - - ]
1469 : : mblk_deck[i].get< tag::materialid >(), 1);
1470 : :
1471 [ - - ][ - - ]: 0 : storeIfSpecd< tk::real >(lua_meshblock[i+1], "energy_content",
[ - - ][ - - ]
1472 [ - - ]: 0 : mblk_deck[i].get< tag::energy_content >(), 0.0);
1473 : :
1474 [ - - ][ - - ]: 0 : storeIfSpecd< tk::real >(lua_meshblock[i+1], "volume",
[ - - ][ - - ]
1475 [ - - ]: 0 : mblk_deck[i].get< tag::volume >(), 0.0);
1476 [ - - ]: 0 : if (mblk_deck[i].get< tag::energy_content >() > 0.0 &&
1477 [ - - ]: 0 : mblk_deck[i].get< tag::volume >() < 1e-12)
1478 [ - - ][ - - ]: 0 : Throw("Mesh block volume must be specified, if energy content is "
[ - - ][ - - ]
[ - - ][ - - ]
1479 : : "used to initialize block");
1480 : :
1481 [ - - ][ - - ]: 0 : storeIfSpecd< tk::real >(lua_meshblock[i+1], "mass",
[ - - ][ - - ]
1482 : : mblk_deck[i].get< tag::mass >(), 0.0);
1483 : :
1484 [ - - ][ - - ]: 0 : storeIfSpecd< tk::real >(lua_meshblock[i+1], "density",
[ - - ][ - - ]
1485 [ - - ]: 0 : mblk_deck[i].get< tag::density >(), 0.0);
1486 : :
1487 [ - - ][ - - ]: 0 : storeVecIfSpecd< tk::real >(lua_meshblock[i+1], "velocity",
[ - - ][ - - ]
[ - - ][ - - ]
1488 [ - - ]: 0 : mblk_deck[i].get< tag::velocity >(), {0.0, 0.0, 0.0});
1489 [ - - ]: 0 : if (mblk_deck[i].get< tag::velocity >().size() != 3)
1490 [ - - ][ - - ]: 0 : Throw("Velocity in IC meshblock requires 3 components.");
[ - - ][ - - ]
[ - - ][ - - ]
1491 : :
1492 [ - - ][ - - ]: 0 : storeIfSpecd< tk::real >(lua_meshblock[i+1], "pressure",
[ - - ][ - - ]
1493 : : mblk_deck[i].get< tag::pressure >(), 0.0);
1494 : :
1495 [ - - ][ - - ]: 0 : storeIfSpecd< tk::real >(lua_meshblock[i+1], "energy",
[ - - ][ - - ]
1496 [ - - ]: 0 : mblk_deck[i].get< tag::energy >(), 0.0);
1497 : :
1498 [ - - ][ - - ]: 0 : storeIfSpecd< tk::real >(lua_meshblock[i+1], "temperature",
[ - - ][ - - ]
1499 [ - - ]: 0 : mblk_deck[i].get< tag::temperature >(), 0.0);
1500 : :
1501 [ - - ][ - - ]: 0 : storeVecIfSpecd< tk::real >(lua_meshblock[i+1], "mass_fractions",
[ - - ][ - - ]
[ - - ]
1502 [ - - ]: 0 : mblk_deck[i].get< tag::mass_fractions >(),
1503 [ - - ]: 0 : std::vector< tk::real >(nspec, 1.0/static_cast<tk::real>(nspec)));
1504 [ - - ]: 0 : if (mblk_deck[i].get< tag::mass_fractions >().size() != nspec)
1505 [ - - ][ - - ]: 0 : Throw("IC meshblock mass fraction has incorrect number of species. "
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ]
1506 : : "Expected " + std::to_string(nspec));
1507 : :
1508 [ - - ][ - - ]: 0 : storeOptIfSpecd< inciter::ctr::InitiateType, inciter::ctr::Initiate >(
[ - - ][ - - ]
1509 : : lua_meshblock[i+1], "initiate", mblk_deck[i].get< tag::initiate >(),
1510 : : inciter::ctr::InitiateType::IMPULSE);
1511 : :
1512 [ - - ][ - - ]: 0 : storeVecIfSpecd< tk::real >(lua_meshblock[i+1], "point",
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ]
1513 [ - - ]: 0 : mblk_deck[i].get< tag::point >(), {0.0, 0.0, 0.0});
1514 [ - - ]: 0 : if (mblk_deck[i].get< tag::point >().size() != 3)
1515 [ - - ][ - - ]: 0 : Throw("Point in IC meshblock requires 3 coordinates.");
[ - - ][ - - ]
[ - - ][ - - ]
1516 : :
1517 [ - - ][ - - ]: 0 : storeIfSpecd< tk::real >(lua_meshblock[i+1], "init_time",
[ - - ][ - - ]
1518 : : mblk_deck[i].get< tag::init_time >(), 0.0);
1519 : :
1520 [ - - ][ - - ]: 0 : storeIfSpecd< tk::real >(lua_meshblock[i+1], "front_width",
[ - - ][ - - ]
1521 [ - - ]: 0 : mblk_deck[i].get< tag::front_width >(), 0.0);
1522 : :
1523 [ - - ][ - - ]: 0 : storeIfSpecd< tk::real >(lua_meshblock[i+1], "front_speed",
[ - - ][ - - ]
1524 [ - - ]: 0 : mblk_deck[i].get< tag::front_speed >(), 0.0);
1525 : : }
1526 : : }
1527 : : }
1528 : : else {
1529 : : // TODO: remove double-specification of defaults
1530 : : auto& ic_deck = gideck.get< tag::ic >();
1531 : 177 : ic_deck.get< tag::materialid >() = 1;
1532 : 177 : ic_deck.get< tag::pressure >() = 0.0;
1533 : 177 : ic_deck.get< tag::temperature >() = 1.0;
1534 : 177 : ic_deck.get< tag::density >() = 0.0;
1535 : 177 : ic_deck.get< tag::energy >() = 0.0;
1536 [ + - ]: 177 : ic_deck.get< tag::velocity >() = {0.0, 0.0, 0.0};
1537 : : ic_deck.get< tag::mass_fractions >() =
1538 [ + - ]: 354 : std::vector< tk::real >(nspec, 1.0/static_cast<tk::real>(nspec));
1539 : : }
1540 : 192 : }
1541 : :
1542 : : void
1543 : 400 : LuaParser::checkStoreMatProp(
1544 : : const sol::table table,
1545 : : const std::string key,
1546 : : std::size_t vecsize,
1547 : : std::vector< tk::real >& storage )
1548 : : // *****************************************************************************
1549 : : // Check and store material property into inpudeck storage
1550 : : //! \param[in] table Sol-table which contains said property
1551 : : //! \param[in] key Key for said property in Sol-table
1552 : : //! \param[in] vecsize Number of said property in Sol-table (based on number of
1553 : : //! materials that are of the same eos type
1554 : : //! \param[in,out] storage Storage space in inputdeck where said property is
1555 : : //! to be stored
1556 : : // *****************************************************************************
1557 : : {
1558 : : // check validity of table
1559 [ + - ][ - + ]: 800 : if (!table[key].valid())
1560 [ - - ][ - - ]: 0 : Throw("Material property '" + key + "' not specified");
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
1561 [ + - ][ - + ]: 800 : if (sol::table(table[key]).size() != vecsize)
[ - + ][ - - ]
1562 [ - - ][ - - ]: 0 : Throw("Incorrect number of '" + key + "'s specified. Expected " +
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ]
1563 : : std::to_string(vecsize));
1564 : :
1565 : : // store values from table to inputdeck
1566 [ + - ][ - + ]: 800 : storeVecIfSpecd< tk::real >(table, key, storage,
[ + - ][ - - ]
[ - - ]
1567 [ + - ]: 400 : std::vector< tk::real >(vecsize, 0.0));
1568 : 400 : }
1569 : :
1570 : : void
1571 : 6 : LuaParser::checkStoreMatPropVec(
1572 : : const sol::table table,
1573 : : const std::string key,
1574 : : std::size_t nspec,
1575 : : std::size_t vecsize,
1576 : : std::vector<std::vector< tk::real >>& storage )
1577 : : // *****************************************************************************
1578 : : // Check and store material property vector into inpudeck storage
1579 : : //! \param[in] table Sol-table which contains said property
1580 : : //! \param[in] key Key for said property in Sol-table
1581 : : //! \param[in] nspec Number of species
1582 : : //! \param[in] vecsize Number of said property in Sol-table (based on number of
1583 : : //! coefficients for the defined species)
1584 : : //! \param[in,out] storage Storage space in inputdeck where said property is
1585 : : //! to be stored
1586 : : // *****************************************************************************
1587 : : {
1588 : : // check validity of table
1589 [ + - ][ - + ]: 12 : if (!table[key].valid())
1590 [ - - ][ - - ]: 0 : Throw("Material property '" + key + "' not specified");
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
1591 [ + - ][ - + ]: 12 : if (sol::table(table[key]).size() != nspec)
[ - + ][ - - ]
1592 [ - - ][ - - ]: 0 : Throw("Incorrect number of '" + key + "' vectors specified. Expected " +
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
1593 : : std::to_string(nspec) + " vectors");
1594 : :
1595 : 6 : storage.resize(nspec);
1596 : :
1597 : : const auto& tableentry = table[key];
1598 [ + + ]: 15 : for (std::size_t k=0; k < nspec; k++) {
1599 [ + - ][ + - ]: 27 : if (sol::table(tableentry[k+1]).size() != vecsize)
[ - + ][ + - ]
[ - - ]
1600 [ - - ][ - - ]: 0 : Throw("Incorrect number of '" + key + "' entries in vector of species "
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ]
1601 : : + std::to_string(k+1) + " specified. Expected " +
1602 : : std::to_string(vecsize));
1603 : :
1604 : : // store values from table to inputdeck
1605 [ + + ]: 45 : for (std::size_t i=0; i<vecsize; ++i)
1606 [ + - ][ + - ]: 72 : storage[k].push_back(tableentry[k+1][i+1]);
[ - + ][ - + ]
[ - - ][ - - ]
[ - - ]
1607 : : }
1608 : 6 : }
1609 : :
1610 : : void
1611 : 6 : LuaParser::checkStoreMatPropVecVec(
1612 : : const sol::table table,
1613 : : const std::string key,
1614 : : std::size_t nspec,
1615 : : std::size_t vecsize1,
1616 : : std::size_t vecsize2,
1617 : : std::vector<std::vector<std::vector< tk::real >>>& storage )
1618 : : // *****************************************************************************
1619 : : // Check and store material property vector into inpudeck storage
1620 : : //! \param[in] table Sol-table which contains said property
1621 : : //! \param[in] key Key for said property in Sol-table
1622 : : //! \param[in] nspec Number of species
1623 : : //! \param[in] vecsize1 Outer number of said property in Sol-table (based on
1624 : : //! number of coefficients for the defined species)
1625 : : //! \param[in] vecsize2 Inner number of said property in Sol-table (based on
1626 : : //! number of coefficients for the defined species)
1627 : : //! \param[in,out] storage Storage space in inputdeck where said property is
1628 : : //! to be stored
1629 : : // *****************************************************************************
1630 : : {
1631 : : // check validity of table
1632 [ + - ][ - + ]: 12 : if (!table[key].valid())
1633 [ - - ][ - - ]: 0 : Throw("Material property '" + key + "' not specified");
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
1634 [ + - ][ - + ]: 12 : if (sol::table(table[key]).size() != nspec)
[ - + ][ - - ]
1635 [ - - ][ - - ]: 0 : Throw("Incorrect number of '" + key + "' vectors specified. Expected " +
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
1636 : : std::to_string(nspec) + " vectors");
1637 : :
1638 : 6 : storage.resize(nspec);
1639 : :
1640 : : const auto& tableentry = table[key];
1641 [ + + ]: 15 : for (std::size_t k=0; k < nspec; k++) {
1642 [ + - ][ + - ]: 27 : if (sol::table(tableentry[k+1]).size() != vecsize1)
[ - + ][ + - ]
[ - - ]
1643 [ - - ][ - - ]: 0 : Throw("Incorrect outer number of '" + key + "' entries in vector of species "
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ]
1644 : : + std::to_string(k+1) + " specified. Expected " +
1645 : : std::to_string(vecsize1));
1646 : :
1647 : : // store values from table to inputdeck
1648 [ + + ]: 36 : for (std::size_t i=0; i<vecsize1; ++i) {
1649 [ + - ][ + - ]: 81 : if (sol::table(tableentry[k+1][i+1]).size() != vecsize2)
[ - + ][ - + ]
[ - + ][ - - ]
[ - - ][ - - ]
1650 [ - - ][ - - ]: 0 : Throw("Incorrect inner number of '" + key + "' entries in vector of species "
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ]
1651 : : + std::to_string(k+1) + " specified. Expected " +
1652 : : std::to_string(vecsize2));
1653 : : std::vector< tk::real > temp_storage;
1654 [ + + ]: 243 : for (std::size_t j=0; j<vecsize2; j++)
1655 [ + - ][ + - ]: 432 : temp_storage.push_back(tableentry[k+1][i+1][j+1]);
[ - + ][ - + ]
[ - + ][ - - ]
[ - - ][ - - ]
[ - - ]
1656 [ + - ]: 27 : storage[k].push_back(temp_storage);
1657 : : }
1658 : : }
1659 : 6 : }
1660 : :
1661 : : void
1662 : 627 : LuaParser::addOutVar(
1663 : : const std::string& varname,
1664 : : const std::string& alias,
1665 : : std::vector< char >& depv,
1666 : : std::size_t nmat,
1667 : : std::size_t nspec,
1668 : : inciter::ctr::PDEType pde,
1669 : : tk::Centering c,
1670 : : std::vector< inciter::ctr::OutVar >& foutvar )
1671 : : // *****************************************************************************
1672 : : // Check and store field output variables
1673 : : //! \param[in] varname Name of variable requested
1674 : : //! \param[in] alias User specified alias for output
1675 : : //! \param[in] depv List of depvars
1676 : : //! \param[in] nmat Number of materials configured
1677 : : //! \param[in] nspec Number of species configured
1678 : : //! \param[in] pde Type of PDE configured
1679 : : //! \param[in] c Variable centering requested
1680 : : //! \param[in,out] foutvar Input deck storage where output vars are stored
1681 : : // *****************************************************************************
1682 : : {
1683 : : // index-based quantity specification
1684 : : // ----------------------------------
1685 [ + + ]: 627 : if (varname.length() == 2) {
1686 : 77 : auto qty = varname.at(0);
1687 [ + - ][ - + ]: 154 : auto j = std::stoul(std::string{varname.at(1)}) - 1;
1688 : :
1689 [ + + ]: 77 : if (pde == inciter::ctr::PDEType::MULTIMAT) {
1690 : : // multimat/matvar quantities
1691 [ - + ]: 28 : if (qty == 'D') { // density
1692 : : foutvar.emplace_back(
1693 [ - - ][ - - ]: 0 : inciter::ctr::OutVar(c, varname, alias, inciter::densityIdx(nmat,j)) );
[ - - ][ - - ]
[ - - ]
1694 : : }
1695 [ + - ]: 28 : else if (qty == 'F') { // volume fraction
1696 : : foutvar.emplace_back(
1697 [ + - ][ + - ]: 28 : inciter::ctr::OutVar(c, varname, alias, inciter::volfracIdx(nmat,j)) );
[ + - ][ - + ]
[ - - ]
1698 : : }
1699 [ - - ]: 0 : else if (qty == 'M') { // momentum
1700 : : foutvar.emplace_back(
1701 [ - - ][ - - ]: 0 : inciter::ctr::OutVar(c, varname, alias, inciter::momentumIdx(nmat,j)) );
[ - - ][ - - ]
[ - - ]
1702 : : }
1703 [ - - ]: 0 : else if (qty == 'E') { // specific total energy
1704 : : foutvar.emplace_back(
1705 [ - - ][ - - ]: 0 : inciter::ctr::OutVar(c, varname, alias, inciter::energyIdx(nmat,j)) );
[ - - ][ - - ]
[ - - ]
1706 : : }
1707 [ - - ]: 0 : else if (qty == 'U') { // velocity (primitive)
1708 : : foutvar.emplace_back(
1709 [ - - ][ - - ]: 0 : inciter::ctr::OutVar(c, varname, alias, inciter::velocityIdx(nmat,j)) );
[ - - ][ - - ]
[ - - ]
1710 : : }
1711 [ - - ]: 0 : else if (qty == 'P') { // material pressure (primitive)
1712 : : foutvar.emplace_back(
1713 [ - - ][ - - ]: 0 : inciter::ctr::OutVar(c, varname, alias, inciter::pressureIdx(nmat,j)) );
[ - - ][ - - ]
[ - - ]
1714 : : }
1715 : : else {
1716 : : // error out if incorrect matvar used
1717 [ - - ][ - - ]: 0 : Throw("field_output: matvar " + varname + " not found");
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
1718 : : }
1719 : : }
1720 [ + + ]: 49 : else if (pde == inciter::ctr::PDEType::MULTISPECIES) {
1721 : : // multispecies/matvar quantities
1722 [ + - ]: 12 : if (qty == 'D') { // density
1723 : : foutvar.emplace_back(
1724 [ + - ][ + - ]: 24 : inciter::ctr::OutVar(c, varname, alias,
[ - + ][ - - ]
1725 [ + - ]: 12 : inciter::multispecies::densityIdx(nspec,j)) );
1726 : : }
1727 [ - - ]: 0 : else if (qty == 'M') { // momentum
1728 : : foutvar.emplace_back(
1729 [ - - ][ - - ]: 0 : inciter::ctr::OutVar(c, varname, alias,
[ - - ][ - - ]
1730 [ - - ]: 0 : inciter::multispecies::momentumIdx(nspec,j)) );
1731 : : }
1732 [ - - ]: 0 : else if (qty == 'E') { // specific total energy
1733 : : foutvar.emplace_back(
1734 [ - - ][ - - ]: 0 : inciter::ctr::OutVar(c, varname, alias,
[ - - ][ - - ]
1735 [ - - ]: 0 : inciter::multispecies::energyIdx(nspec,j)) );
1736 : : }
1737 : : else {
1738 : : // error out if incorrect matvar used
1739 [ - - ][ - - ]: 0 : Throw("field_output: matvar " + varname + " not found");
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ][ - - ]
1740 : : }
1741 : : }
1742 : : else {
1743 : : // quantities specified by depvar
1744 [ + + ]: 84 : for (const auto& id : depv)
1745 [ + + ]: 47 : if (std::tolower(qty) == id) {
1746 [ + - ][ + - ]: 37 : foutvar.emplace_back( inciter::ctr::OutVar(c, varname, alias, j) );
[ + - ][ - + ]
[ - - ]
1747 : : }
1748 : : }
1749 : : }
1750 : : // analytic quantity specification
1751 : : // -------------------------------
1752 [ + + ]: 550 : else if (varname.find("analytic") != std::string::npos) {
1753 [ + - ][ + - ]: 57 : foutvar.emplace_back( inciter::ctr::OutVar(c, varname, alias, 0) );
[ + - ][ - + ]
[ - - ]
1754 : : }
1755 : : // name-based tensor quantity specification
1756 : : // ----------------------------------------
1757 [ - + ]: 493 : else if (varname.find("_tensor") != std::string::npos) {
1758 : : std::string namet(varname);
1759 : : // remove the "_tensor" from the varname
1760 [ - - ]: 0 : for (std::size_t i=0; i<7; ++i) namet.pop_back();
1761 : :
1762 [ - - ]: 0 : for (std::size_t i=1; i<=3; ++i) {
1763 [ - - ]: 0 : for (std::size_t j=1; j<=3; ++j) {
1764 [ - - ][ - - ]: 0 : std::string tij(namet + std::to_string(i) + std::to_string(j));
[ - - ][ - - ]
[ - - ][ - - ]
[ - - ]
1765 [ - - ][ - - ]: 0 : foutvar.emplace_back( inciter::ctr::OutVar(c, tij, alias, 0, tij) );
[ - - ][ - - ]
1766 : : }
1767 : : }
1768 : : }
1769 : : // name-based quantity specification
1770 : : // ---------------------------------
1771 : : else {
1772 [ + - ]: 493 : foutvar.emplace_back( inciter::ctr::OutVar(c, varname, alias, 0, varname) );
1773 : : }
1774 : 627 : }
|