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