Branch data Line data Source code
1 : : // *****************************************************************************
2 : : /*!
3 : : \file src/PDE/CGPDE.hpp
4 : : \copyright 2012-2015 J. Bakosi,
5 : : 2016-2018 Los Alamos National Security, LLC.,
6 : : 2019-2021 Triad National Security, LLC.
7 : : All rights reserved. See the LICENSE file for details.
8 : : \brief Partial differential equation base for continuous Galerkin PDEs
9 : : \details This file defines a generic partial differential equation (PDE)
10 : : class for PDEs that use continuous Galerkin spatial discretization.
11 : : The class uses runtime polymorphism without client-side inheritance:
12 : : inheritance is confined to the internals of the class, invisible to
13 : : client-code. The class exclusively deals with ownership enabling client-side
14 : : value semantics. Credit goes to Sean Parent at Adobe:
15 : : https://github.com/sean-parent/sean-parent.github.com/wiki/
16 : : Papers-and-Presentations.
17 : : */
18 : : // *****************************************************************************
19 : : #ifndef CGPDE_h
20 : : #define CGPDE_h
21 : :
22 : : #include <array>
23 : : #include <string>
24 : : #include <vector>
25 : : #include <functional>
26 : : #include <memory>
27 : : #include <unordered_set>
28 : : #include <unordered_map>
29 : :
30 : : #include "Types.hpp"
31 : : #include "Fields.hpp"
32 : : #include "UnsMesh.hpp"
33 : : #include "FunctionPrototypes.hpp"
34 : : #include "Mesh/CommMap.hpp"
35 : : #include "History.hpp"
36 : : #include "Table.hpp"
37 : :
38 : : namespace inciter {
39 : :
40 : : namespace cg {
41 : :
42 : : using ncomp_t = tk::ncomp_t;
43 : :
44 : : //! \brief Evaluate the increment from t to t+dt of an analytical solution at
45 : : //! (x,y,z) for all components
46 : : std::vector< tk::real >
47 : : solinc( tk::ncomp_t ncomp, const std::vector< EOS >&, tk::real x, tk::real y,
48 : : tk::real z, tk::real t, tk::real dt, tk::InitializeFn solution );
49 : :
50 : : //! Compute boundary point normals
51 : : std::unordered_map< int,
52 : : std::unordered_map< std::size_t, std::array< tk::real, 4 > > >
53 : : bnorm( const std::map< int, std::vector< std::size_t > >& bface,
54 : : const std::vector< std::size_t >& triinpoel,
55 : : const std::array< std::vector< tk::real >, 3 >& coord,
56 : : const std::vector< std::size_t >& gid,
57 : : const std::unordered_map< int,
58 : : std::unordered_set< std::size_t > >& bcnodes );
59 : :
60 : : } // cg::
61 : :
62 : : //! \brief Partial differential equation base for continuous Galerkin PDEs
63 : : //! \details This class uses runtime polymorphism without client-side
64 : : //! inheritance: inheritance is confined to the internals of the this class,
65 : : //! invisible to client-code. The class exclusively deals with ownership
66 : : //! enabling client-side value semantics. Credit goes to Sean Parent at Adobe:
67 : : //! https://github.com/sean-parent/sean-parent.github.com/wiki/
68 : : //! Papers-and-Presentations. For example client code that models a CGPDE,
69 : : //! see inciter::CompFlow.
70 : : class CGPDE {
71 : :
72 : : private:
73 : : using ncomp_t = tk::ncomp_t;
74 : : using real = tk::real;
75 : :
76 : : public:
77 : : //! Default constructor taking no arguments for Charm++
78 : 0 : explicit CGPDE() = default;
79 : :
80 : : //! Constructor taking an object modeling Concept.
81 : : //! \details The object of class T comes pre-constructed.
82 : : //! \param[in] x Instantiated object of type T given by the template
83 : : //! argument.
84 : : template< typename T > explicit CGPDE( T x ) :
85 : : self( std::make_unique< Model<T> >( std::move(x) ) ) {}
86 : :
87 : : //! \brief Constructor taking a function pointer to a constructor of an
88 : : //! object modeling Concept.
89 : : //! \details Passing std::function allows late execution of the constructor,
90 : : //! i.e., as late as inside this class' constructor, and thus usage from
91 : : //! a factory. Note that there are at least two different ways of using
92 : : //! this constructor:
93 : : //! - Bind T's constructor arguments and place it in std::function<T()>
94 : : //! and passing no arguments as args.... This case then instantiates the
95 : : //! model via its constructor and stores it in here.
96 : : //! - Bind a single placeholder argument to T's constructor and pass it in
97 : : //! as host's args..., which then forwards it to model's constructor. This
98 : : //! allows late binding, i.e., binding the argument only here.
99 : : //! \see See also the wrapper tk::recordModel() which does the former and
100 : : //! tk::recordModelLate() which does the latter, both defined in
101 : : //! src/Base/Factory.h.
102 : : //! \param[in] x Function pointer to a constructor of an object modeling
103 : : //! Concept.
104 : : //! \param[in] args Zero or more constructor arguments
105 : : template< typename T, typename...Args >
106 : 311 : explicit CGPDE( std::function<T(Args...)> x, Args&&... args ) :
107 : : self( std::make_unique< Model<T> >(
108 [ + - ]: 311 : std::move( x( std::forward<Args>(args)... ) ) ) ) {}
109 : :
110 : : //! Public interface to determining which nodes are in IC box
111 : 828 : void IcBoxNodes( const tk::UnsMesh::Coords& coord,
112 : : const std::vector< std::size_t >& inpoel,
113 : : const std::unordered_map< std::size_t, std::set< std::size_t > >& elemblkid,
114 : : std::vector< std::unordered_set< std::size_t > >& inbox,
115 : : std::unordered_map< std::size_t, std::set< std::size_t > >& nodeblkid,
116 : : std::size_t& nuserblk )
117 : 828 : { self->IcBoxNodes( coord, inpoel, elemblkid, inbox, nodeblkid, nuserblk );
118 : 828 : }
119 : :
120 : : //! Public interface to setting the initial conditions for the diff eq
121 : 1010 : void initialize(
122 : : const std::array< std::vector< real >, 3 >& coord,
123 : : tk::Fields& unk,
124 : : real t,
125 : : real V,
126 : : const std::vector< std::unordered_set< std::size_t > >& inbox,
127 : : const std::vector< tk::real >& blkvols,
128 : : const std::unordered_map< std::size_t, std::set< std::size_t > >&
129 : : nodeblkid )
130 : 1010 : { self->initialize( coord, unk, t, V, inbox, blkvols, nodeblkid ); }
131 : :
132 : : //! Public interface to querying a velocity
133 : 41542 : void velocity( const tk::Fields& u, tk::UnsMesh::Coords& v ) const
134 : 41542 : { self->velocity(u,v); }
135 : :
136 : : //! Public interface to querying a sound speed
137 : 41542 : void soundspeed( const tk::Fields& u, std::vector< tk::real >& s ) const
138 : 41542 : { self->soundspeed(u,s); }
139 : :
140 : : //! Public interface to computing the nodal gradients for ALECG
141 : 50001 : void chBndGrad( const std::array< std::vector< real >, 3 >& coord,
142 : : const std::vector< std::size_t >& inpoel,
143 : : const std::vector< std::size_t >& bndel,
144 : : const std::vector< std::size_t >& gid,
145 : : const std::unordered_map< std::size_t, std::size_t >& bid,
146 : : const tk::Fields& U,
147 : : tk::Fields& G ) const
148 : 50001 : { self->chBndGrad( coord, inpoel, bndel, gid, bid, U, G ); }
149 : :
150 : : //! Public interface to computing the right-hand side vector for ALECG
151 : 50001 : void rhs(
152 : : real t,
153 : : const std::array< std::vector< real >, 3 >& coord,
154 : : const std::vector< std::size_t >& inpoel,
155 : : const std::vector< std::size_t >& triinpoel,
156 : : const std::vector< std::size_t >& gid,
157 : : const std::unordered_map< std::size_t, std::size_t >& bid,
158 : : const std::unordered_map< std::size_t, std::size_t >& lid,
159 : : const std::vector< real >& dfn,
160 : : const std::pair< std::vector< std::size_t >,
161 : : std::vector< std::size_t > >& psup,
162 : : const std::pair< std::vector< std::size_t >,
163 : : std::vector< std::size_t > >& esup,
164 : : const std::vector< int >& symbctri,
165 : : const std::vector< int >& slipwallbctri,
166 : : const std::vector< real >& vol,
167 : : const std::vector< std::size_t >& edgenode,
168 : : const std::vector< std::size_t >& edgeid,
169 : : const std::vector< std::unordered_set< std::size_t > >& boxnodes,
170 : : const tk::Fields& G,
171 : : const tk::Fields& U,
172 : : const tk::Fields& W,
173 : : const std::vector< real >& tp,
174 : : real V,
175 : : tk::Fields& R ) const
176 : 50001 : { self->rhs( t, coord, inpoel, triinpoel, gid, bid, lid, dfn, psup,
177 : : esup, symbctri, slipwallbctri, vol, edgenode, edgeid,
178 : 50001 : boxnodes, G, U, W, tp, V, R ); }
179 : :
180 : : //! Public interface to compute boundary surface integrals of pressure
181 : 0 : void bndPressureInt(
182 : : const std::array< std::vector< real >, 3 >& coord,
183 : : const std::vector< std::size_t >& triinpoel,
184 : : const std::vector< int >& slipwallbctri,
185 : : const tk::Fields& U,
186 : : const std::array< tk::real, 3 >& CM,
187 : : std::vector< real >& F ) const
188 : 0 : { self->bndPressureInt( coord, triinpoel, slipwallbctri, U, CM, F ); }
189 : :
190 : : //! Public interface for computing the minimum time step size
191 : 6377 : real dt( const std::array< std::vector< real >, 3 >& coord,
192 : : const std::vector< std::size_t >& inpoel,
193 : : tk::real t,
194 : : tk::real dtn,
195 : : const tk::Fields& U,
196 : : const std::vector< tk::real >& vol,
197 : : const std::vector< tk::real >& voln ) const
198 : 6377 : { return self->dt( coord, inpoel, t, dtn, U, vol, voln ); }
199 : :
200 : : //! Public interface for computing a time step size for each mesh node
201 : 200 : void dt( uint64_t it,
202 : : const std::vector< real >& vol,
203 : : const tk::Fields& U,
204 : : std::vector< real >& dtp ) const
205 : 200 : { self->dt( it, vol, U, dtp ); }
206 : :
207 : : //! \brief Public interface for querying Dirichlet boundary condition values
208 : : //! set by the user on a given side set for all components in a PDE system
209 : : std::map< std::size_t, std::vector< std::pair<bool,real> > >
210 : 63502 : dirbc( real t,
211 : : real deltat,
212 : : const std::vector< real >& tp,
213 : : const std::vector< real >& dtp,
214 : : const std::pair< const int, std::vector< std::size_t > >& sides,
215 : : const std::array< std::vector< real >, 3 >& coord,
216 : : bool increment ) const
217 : 63502 : { return self->dirbc( t, deltat, tp, dtp, sides, coord, increment ); }
218 : :
219 : : //! Public interface to set symmetry boundary conditions at nodes
220 : : void
221 : 57991 : symbc( tk::Fields& U,
222 : : const std::array< std::vector< real >, 3 >& coord,
223 : : const std::unordered_map< int,
224 : : std::unordered_map< std::size_t,
225 : : std::array< real, 4 > > >& bnorm,
226 : : const std::unordered_set< std::size_t >& nodes ) const
227 : 57991 : { self->symbc( U, coord, bnorm, nodes ); }
228 : :
229 : : //! Public interface to set farfield boundary conditions at nodes
230 : : void
231 : 57982 : farfieldbc( tk::Fields& U,
232 : : const std::array< std::vector< real >, 3 >& coord,
233 : : const std::unordered_map< int,
234 : : std::unordered_map< std::size_t,
235 : : std::array< real, 4 > > >& bnorm,
236 : : const std::unordered_set< std::size_t >& nodes ) const
237 : 57982 : { self->farfieldbc( U, coord, bnorm, nodes ); }
238 : :
239 : : //! Public interface to set slip wall boundary conditions at nodes
240 : : void
241 : 57991 : slipwallbc( tk::Fields& U,
242 : : const tk::Fields& W,
243 : : const std::array< std::vector< real >, 3 >& coord,
244 : : const std::unordered_map< int,
245 : : std::unordered_map< std::size_t,
246 : : std::array< real, 4 > > >& bnorm,
247 : : const std::unordered_set< std::size_t >& nodes ) const
248 : 57991 : { self->slipwallbc( U, W, coord, bnorm, nodes ); }
249 : :
250 : : //! Public interface to applying time dependent boundary conditions at nodes
251 : : void
252 : 41770 : timedepbc( tk::real t,
253 : : tk::Fields& U,
254 : : const std::vector< std::unordered_set< std::size_t > >& nodes,
255 : : const std::vector< tk::Table<5> >& timedepfn ) const
256 : 41770 : { self->timedepbc( t, U, nodes, timedepfn ); }
257 : :
258 : : //! Public interface to returning maps of output var functions
259 : 1403 : std::map< std::string, tk::GetVarFn > OutVarFn() const
260 : 1403 : { return self->OutVarFn(); }
261 : :
262 : : //! Public interface to returning analytic field output labels
263 : 1195 : std::vector< std::string > analyticFieldNames() const
264 : 1195 : { return self->analyticFieldNames(); }
265 : :
266 : : //! Public interface to returning surface field output labels
267 : 1403 : std::vector< std::string > surfNames() const { return self->surfNames(); }
268 : :
269 : : //! Public interface to returning time history field output labels
270 : 22 : std::vector< std::string > histNames() const { return self->histNames(); }
271 : :
272 : : //! Public interface to returning variable names
273 : 85 : std::vector< std::string > names() const { return self->names(); }
274 : :
275 : : //! Public interface to returning nodal surface field output
276 : : std::vector< std::vector< real > >
277 : 1403 : surfOutput( const std::map< int, std::vector< std::size_t > >& bnd,
278 : : const tk::Fields& U ) const
279 : 1403 : { return self->surfOutput( bnd, U ); }
280 : :
281 : : //! Public interface to returning elemental surface field output
282 : : std::vector< std::vector< real > >
283 : 1403 : elemSurfOutput( const std::map< int, std::vector< std::size_t > >& bface,
284 : : const std::vector< std::size_t >& triinpoel,
285 : : const tk::Fields& U ) const
286 : 1403 : { return self->elemSurfOutput( bface, triinpoel, U ); }
287 : :
288 : : //! Public interface to returning time history output
289 : : std::vector< std::vector< real > >
290 : 214 : histOutput( const std::vector< HistData >& h,
291 : : const std::vector< std::size_t >& inpoel,
292 : : const tk::Fields& U ) const
293 : 214 : { return self->histOutput( h, inpoel, U ); }
294 : :
295 : : //! Public interface to returning analytic solution
296 : : tk::InitializeFn::result_type
297 : 111097 : analyticSolution( real xi, real yi, real zi, real t ) const
298 : 111097 : { return self->analyticSolution( xi, yi, zi, t ); }
299 : :
300 : : //! Public interface to returning the analytic solution for conserved vars
301 : : tk::InitializeFn::result_type
302 : 1456210 : solution( tk::real xi, tk::real yi, tk::real zi, tk::real t ) const
303 : 1456210 : { return self->solution( xi, yi, zi, t ); }
304 : :
305 : : //! Copy assignment
306 : : CGPDE& operator=( const CGPDE& x )
307 : : { CGPDE tmp(x); *this = std::move(tmp); return *this; }
308 : : //! Copy constructor
309 : : CGPDE( const CGPDE& x ) : self( x.self->copy() ) {}
310 : : //! Move assignment
311 : : CGPDE& operator=( CGPDE&& ) noexcept = default;
312 : : //! Move constructor
313 : 315 : CGPDE( CGPDE&& ) noexcept = default;
314 : :
315 : : private:
316 : : //! \brief Concept is a pure virtual base class specifying the requirements
317 : : //! of polymorphic objects deriving from it
318 : : struct Concept {
319 : 311 : Concept() = default;
320 : 0 : Concept( const Concept& ) = default;
321 : 311 : virtual ~Concept() = default;
322 : : virtual Concept* copy() const = 0;
323 : : virtual void IcBoxNodes( const tk::UnsMesh::Coords&,
324 : : const std::vector< std::size_t >&,
325 : : const std::unordered_map< std::size_t, std::set< std::size_t > >&,
326 : : std::vector< std::unordered_set< std::size_t > >&,
327 : : std::unordered_map< std::size_t, std::set< std::size_t > >&,
328 : : std::size_t& ) = 0;
329 : : virtual void initialize(
330 : : const std::array< std::vector< real >, 3 >&,
331 : : tk::Fields&,
332 : : real,
333 : : real,
334 : : const std::vector< std::unordered_set< std::size_t > >&,
335 : : const std::vector< tk::real >&,
336 : : const std::unordered_map< std::size_t, std::set< std::size_t > >& ) = 0;
337 : : virtual void velocity( const tk::Fields&, tk::UnsMesh::Coords& )
338 : : const = 0;
339 : : virtual void soundspeed( const tk::Fields&, std::vector< tk::real >& )
340 : : const = 0;
341 : : virtual void chBndGrad( const std::array< std::vector< real >, 3 >&,
342 : : const std::vector< std::size_t >&,
343 : : const std::vector< std::size_t >&,
344 : : const std::vector< std::size_t >&,
345 : : const std::unordered_map< std::size_t, std::size_t >&,
346 : : const tk::Fields&,
347 : : tk::Fields& ) const = 0;
348 : : virtual void rhs(
349 : : real,
350 : : const std::array< std::vector< real >, 3 >&,
351 : : const std::vector< std::size_t >&,
352 : : const std::vector< std::size_t >&,
353 : : const std::vector< std::size_t >&,
354 : : const std::unordered_map< std::size_t, std::size_t >&,
355 : : const std::unordered_map< std::size_t, std::size_t >&,
356 : : const std::vector< real >&,
357 : : const std::pair< std::vector< std::size_t >,
358 : : std::vector< std::size_t > >&,
359 : : const std::pair< std::vector< std::size_t >,
360 : : std::vector< std::size_t > >&,
361 : : const std::vector< int >&,
362 : : const std::vector< int >&,
363 : : const std::vector< real >&,
364 : : const std::vector< std::size_t >&,
365 : : const std::vector< std::size_t >&,
366 : : const std::vector< std::unordered_set< std::size_t > >&,
367 : : const tk::Fields&,
368 : : const tk::Fields&,
369 : : const tk::Fields&,
370 : : const std::vector< real >&,
371 : : real,
372 : : tk::Fields& ) const = 0;
373 : : virtual void bndPressureInt(
374 : : const std::array< std::vector< real >, 3 >&,
375 : : const std::vector< std::size_t >&,
376 : : const std::vector< int >&,
377 : : const tk::Fields&,
378 : : const std::array< tk::real, 3 >&,
379 : : std::vector< real >& ) const = 0;
380 : : virtual real dt( const std::array< std::vector< real >, 3 >&,
381 : : const std::vector< std::size_t >&,
382 : : tk::real,
383 : : tk::real,
384 : : const tk::Fields&,
385 : : const std::vector< tk::real >& ,
386 : : const std::vector< tk::real >& ) const = 0;
387 : : virtual void dt( uint64_t,
388 : : const std::vector< real > &,
389 : : const tk::Fields&,
390 : : std::vector< real >& ) const = 0;
391 : : virtual std::map< std::size_t, std::vector< std::pair<bool,real> > >
392 : : dirbc( real,
393 : : real,
394 : : const std::vector< real >&,
395 : : const std::vector< real >&,
396 : : const std::pair< const int, std::vector< std::size_t > >&,
397 : : const std::array< std::vector< real >, 3 >&,
398 : : bool ) const = 0;
399 : : virtual void symbc(
400 : : tk::Fields& U,
401 : : const std::array< std::vector< real >, 3 >&,
402 : : const std::unordered_map< int,
403 : : std::unordered_map< std::size_t,
404 : : std::array< real, 4 > > >&,
405 : : const std::unordered_set< std::size_t >& ) const = 0;
406 : : virtual void farfieldbc(
407 : : tk::Fields&,
408 : : const std::array< std::vector< real >, 3 >&,
409 : : const std::unordered_map< int,
410 : : std::unordered_map< std::size_t,
411 : : std::array< real, 4 > > >&,
412 : : const std::unordered_set< std::size_t >& ) const = 0;
413 : : virtual void slipwallbc(
414 : : tk::Fields& U,
415 : : const tk::Fields& W,
416 : : const std::array< std::vector< real >, 3 >&,
417 : : const std::unordered_map< int,
418 : : std::unordered_map< std::size_t,
419 : : std::array< real, 4 > > >&,
420 : : const std::unordered_set< std::size_t >& ) const = 0;
421 : : virtual void timedepbc(
422 : : tk::real,
423 : : tk::Fields&,
424 : : const std::vector< std::unordered_set< std::size_t > >&,
425 : : const std::vector< tk::Table<5> >& ) const = 0;
426 : : virtual std::map< std::string, tk::GetVarFn > OutVarFn() const = 0;
427 : : virtual std::vector< std::string > analyticFieldNames() const = 0;
428 : : virtual std::vector< std::string > surfNames() const = 0;
429 : : virtual std::vector< std::string > histNames() const = 0;
430 : : virtual std::vector< std::string > names() const = 0;
431 : : virtual std::vector< std::vector< real > > surfOutput(
432 : : const std::map< int, std::vector< std::size_t > >&,
433 : : const tk::Fields& ) const = 0;
434 : : virtual std::vector< std::vector< real > > elemSurfOutput(
435 : : const std::map< int, std::vector< std::size_t > >&,
436 : : const std::vector< std::size_t >&,
437 : : const tk::Fields& ) const = 0;
438 : : virtual std::vector< std::vector< real > > histOutput(
439 : : const std::vector< HistData >&,
440 : : const std::vector< std::size_t >&,
441 : : const tk::Fields& ) const = 0;
442 : : virtual tk::InitializeFn::result_type analyticSolution(
443 : : real xi, real yi, real zi, real t ) const = 0;
444 : : virtual tk::InitializeFn::result_type solution(
445 : : tk::real xi, tk::real yi, tk::real zi, tk::real t ) const = 0;
446 : : };
447 : :
448 : : //! \brief Model models the Concept above by deriving from it and overriding
449 : : //! the virtual functions required by Concept
450 : : template< typename T >
451 : : struct Model : Concept {
452 [ + - ]: 311 : explicit Model( T x ) : data( std::move(x) ) {}
453 [ - - ]: 0 : Concept* copy() const override { return new Model( *this ); }
454 : 828 : void IcBoxNodes( const tk::UnsMesh::Coords& coord,
455 : : const std::vector< std::size_t >& inpoel,
456 : : const std::unordered_map< std::size_t, std::set< std::size_t > >& elemblkid,
457 : : std::vector< std::unordered_set< std::size_t > >& inbox,
458 : : std::unordered_map< std::size_t, std::set< std::size_t > >& nodeblkid,
459 : : std::size_t& nuserblk )
460 : 828 : override { data.IcBoxNodes( coord, inpoel, elemblkid, inbox, nodeblkid,
461 : 828 : nuserblk ); }
462 : 1010 : void initialize(
463 : : const std::array< std::vector< real >, 3 >& coord,
464 : : tk::Fields& unk,
465 : : real t,
466 : : real V,
467 : : const std::vector< std::unordered_set< std::size_t > >& inbox,
468 : : const std::vector< tk::real >& blkvols,
469 : : const std::unordered_map< std::size_t, std::set< std::size_t > >&
470 : : nodeblkid)
471 : 1010 : override { data.initialize( coord, unk, t, V, inbox, blkvols, nodeblkid ); }
472 : 41542 : void velocity( const tk::Fields& u, tk::UnsMesh::Coords& v ) const
473 : 41542 : override { data.velocity(u,v); }
474 : 41542 : void soundspeed( const tk::Fields& u, std::vector< tk::real >& s ) const
475 : 41542 : override { data.soundspeed(u,s); }
476 : 50001 : void chBndGrad( const std::array< std::vector< real >, 3 >& coord,
477 : : const std::vector< std::size_t >& inpoel,
478 : : const std::vector< std::size_t >& bndel,
479 : : const std::vector< std::size_t >& gid,
480 : : const std::unordered_map< std::size_t, std::size_t >& bid,
481 : : const tk::Fields& U,
482 : : tk::Fields& G ) const override
483 : 50001 : { data.chBndGrad( coord, inpoel, bndel, gid, bid, U, G ); }
484 : 50001 : void rhs(
485 : : real t,
486 : : const std::array< std::vector< real >, 3 >& coord,
487 : : const std::vector< std::size_t >& inpoel,
488 : : const std::vector< std::size_t >& triinpoel,
489 : : const std::vector< std::size_t >& gid,
490 : : const std::unordered_map< std::size_t, std::size_t >& bid,
491 : : const std::unordered_map< std::size_t, std::size_t >& lid,
492 : : const std::vector< real >& dfn,
493 : : const std::pair< std::vector< std::size_t >,
494 : : std::vector< std::size_t > >& psup,
495 : : const std::pair< std::vector< std::size_t >,
496 : : std::vector< std::size_t > >& esup,
497 : : const std::vector< int >& symbctri,
498 : : const std::vector< int >& slipwallbctri,
499 : : const std::vector< real >& vol,
500 : : const std::vector< std::size_t >& edgenode,
501 : : const std::vector< std::size_t >& edgeid,
502 : : const std::vector< std::unordered_set< std::size_t > >& boxnodes,
503 : : const tk::Fields& G,
504 : : const tk::Fields& U,
505 : : const tk::Fields& W,
506 : : const std::vector< real >& tp,
507 : : real V,
508 : : tk::Fields& R ) const override
509 : 50001 : { data.rhs( t, coord, inpoel, triinpoel, gid, bid, lid, dfn, psup,
510 : : esup, symbctri, slipwallbctri, vol, edgenode,
511 : 50001 : edgeid, boxnodes, G, U, W, tp, V, R ); }
512 : 0 : void bndPressureInt(
513 : : const std::array< std::vector< real >, 3 >& coord,
514 : : const std::vector< std::size_t >& triinpoel,
515 : : const std::vector< int >& slipwallbctri,
516 : : const tk::Fields& U,
517 : : const std::array< tk::real, 3 >& CM,
518 : : std::vector< real >& F ) const override
519 : 0 : { data.bndPressureInt( coord, triinpoel, slipwallbctri, U, CM, F ); }
520 : 6377 : real dt( const std::array< std::vector< real >, 3 >& coord,
521 : : const std::vector< std::size_t >& inpoel,
522 : : tk::real t,
523 : : tk::real dtn,
524 : : const tk::Fields& U,
525 : : const std::vector< tk::real >& vol,
526 : : const std::vector< tk::real >& voln ) const override
527 : 6377 : { return data.dt( coord, inpoel, t, dtn, U, vol, voln ); }
528 : 200 : void dt( uint64_t it,
529 : : const std::vector< real > & vol,
530 : : const tk::Fields& U,
531 : : std::vector< real >& dtp ) const override
532 : 200 : { data.dt( it, vol, U, dtp ); }
533 : : std::map< std::size_t, std::vector< std::pair<bool,real> > >
534 : 63502 : dirbc( real t,
535 : : real deltat,
536 : : const std::vector< real >& tp,
537 : : const std::vector< real >& dtp,
538 : : const std::pair< const int, std::vector< std::size_t > >& sides,
539 : : const std::array< std::vector< real >, 3 >& coord,
540 : : bool increment ) const
541 : : override { return data.dirbc( t, deltat, tp, dtp, sides, coord,
542 : 63502 : increment ); }
543 : 57991 : void symbc(
544 : : tk::Fields& U,
545 : : const std::array< std::vector< real >, 3 >& coord,
546 : : const std::unordered_map< int,
547 : : std::unordered_map< std::size_t,
548 : : std::array< real, 4 > > >& bnorm,
549 : : const std::unordered_set< std::size_t >& nodes ) const override
550 : 57991 : { data.symbc( U, coord, bnorm, nodes ); }
551 : 57982 : void farfieldbc(
552 : : tk::Fields& U,
553 : : const std::array< std::vector< real >, 3 >& coord,
554 : : const std::unordered_map< int,
555 : : std::unordered_map< std::size_t,
556 : : std::array< real, 4 > > >& bnorm,
557 : : const std::unordered_set< std::size_t >& nodes ) const override
558 : 57982 : { data.farfieldbc( U, coord, bnorm, nodes ); }
559 : 57991 : void slipwallbc(
560 : : tk::Fields& U,
561 : : const tk::Fields& W,
562 : : const std::array< std::vector< real >, 3 >& coord,
563 : : const std::unordered_map< int,
564 : : std::unordered_map< std::size_t,
565 : : std::array< real, 4 > > >& bnorm,
566 : : const std::unordered_set< std::size_t >& nodes ) const override
567 : 57991 : { data.slipwallbc( U, W, coord, bnorm, nodes ); }
568 : : void
569 : 41770 : timedepbc(
570 : : tk::real t,
571 : : tk::Fields& U,
572 : : const std::vector< std::unordered_set< std::size_t > >& nodes,
573 : : const std::vector< tk::Table<5> >& timedepfn ) const override
574 : 41770 : { data.timedepbc( t, U, nodes, timedepfn ); }
575 : 1403 : std::map< std::string, tk::GetVarFn > OutVarFn() const override
576 : 1403 : { return data.OutVarFn(); }
577 : 1195 : std::vector< std::string > analyticFieldNames() const override
578 : 1195 : { return data.analyticFieldNames(); }
579 : 1403 : std::vector< std::string > surfNames() const override
580 : 1403 : { return data.surfNames(); }
581 : 22 : std::vector< std::string > histNames() const override
582 : 22 : { return data.histNames(); }
583 : 85 : std::vector< std::string > names() const override
584 : 85 : { return data.names(); }
585 : 1403 : std::vector< std::vector< real > > surfOutput(
586 : : const std::map< int, std::vector< std::size_t > >& bnd,
587 : : const tk::Fields& U ) const override
588 : 1403 : { return data.surfOutput( bnd, U ); }
589 : 1403 : std::vector< std::vector< real > > elemSurfOutput(
590 : : const std::map< int, std::vector< std::size_t > >& bface,
591 : : const std::vector< std::size_t >& triinpoel,
592 : : const tk::Fields& U ) const override
593 : 1403 : { return data.elemSurfOutput( bface, triinpoel, U ); }
594 : 214 : std::vector< std::vector< real > > histOutput(
595 : : const std::vector< HistData >& h,
596 : : const std::vector< std::size_t >& inpoel,
597 : : const tk::Fields& U ) const override
598 : 214 : { return data.histOutput( h, inpoel, U ); }
599 : : tk::InitializeFn::result_type
600 : 111097 : analyticSolution( real xi, real yi, real zi, real t )
601 : 111097 : const override { return data.analyticSolution( xi, yi, zi, t ); }
602 : : tk::InitializeFn::result_type
603 : 1456210 : solution( real xi, real yi, real zi, real t )
604 : 1456210 : const override { return data.solution( xi, yi, zi, t ); }
605 : : T data;
606 : : };
607 : :
608 : : std::unique_ptr< Concept > self; //!< Base pointer used polymorphically
609 : : };
610 : :
611 : : } // inciter::
612 : :
613 : : #endif // CGPDE_h
|