Nektar++
Loading...
Searching...
No Matches
HOutflowBndCondOpImpl.hpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: HOutflowBndCondOpImpl.hpp
4//
5// For more information, please see: http://www.nektar.info
6//
7// The MIT License
8//
9// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10// Department of Aeronautics, Imperial College London (UK), and Scientific
11// Computing and Imaging Institute, University of Utah (USA).
12//
13// Permission is hereby granted, free of charge, to any person obtaining a
14// copy of this software and associated documentation files (the "Software"),
15// to deal in the Software without restriction, including without limitation
16// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17// and/or sell copies of the Software, and to permit persons to whom the
18// Software is furnished to do so, subject to the following conditions:
19//
20// The above copyright notice and this permission notice shall be included
21// in all copies or substantial portions of the Software.
22//
23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29// DEALINGS IN THE SOFTWARE.
30//
31// Description: Dong's high-order outflow boundary condition implementation.
32//
33///////////////////////////////////////////////////////////////////////////////
34
35#pragma once
36
39
41
42#include <algorithm>
43#include <map>
44#include <set>
45#include <utility>
46#include <vector>
47
50
64
65namespace Nektar::detail
66{
67
68template <typename ExecSpace, typename TData> class HOutflowBndCondOpImpl;
69
70/**
71 * @brief The Dirichlet condition of the pressure system, which applies the
72 * pressure of the HOutflowBndCondOpImpl set by SetOwner().
73 *
74 * @details
75 * Apply() sets the Dirichlet pressure coefficients of the regions with
76 * HOutflowBndCondOp::ApplyPressure(), from the pressure boundary values of
77 * the last HOutflowBndCondOp::UpdatePressure().
78 */
79template <typename ExecSpace, typename TData>
81{
82public:
84 const std::vector<std::string> &components)
85 : MultiRegions::DirBndCondOp<TData>(expansionList, components)
86 {
87 }
88
89 /// Set the operator whose pressure Apply() applies, which must outlive
90 /// this one.
92 {
93 m_owner = owner;
94 }
95
96protected:
98 {
99 m_owner->ApplyPressure(out);
100 }
101
102 void v_UpdateBndCoeffs([[maybe_unused]] const TData &time) override
103 {
104 // The pressure is set by UpdatePressure(), before the pressure solve.
105 }
106
107 size_t v_GetNumBndDofs() const override
108 {
109 return m_owner->GetNumPressureBndDofs();
110 }
111
112private:
113 // The operator owning this one, set by SetOwner().
115};
116
117/**
118 * @brief The Neumann condition of the velocity system, which applies the
119 * velocity flux of the HOutflowBndCondOpImpl set by SetOwner().
120 *
121 * @details
122 * Apply() computes the flux with HOutflowBndCondOp::ApplyVelocity(), from
123 * the solved pressure set by HOutflowBndCondOp::SetPressure() and the
124 * boundary data of the last HOutflowBndCondOp::UpdatePressure(), and adds
125 * its inner product to the velocity forcing, so the flux is never older than
126 * the pressure.
127 */
128template <typename ExecSpace, typename TData>
130{
131public:
133 const std::vector<std::string> &components)
134 : MultiRegions::NeuBndCondOp<TData>(expansionList, components)
135 {
136 }
137
138 /// Set the operator whose velocity flux Apply() applies, which must
139 /// outlive this one.
141 {
142 m_owner = owner;
143 }
144
145protected:
147 {
148 m_owner->ApplyVelocity(inout);
149 }
150
151 void v_UpdateBndCoeffs([[maybe_unused]] const TData &time) override
152 {
153 // The flux depends on the solved pressure, not on the time alone:
154 // Apply() computes it.
155 }
156
157 size_t v_GetNumBndDofs() override
158 {
159 return m_owner->GetNumVelocityBndDofs();
160 }
161
164 {
165 m_owner->AddVelocitySurfaceIntegral(data);
166 }
167
169 [[maybe_unused]] const std::string &userDefinedType) override
170 {
171 NEKERROR(ErrorUtil::efatal, "The HOutflow velocity condition applies "
172 "only its own regions; it has no default "
173 "regions to exclude.");
174 }
175
176private:
177 // The operator owning this one, set by SetOwner().
179};
180
181/**
182 * @brief Implementation of HOutflowBndCondOp.
183 *
184 * @details
185 * UpdatePressure() gathers the velocity on the volume elements adjacent to
186 * the regions and differentiates it there, extracts the velocity from the
187 * volume field and its gradient from those elements onto every region with
188 * PhysTraceExtractBndCond, evaluates the pressure condition and projects it
189 * onto the boundary basis. ApplyPressure(), the Apply() of the pressure
190 * adapter, then sets the Dirichlet pressure coefficients. ApplyVelocity(),
191 * the Apply() of the velocity adapter, extracts the solved pressure set by
192 * SetPressure() onto every region, evaluates the velocity flux, takes its
193 * inner product with the boundary basis and scatters it into the velocity
194 * forcing. Every block of the work runs on its own stream.
195 */
196template <typename ExecSpace, typename TData>
198{
199 using MemSpace = typename ExecSpace::memory_space;
200 friend class HOutflowPressureAdapter<ExecSpace, TData>;
201 friend class HOutflowVelocityAdapter<ExecSpace, TData>;
202
203public:
205 const MultiRegions::ExpListSharedPtr &pressureExpansionList,
206 const std::vector<std::string> &pressureComponents)
207 : HOutflowBndCondOp<TData>(pressureExpansionList, pressureComponents)
208 {
209 ASSERTL1(pressureComponents.size() == 1,
210 "HOutflow expects one pressure component.");
211 ASSERTL1(std::dynamic_pointer_cast<MultiRegions::ContField>(
212 pressureExpansionList),
213 "HOutflow requires a continuous pressure field.");
214 m_coordDim = pressureExpansionList->GetCoordim(0);
215
216 auto session = pressureExpansionList->GetSession();
217 session->LoadParameter("OutflowBC_theta", m_theta, TData(1));
218 session->LoadParameter("OutflowBC_alpha1", m_alpha1, TData(0));
219 session->LoadParameter("OutflowBC_alpha2", m_alpha2, TData(0));
220 session->LoadParameter("U0_HighOrderBC", m_U0, TData(1));
221 session->LoadParameter("Delta_HighOrderBC", m_delta, TData(1.0 / 20.0));
222 ASSERTL0(m_U0 > TData(0) && m_delta > TData(0),
223 "HOutflow requires positive U0_HighOrderBC and "
224 "Delta_HighOrderBC.");
225
227 this->m_pressureAdapter =
228 std::make_shared<HOutflowPressureAdapter<ExecSpace, TData>>(
229 pressureExpansionList, pressureComponents);
230 std::dynamic_pointer_cast<HOutflowPressureAdapter<ExecSpace, TData>>(
231 this->m_pressureAdapter)
232 ->SetOwner(this);
233 }
234
235 static std::string className;
236
237 static std::unique_ptr<MultiRegions::Operator<TData>> Instantiate(
238 const MultiRegions::ExpListSharedPtr &expansionList,
239 const std::vector<std::string> &components)
240 {
241 return std::make_unique<HOutflowBndCondOpImpl<ExecSpace, TData>>(
242 expansionList, components);
243 }
244
245protected:
246 // An index into a block at interleave width 1 and one into a block at
247 // m_interleaveWidth, each built from host data the first time a block at
248 // that width is seen, and kept.
256
257 // Point of the source block and point of the destination block of every
258 // point of a volume gather, for one pair of interleave widths of the two
259 // blocks.
265
266 // The boundary-adjacent elements of one block of the velocity field
267 // that land in one block of the restricted field.
269 {
270 unsigned int srcBlock = 0;
271 unsigned int dstBlock = 0;
272 size_t nData = 0;
273 // Element of the source block and element of the destination block
274 // of every element gathered, in increasing destination element.
275 std::vector<size_t> srcElmt;
276 std::vector<size_t> dstElmt;
277 // The indices for every pair of interleave widths of the source and
278 // the destination block seen, built from srcElmt and dstElmt the
279 // first time the pair is seen, and kept.
280 std::map<std::pair<unsigned int, unsigned int>, GatherIndices> indices;
281
282 // Move-only, as GatherIndices is: otherwise MSVC instantiates the
283 // copy of indices when std::vector<VolumeGather> reallocates.
284 VolumeGather() = default;
285 VolumeGather(const VolumeGather &) = delete;
289 };
290
291 // The coefficients of one domain block a boundary coefficient map
292 // writes: e * nCoeffs + c for coefficient c of element e, and the index
293 // built from it for the interleave width of the block.
295 {
296 size_t nCoeffs = 0;
297 std::vector<size_t> elmtCoeff;
299 };
300
301 // Interleave width of an interleaved field: 1 (Serial), the SIMD width
302 // (AVX) or the warp size (Device).
303 static constexpr unsigned int m_interleaveWidth =
305 // Stream the compact arrays are taken on, the first block's, through
306 // which the block streams writing and reading them wait on one another.
307 static constexpr unsigned int m_opStreamID = 1;
308
309 unsigned int m_coordDim = 0;
310 TData m_theta = 1, m_alpha1 = 0, m_alpha2 = 0, m_U0 = 1,
311 m_delta = TData(1.0 / 20.0);
312 bool m_pressureUpdated = false;
313 // Whether m_fbPhys has been evaluated, by the first UpdatePressure().
314 bool m_isFbEvaluated = false;
315
318 // The velocity on the boundary-adjacent elements, which m_physDerivOp
319 // differentiates into m_restrictedGradient. Both are laid out at the
320 // interleave width of the velocity (SetRestrictedInterleaveWidth()).
323 std::shared_ptr<MultiRegions::PhysDerivOp<TData>> m_physDerivOp;
324
325 std::vector<unsigned int> m_pressureConditionIndices;
326 std::vector<unsigned int> m_regionIds;
327 std::vector<MultiRegions::ExpListSharedPtr> m_pressureBndExpLists;
328 std::vector<MultiRegions::ExpListSharedPtr> m_velocityBndExpLists;
329 // Per region, the pressure condition UpdatePressure() evaluates, and
330 // then the solved pressure the velocity adapter extracts.
331 std::vector<LibUtilities::Field<TData, FieldState::Phys>> m_pressureBndPhys;
332 std::vector<LibUtilities::Field<TData, FieldState::Coeff>>
334 std::vector<LibUtilities::Field<TData, FieldState::Phys>> m_velocityBndPhys;
335 std::vector<LibUtilities::Field<TData, FieldState::Coeff>>
337 // The sum of the surface integrals of m_velocityBndCoeffs.
340 std::vector<LibUtilities::Field<TData, FieldState::Phys>> m_fbPhys;
341 std::vector<LibUtilities::Field<TData, FieldState::Phys>> m_normals;
342 std::vector<LibUtilities::Field<TData, FieldState::Phys>> m_energyMinusFb;
343 std::vector<LibUtilities::Field<TData, FieldState::Phys>> m_divergence;
344 std::vector<std::shared_ptr<MultiRegions::FwdTransBCOp<TData>>>
346 std::vector<std::shared_ptr<MultiRegions::IProductWRTBaseOp<TData>>>
348 std::vector<std::shared_ptr<MultiRegions::ExpressionOp<TData>>>
350 // Per region, whether an expression of f_b depends on time, so that
351 // m_fbPhys is evaluated at every update.
352 std::vector<bool> m_fbIsTimeDependent;
353 std::vector<VolumeGather> m_volumeGathers;
354
355 // Per region, extracts the velocity onto the points of the region from
356 // the volume velocity field.
357 std::vector<std::shared_ptr<
360 std::vector<LibUtilities::Field<TData, FieldState::Phys>> m_bndVelocity;
361 // Per region, extracts m_restrictedGradient onto the points of the
362 // region.
363 std::vector<std::shared_ptr<
366 std::vector<LibUtilities::Field<TData, FieldState::Phys>> m_bndGradient;
367 // Per region, extracts the solved pressure onto the points of the
368 // region.
369 std::vector<std::shared_ptr<
372
375 std::vector<size_t> m_pressureCoeffOffsets;
376 std::vector<size_t> m_velocityCoeffOffsets;
379 // Streams of the region and domain blocks, which write the compact
380 // arrays and read the values gathered from them.
381 std::vector<unsigned int> m_pressureUpdateStreams;
382 std::vector<unsigned int> m_velocityUpdateStreams;
383
384 // The targets of the pressure and velocity maps are indexed at the
385 // interleave width of the block ApplyPressure() or ApplyVelocity()
386 // receives.
388 std::vector<CoeffTargets> m_pressureMap;
389 std::vector<LibUtilities::MemoryRegion<TData>> m_pressureSign;
390 std::vector<LibUtilities::MemoryRegion<TData>> m_pressureMappedCoeff;
391 std::vector<LibUtilities::MemoryRegion<size_t>> m_pressureCoeffSrc;
392 // Offset and number of the pressure targets, per block (the pressure
393 // has one component).
394 std::vector<size_t> m_pressureOffsets;
395 std::vector<size_t> m_pressureCounts;
396
398 std::vector<bool> m_velocitySignChange;
399 std::vector<CoeffTargets> m_velocityMap;
400 std::vector<LibUtilities::MemoryRegion<TData>> m_velocitySign;
401 std::vector<LibUtilities::MemoryRegion<TData>> m_velocityMappedCoeff;
402 std::vector<LibUtilities::MemoryRegion<size_t>> m_velocityCoeffSrc;
403 std::vector<std::vector<size_t>> m_velocityCompOffsets;
404 std::vector<std::vector<size_t>> m_velocityCompCounts;
405 std::vector<CoeffTargets> m_velocityGroupTarget;
406 std::vector<LibUtilities::MemoryRegion<size_t>> m_velocityGroupOffset;
407 std::vector<LibUtilities::MemoryRegion<size_t>> m_velocityGroupSrc;
408 std::vector<LibUtilities::MemoryRegion<TData>> m_velocityGroupSign;
409 std::vector<LibUtilities::MemoryRegion<TData>> m_velocityGroupValue;
410 std::vector<std::vector<size_t>> m_velocityCompGroupOffsets;
411 std::vector<std::vector<size_t>> m_velocityCompGroupCounts;
412
414 {
416 }
417
419 {
421 }
422
423 // Add the surface integral of the velocity flux of the last
424 // ApplyVelocity(), per velocity component, to data[c].
429
431 const MultiRegions::ExpListSharedPtr &velocityExpansionList,
432 const std::vector<std::string> &velocityComponents) override
433 {
434 ASSERTL1(velocityComponents.size() >= m_coordDim,
435 "Insufficient velocity components for HOutflow.");
436 const std::vector<std::string> components(velocityComponents.begin(),
437 velocityComponents.begin() +
438 m_coordDim);
439 m_velocityExpansionList = velocityExpansionList;
440
442 BuildBoundaryElementData(components);
443 this->m_velocityAdapter =
444 std::make_shared<HOutflowVelocityAdapter<ExecSpace, TData>>(
445 velocityExpansionList, components);
446 std::dynamic_pointer_cast<HOutflowVelocityAdapter<ExecSpace, TData>>(
447 this->m_velocityAdapter)
448 ->SetOwner(this);
449 }
450
453 {
455 "SetVelocityContext must be called before UpdatePressure.");
456 ASSERTL1(this->m_kinvis > TData(0),
457 "HOutflow requires a positive kinematic viscosity, set by "
458 "SetKinvis().");
460 {
461 m_pressureUpdated = true;
462 return;
463 }
464
465 // The fields on the boundary-adjacent elements take the interleave
466 // width of the velocity.
467 const unsigned int interleaveWidth =
468 velocity.GetBlocks()[m_volumeGathers[0].srcBlock]
469 .GetInterleaveWidth();
472 GatherVelocity(velocity);
474
475 EvaluateFb(this->m_time);
476 EvaluatePressure(velocity, this->m_kinvis, this->m_scale);
478 m_pressureUpdated = true;
479 }
480
482 {
484 {
485 return;
486 }
487
488 for (unsigned int blk = 0; blk < out.GetBlocks().size(); ++blk)
489 {
490 const unsigned int streamID = blk + 1;
491 // The targets index the block at its own interleave width.
492 auto &outBlock = out.GetBlocks()[blk];
493 const unsigned int interleaveWidth = outBlock.GetInterleaveWidth();
494 auto outPtr =
495 outBlock.template GetPtr<MemSpace, ReadWrite>(streamID);
496
497 const size_t count = m_pressureCounts[blk];
498 if (count > 0)
499 {
500 const size_t offset = m_pressureOffsets[blk];
501 auto mapPtr =
503 interleaveWidth, streamID)
504 .template GetPtr<MemSpace, ReadOnly>(streamID) +
505 offset;
506 auto coeffPtr =
508 .template GetPtr<MemSpace, ReadOnly>(streamID) +
509 offset;
511 {
512 auto signPtr =
513 m_pressureSign[blk].template GetPtr<MemSpace, ReadOnly>(
514 streamID) +
515 offset;
516 MultiRegions::detail::DirBndCondKernel<ExecSpace>(
517 count, signPtr, mapPtr, coeffPtr, outPtr, streamID);
518 }
519 else
520 {
521 MultiRegions::detail::DirBndCondKernel<ExecSpace>(
522 count, mapPtr, coeffPtr, outPtr, streamID);
523 }
524 }
525 }
526 }
527
529 {
530 // A rank without regions has nothing to apply, and need not have
531 // updated the pressure.
533 {
534 return;
535 }
537 "UpdatePressure must precede the velocity solve.");
538 ASSERTL1(this->m_pressure,
539 "SetPressure must be called before the velocity solve.");
540 ASSERTL1(this->m_kinvis > TData(0),
541 "HOutflow requires a positive kinematic viscosity, set by "
542 "SetKinvis().");
545 ApplyNeumannMaps(inout);
546 }
547
548 // Whether a boundary condition is part of the high-order outflow
549 // condition: USERDEFINEDTYPE="HOutflow".
550 static bool IsHOutflow(
552 {
553 return StringUtils::IEquals(condition->GetUserDefined(),
555 }
556
558 {
559 const auto &bndExpansions =
560 this->m_expansionList->GetBndCondExpansions();
561 const auto &bndConditions = this->m_expansionList->GetBndConditions();
563 this->m_expansionList->GetSession(),
564 this->m_expansionList->GetGraph());
565 const auto &bregions = bcs.GetBoundaryRegions();
566 for (const auto &[regionId, region] : bregions)
567 {
568 m_regionIds.push_back(regionId);
569 }
570 ASSERTL1(m_regionIds.size() == bndExpansions.size(),
571 "Boundary region and expansion counts differ.");
572
573 std::vector<std::vector<bool>> isTypeByRegion(bndExpansions.size());
574 std::vector<size_t> numBcExpCoeffs(bndExpansions.size());
575 for (unsigned int n = 0; n < bndExpansions.size(); ++n)
576 {
577 const bool match = IsHOutflow(bndConditions[n]);
578 ASSERTL0(!match || bndConditions[n]->GetBoundaryConditionType() ==
580 "HOutflow pressure conditions must be Dirichlet.");
581 isTypeByRegion[n] = {match};
582 numBcExpCoeffs[n] = bndExpansions[n]->GetNcoeffs();
583 if (!match)
584 {
585 continue;
586 }
587
588 auto bndExp = bndExpansions[n];
589 bndExp->SetDataWarehouse();
590 m_pressureConditionIndices.push_back(n);
591 m_pressureBndExpLists.push_back(bndExp);
593 m_pressureNumBndCoeffCompSize += bndExp->GetNcoeffs();
594
595 const auto physBlocks =
596 MultiRegions::GetBlockAttributes<TData, FieldState::Phys>(
597 bndExp, MultiRegions::UnitInterleaveWidths(bndExp));
598 const auto coeffBlocks =
599 MultiRegions::GetBlockAttributes<TData, FieldState::Coeff>(
600 bndExp, MultiRegions::UnitInterleaveWidths(bndExp));
601 m_pressureBndPhys.emplace_back("HOutflow pressure boundary phys",
602 physBlocks, this->m_components, 1);
603 m_pressureBndCoeffs.emplace_back(
604 "HOutflow pressure boundary coeffs", coeffBlocks,
605 this->m_components, 1);
606 m_pressureBndPhys.back().template Initialize<MemSpace>(0.0);
607 m_pressureBndCoeffs.back().template Initialize<MemSpace>(0.0);
608 m_pressureFwdTransOps.push_back(
610 bndExp, this->m_components, ExecSpace::name));
611 }
612
614 {
615 return;
616 }
617 // The kernels are instantiated for two and three dimensions.
618 ASSERTL0(m_coordDim == 2 || m_coordDim == 3,
619 "HOutflow is implemented for two and three dimensions.");
620 auto maps =
621 MultiRegions::detail::BuildCGBndCondCoeffMaps<ExecSpace, TData>(
622 this->m_expansionList, this->m_components, bregions,
623 isTypeByRegion, numBcExpCoeffs, m_pressureNumBndCoeffCompSize,
625 [](unsigned int, const auto &, const auto &, const auto &) {});
626 m_pressureSignChange = maps.signChange[0];
627 m_pressureSign = std::move(maps.sign);
628 m_pressureMappedCoeff = std::move(maps.bndCoeff);
629 m_pressureCoeffSrc = std::move(maps.bndCoeffSrc);
630 m_pressureOffsets.resize(maps.compOffsets.size());
631 m_pressureCounts.resize(maps.compCounts.size());
632 for (size_t blk = 0; blk < m_pressureCounts.size(); ++blk)
633 {
634 m_pressureOffsets[blk] = maps.compOffsets[blk][0];
635 m_pressureCounts[blk] = maps.compCounts[blk][0];
636 }
639 // Allocated here, on the null stream, so the region block streams
640 // that write it never race the allocation.
641 m_pressureCompactCoeff.template GetPtr<MemSpace, WriteOnly>();
644
645 m_pressureMap = BuildCoeffTargets(maps.map, this->m_expansionList);
646 }
647
649 const std::vector<std::string> &components)
650 {
652 this->m_expansionList->GetSession(),
653 this->m_expansionList->GetGraph());
654 const auto &bregions = bcs.GetBoundaryRegions();
655 const auto &conditions = bcs.GetBoundaryConditions();
656 const auto &velocityExp =
657 m_velocityExpansionList->GetBndCondExpansions();
658 ASSERTL1(velocityExp.size() == m_regionIds.size(),
659 "Pressure and velocity boundary region counts differ.");
660
661 std::set<unsigned int> selected(m_pressureConditionIndices.begin(),
663 std::vector<std::vector<bool>> isTypeByRegion(m_regionIds.size());
664 std::vector<size_t> numBcExpCoeffs(m_regionIds.size());
665 // Per selected region, the velocity components of its surface
666 // integral, every one.
667 std::vector<std::vector<bool>> velocityIsComp;
668
669 for (unsigned int n = 0; n < m_regionIds.size(); ++n)
670 {
671 const auto conditionIt = conditions.find(m_regionIds[n]);
672 ASSERTL0(conditionIt != conditions.end(),
673 "Unable to locate HOutflow boundary region.");
674 bool anyVelocityTag = false;
675 bool allVelocityHOutflow = true;
676 bool isTimeDependent = false;
677 std::vector<LibUtilities::EquationSharedPtr> equations;
678 std::vector<bool> componentMatches(m_coordDim, false);
679 for (unsigned int d = 0; d < m_coordDim; ++d)
680 {
681 const auto componentIt =
682 conditionIt->second->find(components[d]);
683 ASSERTL0(componentIt != conditionIt->second->end(),
684 "Unable to locate HOutflow velocity component.");
685 const bool tagged = IsHOutflow(componentIt->second);
686 const bool valid =
687 tagged && componentIt->second->GetBoundaryConditionType() ==
689 anyVelocityTag = anyVelocityTag || tagged;
690 allVelocityHOutflow = allVelocityHOutflow && valid;
691 componentMatches[d] = valid;
692 equations.push_back(componentIt->second->GetEquation());
693 const auto variables = MultiRegions::ExpressionBlockOp<TData>::
694 GetExpressionVariables(equations.back()->GetExpression());
695 isTimeDependent = isTimeDependent || variables.count("t") != 0;
696 }
697
698 const bool pressureSelected = selected.count(n) != 0;
699 ASSERTL0(!anyVelocityTag || pressureSelected,
700 "HOutflow velocity conditions require a paired "
701 "HOutflow pressure Dirichlet condition.");
702 ASSERTL0(!pressureSelected || allVelocityHOutflow,
703 "HOutflow pressure conditions require HOutflow Neumann "
704 "conditions on every velocity component.");
705 isTypeByRegion[n] = pressureSelected
706 ? componentMatches
707 : std::vector<bool>(m_coordDim, false);
708 numBcExpCoeffs[n] = velocityExp[n]->GetNcoeffs();
709 if (!pressureSelected)
710 {
711 continue;
712 }
713
714 const unsigned int selectedId = m_velocityBndExpLists.size();
715 auto bndExp = velocityExp[n];
716 bndExp->SetDataWarehouse();
717 // The pressure and velocity boundary values are computed from
718 // one another point by point. The two boundary expansions may
719 // differ in order, but must share their quadrature and phys
720 // block layout.
721 const auto &pressureBndExp = m_pressureBndExpLists[selectedId];
722 ASSERTL0(bndExp->SameQuadratureLayout(pressureBndExp),
723 "HOutflow requires the velocity and pressure boundary "
724 "expansions to share their quadrature points.");
725 m_velocityBndExpLists.push_back(bndExp);
726 velocityIsComp.push_back(componentMatches);
728 m_velocityNumBndCoeffCompSize += bndExp->GetNcoeffs();
729
730 const auto physBlocks =
731 MultiRegions::GetBlockAttributes<TData, FieldState::Phys>(
732 bndExp, MultiRegions::UnitInterleaveWidths(bndExp));
733 const auto coeffBlocks =
734 MultiRegions::GetBlockAttributes<TData, FieldState::Coeff>(
735 bndExp, MultiRegions::UnitInterleaveWidths(bndExp));
736 m_velocityBndPhys.emplace_back("HOutflow velocity boundary phys",
737 physBlocks, components, 1);
738 m_velocityBndCoeffs.emplace_back(
739 "HOutflow velocity boundary coeffs", coeffBlocks, components,
740 1);
741 m_fbPhys.emplace_back("HOutflow f_b", physBlocks, components, 1);
742 m_normals.emplace_back("HOutflow normals", physBlocks, components,
743 1);
744 m_energyMinusFb.emplace_back("HOutflow E minus f_b", physBlocks,
745 components, 1);
746 m_divergence.emplace_back("HOutflow divergence", physBlocks,
747 this->m_components, 1);
748 m_velocityBndPhys.back().template Initialize<MemSpace>(0.0);
749 m_velocityBndCoeffs.back().template Initialize<MemSpace>(0.0);
750 m_fbPhys.back().template Initialize<MemSpace>(0.0);
751 m_normals.back().template Initialize<MemSpace>(0.0);
752 m_energyMinusFb.back().template Initialize<MemSpace>(0.0);
753 m_divergence.back().template Initialize<MemSpace>(0.0);
754
756 bndExp, components, ExecSpace::name);
757 expression->SetExpressions(equations);
758 m_fbExpressionOps.push_back(expression);
759 m_fbIsTimeDependent.push_back(isTimeDependent);
760 m_velocityIProductOps.push_back(
762 bndExp, components, ExecSpace::name));
763
765 this->m_expansionList->GetBoundaryNormals(n, normals);
766 for (unsigned int blk = 0;
767 blk < m_normals.back().GetBlocks().size(); ++blk)
768 {
769 auto &normalBlock = m_normals.back().GetBlocks()[blk];
770 auto ptr =
771 normalBlock
772 .template GetPtr<NektarSpaces::HostSpace, WriteOnly>();
773 auto collection = MultiRegions::GetCollection(bndExp, blk);
774 const auto &expansions = collection.GetExpVector();
775 for (unsigned int e = 0; e < expansions.size(); ++e)
776 {
777 const auto offset =
778 bndExp->GetPhys_Offset(expansions[e]->GetElmtId());
779 for (unsigned int d = 0; d < m_coordDim; ++d)
780 {
781 for (unsigned int p = 0; p < normalBlock.GetNumData();
782 ++p)
783 {
784 ptr[d * normalBlock.CompSize() +
785 e * normalBlock.GetNumData() + p] =
786 static_cast<TData>(normals[d][offset + p]);
787 }
788 }
789 }
790 }
791 }
792
794 "HOutflow pressure and velocity region sets differ.");
797 m_velocityBndExpLists, velocityIsComp);
798 // The assembly map of a velocity component other than the one of
799 // m_velocityExpansionList is built from a ContField, collectively: all
800 // ranks enter BuildCGBndCondCoeffMaps() when any rank has an HOutflow
801 // region, even without coefficients of its own.
802 size_t hasAnyVelocityBndCoeff = m_velocityNumBndCoeffCompSize;
803 this->m_expansionList->GetSession()->GetComm()->GetRowComm()->AllReduce(
804 hasAnyVelocityBndCoeff, LibUtilities::ReduceMax);
805 if (hasAnyVelocityBndCoeff == 0)
806 {
807 return;
808 }
809
810 auto maps =
811 MultiRegions::detail::BuildCGBndCondCoeffMaps<ExecSpace, TData>(
812 m_velocityExpansionList, components, bregions, isTypeByRegion,
813 numBcExpCoeffs, m_velocityNumBndCoeffCompSize,
815 [](unsigned int, const auto &, const auto &, const auto &) {});
816 m_velocityAnySignChange = maps.anySignChange;
817 m_velocitySignChange = std::move(maps.signChange);
818 m_velocitySign = std::move(maps.uniqueSign);
819 m_velocityMappedCoeff = std::move(maps.uniqueBndCoeff);
820 m_velocityCoeffSrc = std::move(maps.uniqueBndCoeffSrc);
821 m_velocityCompOffsets = std::move(maps.compUniqueOffsets);
822 m_velocityCompCounts = std::move(maps.compUniqueCounts);
823 m_velocityGroupOffset = std::move(maps.groupOffset);
824 m_velocityGroupSrc = std::move(maps.groupSrc);
825 m_velocityGroupSign = std::move(maps.groupSign);
826 m_velocityGroupValue = std::move(maps.groupValue);
827 m_velocityCompGroupOffsets = std::move(maps.compGroupOffsets);
828 m_velocityCompGroupCounts = std::move(maps.compGroupCounts);
831 // Allocated here, on the null stream, so the region block streams
832 // that write it never race the allocation. A rank without velocity
833 // coefficients of its own never uses it.
835 {
836 m_velocityCompactCoeff.template GetPtr<MemSpace, WriteOnly>();
837 }
840
845 }
846
847 // The streams of @p nDomainBlocks domain blocks and of the blocks of
848 // every region field of @p fields.
849 static std::vector<unsigned int> UpdateStreams(
850 const size_t nDomainBlocks,
852 {
853 size_t nUpdateStreams = nDomainBlocks;
854 for (auto &field : fields)
855 {
856 nUpdateStreams = std::max(nUpdateStreams, field.GetBlocks().size());
857 }
858 std::vector<unsigned int> streams;
859 for (unsigned int id = 1; id <= nUpdateStreams; ++id)
860 {
861 streams.push_back(id);
862 }
863 return streams;
864 }
865
866 // The targets of every domain block of @p expansionList from the index
867 // into the block at interleave width 1 BuildCGBndCondCoeffMaps() returns,
868 // which is read back to the host once. The indices into the blocks are
869 // built from it on first use.
870 std::vector<CoeffTargets> BuildCoeffTargets(
871 std::vector<LibUtilities::MemoryRegion<size_t>> &unitWidthIndex,
872 const MultiRegions::ExpListSharedPtr &expansionList)
873 {
874 const auto coeffBlocks =
875 MultiRegions::GetBlockAttributes<TData, FieldState::Coeff>(
876 expansionList,
877 MultiRegions::UnitInterleaveWidths(expansionList));
878 std::vector<CoeffTargets> targets(unitWidthIndex.size());
879 for (unsigned int blk = 0; blk < unitWidthIndex.size(); ++blk)
880 {
881 targets[blk].nCoeffs = coeffBlocks[blk].GetNumData();
882 const size_t nTargets = unitWidthIndex[blk].size();
883 if (nTargets > 0)
884 {
885 auto elmtCoeff =
886 unitWidthIndex[blk]
887 .template GetPtr<NektarSpaces::HostSpace, ReadOnly>();
888 targets[blk].elmtCoeff.assign(elmtCoeff, elmtCoeff + nTargets);
889 }
890 }
891 return targets;
892 }
893
894 void BuildBoundaryElementData(const std::vector<std::string> &components)
895 {
897 {
898 return;
899 }
900 struct VolumeLocation
901 {
902 unsigned int block;
903 size_t element;
905 };
906
907 auto BuildLocations = [](const MultiRegions::ExpListSharedPtr &list,
908 auto &locations, auto &owners) {
909 const auto blocks =
910 MultiRegions::GetBlockAttributes<TData, FieldState::Phys>(
911 list, MultiRegions::UnitInterleaveWidths(list));
912 for (unsigned int blk = 0; blk < blocks.size(); ++blk)
913 {
914 auto collection = MultiRegions::GetCollection(list, blk);
915 const auto &expansions = collection.GetExpVector();
916 for (unsigned int e = 0; e < expansions.size(); ++e)
917 {
918 const int geometry =
919 expansions[e]->GetGeom()->GetGlobalID();
920 locations[geometry] = {blk, e, expansions[e]};
921 for (unsigned int f = 0; f < expansions[e]->GetNtraces();
922 ++f)
923 {
924 owners[expansions[e]->GetGeom()->GetTid(f)] = {geometry,
925 f};
926 }
927 }
928 }
929 };
930
931 std::map<int, VolumeLocation> velocityLocations;
932 std::map<int, std::pair<int, unsigned int>> velocityOwners;
933 BuildLocations(m_velocityExpansionList, velocityLocations,
934 velocityOwners);
935
936 // The velocity elements adjacent to a region, matched to its
937 // elements by geometry id. The pressure and velocity boundary
938 // expansion lists agree element for element
939 // (ValidateAndBuildVelocityBoundaryData()).
940 std::set<int> selectedVelocityGeometry;
941 for (unsigned int n = 0; n < m_pressureBndExpLists.size(); ++n)
942 {
943 const auto blocks =
944 MultiRegions::GetBlockAttributes<TData, FieldState::Phys>(
946 MultiRegions::UnitInterleaveWidths(
948 for (unsigned int blk = 0; blk < blocks.size(); ++blk)
949 {
950 auto collection =
952 const auto &expansions = collection.GetExpVector();
953 for (unsigned int e = 0; e < expansions.size(); ++e)
954 {
955 const auto owner = velocityOwners.find(
956 expansions[e]->GetGeom()->GetGlobalID());
957 ASSERTL1(owner != velocityOwners.end(),
958 "Unable to locate an element adjacent to "
959 "HOutflow.");
960 selectedVelocityGeometry.insert(owner->second.first);
961 }
962 }
963 }
964
966 const auto &velocityInfo =
967 m_velocityExpansionList->GetGraph()->GetExpansionInfo(
968 components[0]);
969 for (const auto geometry : selectedVelocityGeometry)
970 {
971 const auto it = velocityInfo.find(geometry);
972 ASSERTL1(it != velocityInfo.end(),
973 "Unable to locate HOutflow velocity expansion data.");
974 restrictedInfo.emplace(*it);
975 }
978 m_velocityExpansionList->GetSession(), restrictedInfo, false);
979 m_restrictedVelocityExpansionList->SetDataWarehouse();
980 const auto restrictedBlocks =
981 MultiRegions::GetBlockAttributes<TData, FieldState::Phys>(
983 MultiRegions::UnitInterleaveWidths(
986 "HOutflow restricted velocity", restrictedBlocks, components, 1);
987 std::vector<std::string> gradientComponents(m_coordDim * m_coordDim);
988 for (unsigned int d = 0; d < m_coordDim; ++d)
989 {
990 for (unsigned int j = 0; j < m_coordDim; ++j)
991 {
992 gradientComponents[d * m_coordDim + j] =
993 "d" + components[d] + "d" + std::to_string(j);
994 }
995 }
997 "HOutflow restricted velocity gradient", restrictedBlocks,
998 gradientComponents, 1);
999 m_restrictedVelocity.template Initialize<MemSpace>(0.0);
1000 m_restrictedGradient.template Initialize<MemSpace>(0.0);
1001
1002 std::map<int, VolumeLocation> restrictedLocations;
1003 std::map<int, std::pair<int, unsigned int>> unusedOwners;
1004 BuildLocations(m_restrictedVelocityExpansionList, restrictedLocations,
1005 unusedOwners);
1006 // Per pair of source and destination block, the destination element
1007 // of every element gathered, mapped to its source element, in
1008 // increasing destination element.
1009 std::map<std::pair<unsigned int, unsigned int>,
1010 std::map<size_t, size_t>>
1011 gathers;
1012 for (const int geometry : selectedVelocityGeometry)
1013 {
1014 const auto &src = velocityLocations.at(geometry);
1015 const auto &dst = restrictedLocations.at(geometry);
1016 gathers[{src.block, dst.block}][dst.element] = src.element;
1017 }
1018 for (auto &[blocks, map] : gathers)
1019 {
1020 VolumeGather gather;
1021 gather.srcBlock = blocks.first;
1022 gather.dstBlock = blocks.second;
1023 gather.nData = restrictedBlocks[blocks.second].GetNumData();
1024 for (const auto &[dstElmt, srcElmt] : map)
1025 {
1026 gather.dstElmt.push_back(dstElmt);
1027 gather.srcElmt.push_back(srcElmt);
1028 }
1029 m_volumeGathers.push_back(std::move(gather));
1030 }
1031
1033 m_restrictedVelocityExpansionList, components, ExecSpace::name);
1034
1035 // Per region, the extractions of the velocity, of its gradient and
1036 // of the pressure. The pressure and velocity boundary expansion
1037 // lists have the same points (ValidateAndBuildVelocityBoundaryData()),
1038 // so the extracted fields pair with m_normals and m_fbPhys point by
1039 // point. The velocity is extracted from the volume velocity field,
1040 // and its gradient from m_restrictedGradient: the expansion list of
1041 // the latter, built from an ExpansionInfoMap, has no mesh graph, so
1042 // its extraction takes that of the velocity field.
1043 for (unsigned int n = 0; n < m_pressureBndExpLists.size(); ++n)
1044 {
1045 const auto bndPhysBlocks =
1046 MultiRegions::GetBlockAttributes<TData, FieldState::Phys>(
1048 MultiRegions::UnitInterleaveWidths(
1050
1051 m_bndVelocityExtractOps.push_back(
1053 ExecSpace, TData>>(m_velocityExpansionList, components,
1055 ExecSpace::name));
1056 m_bndVelocity.emplace_back("HOutflow boundary velocity",
1057 bndPhysBlocks, components, 1);
1058 m_bndVelocity.back().template Initialize<MemSpace>(0.0);
1059
1060 m_bndGradientExtractOps.push_back(
1062 ExecSpace, TData>>(
1063 m_restrictedVelocityExpansionList, gradientComponents,
1064 m_pressureBndExpLists[n], ExecSpace::name,
1065 m_velocityExpansionList->GetGraph()));
1066 m_bndGradient.emplace_back("HOutflow boundary velocity gradient",
1067 bndPhysBlocks, gradientComponents, 1);
1068 m_bndGradient.back().template Initialize<MemSpace>(0.0);
1069
1070 m_bndPressureExtractOps.push_back(
1072 ExecSpace, TData>>(
1073 this->m_expansionList, this->m_components,
1074 m_pressureBndExpLists[n], ExecSpace::name));
1075 }
1076 }
1077
1078 // Point of a block at interleave width @p interleaveWidth of every point
1079 // @p gather copies of the elements @p elmts, its source or its
1080 // destination elements: point q of element e lies at
1081 // (e / interleaveWidth) * interleaveWidth * nData + q * interleaveWidth
1082 // + e % interleaveWidth. The points are in the order of the destination
1083 // points in a destination block at interleave width
1084 // @p dstInterleaveWidth, the lane varying fastest, so that neighbouring
1085 // threads write neighbouring points, and read neighbouring points where
1086 // neighbouring destination elements come from neighbouring source
1087 // elements.
1088 static std::vector<size_t> PointIndex(const VolumeGather &gather,
1089 const std::vector<size_t> &elmts,
1090 const unsigned int interleaveWidth,
1091 const unsigned int dstInterleaveWidth)
1092 {
1093 std::vector<size_t> index;
1094 index.reserve(elmts.size() * gather.nData);
1095 // The destination elements increase, so those of one destination
1096 // group are consecutive.
1097 for (size_t first = 0; first < elmts.size();)
1098 {
1099 const size_t dstGroup = gather.dstElmt[first] / dstInterleaveWidth;
1100 size_t last = first + 1;
1101 while (last < elmts.size() &&
1102 gather.dstElmt[last] / dstInterleaveWidth == dstGroup)
1103 {
1104 ++last;
1105 }
1106 for (size_t q = 0; q < gather.nData; ++q)
1107 {
1108 for (size_t k = first; k < last; ++k)
1109 {
1110 const size_t group = elmts[k] / interleaveWidth;
1111 const size_t lane = elmts[k] % interleaveWidth;
1112 index.push_back(group * interleaveWidth * gather.nData +
1113 q * interleaveWidth + lane);
1114 }
1115 }
1116 first = last;
1117 }
1118 return index;
1119 }
1120
1121 // Coefficient of a domain block at interleave width @p interleaveWidth of
1122 // every target of @p targets: coefficient c of element e lies at
1123 // (e / interleaveWidth) * interleaveWidth * nCoeffs + c * interleaveWidth
1124 // + e % interleaveWidth.
1125 static std::vector<size_t> TargetIndex(const CoeffTargets &targets,
1126 const unsigned int interleaveWidth)
1127 {
1128 std::vector<size_t> index(targets.elmtCoeff.size());
1129 for (size_t k = 0; k < index.size(); ++k)
1130 {
1131 const size_t elmt = targets.elmtCoeff[k] / targets.nCoeffs;
1132 const size_t coeff = targets.elmtCoeff[k] % targets.nCoeffs;
1133 const size_t group = elmt / interleaveWidth;
1134 const size_t lane = elmt % interleaveWidth;
1135 index[k] = group * interleaveWidth * targets.nCoeffs +
1136 coeff * interleaveWidth + lane;
1137 }
1138 return index;
1139 }
1140
1141 // The one of the indices of @p indices for a block at interleave width
1142 // @p interleaveWidth, built from the host index @p buildIndex returns for
1143 // that width, on stream @p streamID, the first time it is requested.
1144 template <typename BuildIndexFn>
1146 InterleaveWidthIndices &indices, const unsigned int interleaveWidth,
1147 const unsigned int streamID, BuildIndexFn &&buildIndex)
1148 {
1149 ASSERTL0(interleaveWidth == 1u || interleaveWidth == m_interleaveWidth,
1150 "HOutflow takes fields at interleave width 1 or at the "
1151 "interleave width of its execution space.");
1152 const bool isUnitWidth = interleaveWidth == 1u;
1153 auto &index = isUnitWidth ? indices.index : indices.interleavedIndex;
1154 bool &isBuilt = isUnitWidth ? indices.isBuiltIndex
1155 : indices.isBuiltInterleavedIndex;
1156 if (!isBuilt)
1157 {
1159 MemSpace, size_t>(buildIndex(interleaveWidth), streamID);
1160 isBuilt = true;
1161 }
1162 return index;
1163 }
1164
1165 // The indices of @p gather for a source block at interleave width
1166 // @p srcInterleaveWidth and a destination block at
1167 // @p dstInterleaveWidth, built on stream @p streamID on first use.
1169 VolumeGather &gather, const unsigned int srcInterleaveWidth,
1170 const unsigned int dstInterleaveWidth, const unsigned int streamID)
1171 {
1172 ASSERTL0((srcInterleaveWidth == 1u ||
1173 srcInterleaveWidth == m_interleaveWidth) &&
1174 (dstInterleaveWidth == 1u ||
1175 dstInterleaveWidth == m_interleaveWidth),
1176 "HOutflow takes fields at interleave width 1 or at the "
1177 "interleave width of its execution space.");
1178 auto [it, isNew] = gather.indices.try_emplace(
1179 std::make_pair(srcInterleaveWidth, dstInterleaveWidth));
1180 if (isNew)
1181 {
1182 it->second.srcIndex =
1184 MemSpace, size_t>(PointIndex(gather, gather.srcElmt,
1185 srcInterleaveWidth,
1186 dstInterleaveWidth),
1187 streamID);
1188 it->second.dstIndex =
1190 MemSpace, size_t>(PointIndex(gather, gather.dstElmt,
1191 dstInterleaveWidth,
1192 dstInterleaveWidth),
1193 streamID);
1194 }
1195 return it->second;
1196 }
1197
1198 // Lay @p field, on the boundary-adjacent elements, out at interleave
1199 // width @p interleaveWidth, that of the velocity, so that the gathers
1200 // write it and the operators on those elements read it without
1201 // reshaping. A field changing width is zeroed, so that its padding
1202 // stays zero: every element of it is written again before it is read.
1205 const unsigned int interleaveWidth)
1206 {
1207 ASSERTL0(interleaveWidth == 1u || interleaveWidth == m_interleaveWidth,
1208 "HOutflow takes fields at interleave width 1 or at the "
1209 "interleave width of its execution space.");
1210 bool isAtWidth = true;
1211 for (auto &block : field.GetBlocks())
1212 {
1213 isAtWidth =
1214 isAtWidth && block.GetInterleaveWidth() == interleaveWidth;
1215 }
1216 if (!isAtWidth)
1217 {
1218 Math::zero<ExecSpace>(field);
1219 field.SetInterleaveWidth(interleaveWidth);
1220 }
1221 }
1222
1223 // The index of @p targets into a domain block at interleave width
1224 // @p interleaveWidth, built on stream @p streamID on first use.
1226 CoeffTargets &targets, const unsigned int interleaveWidth,
1227 const unsigned int streamID)
1228 {
1230 targets.indices, interleaveWidth, streamID,
1231 [&targets](const unsigned int blockInterleaveWidth) {
1232 return TargetIndex(targets, blockInterleaveWidth);
1233 });
1234 }
1235
1236 // Copy the boundary-adjacent elements of the velocity into
1237 // m_restrictedVelocity, each block at its own interleave width. Each
1238 // gather runs on the stream of its destination block, after the work
1239 // queued on the stream of its source block, and the source streams wait
1240 // on the gathers in turn, without the host waiting on either.
1242 {
1243 for (auto &gather : m_volumeGathers)
1244 {
1245 const unsigned int srcStreamID = gather.srcBlock + 1;
1246 const unsigned int streamID = gather.dstBlock + 1;
1247 auto &srcBlock = velocity.GetBlocks()[gather.srcBlock];
1248 auto &dstBlock = m_restrictedVelocity.GetBlocks()[gather.dstBlock];
1249
1250 RecordStreamEvent<ExecSpace>(srcStreamID);
1251 SetStreamDependencies<ExecSpace>(streamID, srcStreamID);
1252
1253 auto &indices = GatherIndicesAtInterleaveWidths(
1254 gather, srcBlock.GetInterleaveWidth(),
1255 dstBlock.GetInterleaveWidth(), streamID);
1256 auto src = srcBlock.template GetPtr<MemSpace, ReadOnly>(streamID);
1257 // The points of the block this gather does not write are
1258 // padding, which stays zero, or written by another gather.
1259 auto dst = dstBlock.template GetPtr<MemSpace, ReadWrite>(streamID);
1260 auto srcIdx =
1261 indices.srcIndex.template GetPtr<MemSpace, ReadOnly>(streamID);
1262 auto dstIdx =
1263 indices.dstIndex.template GetPtr<MemSpace, ReadOnly>(streamID);
1264 const size_t nsize = gather.srcElmt.size() * gather.nData;
1265 if (m_coordDim == 2)
1266 {
1267 HOutflowVolumeGatherKernel<ExecSpace, 2>(
1268 nsize, srcBlock.CompSize(), dstBlock.CompSize(), srcIdx,
1269 dstIdx, src, dst, streamID);
1270 }
1271 else if (m_coordDim == 3)
1272 {
1273 HOutflowVolumeGatherKernel<ExecSpace, 3>(
1274 nsize, srcBlock.CompSize(), dstBlock.CompSize(), srcIdx,
1275 dstIdx, src, dst, streamID);
1276 }
1277 RecordStreamEvent<ExecSpace>(streamID);
1278 }
1279
1280 for (const auto &gather : m_volumeGathers)
1281 {
1282 const unsigned int srcStreamID = gather.srcBlock + 1;
1283 const unsigned int streamID = gather.dstBlock + 1;
1284 SetStreamDependencies<ExecSpace>(srcStreamID, streamID);
1285 }
1286 }
1287
1288 // Evaluate f_b on every region at time @p time. A region whose
1289 // expressions do not use t is evaluated only once.
1290 void EvaluateFb(const TData time)
1291 {
1292 for (unsigned int n = 0; n < m_fbPhys.size(); ++n)
1293 {
1295 {
1296 m_fbExpressionOps[n]->SetTime(time);
1297 m_fbExpressionOps[n]->Apply(m_fbPhys[n], m_fbPhys[n]);
1298 }
1299 }
1300 m_isFbEvaluated = true;
1301 }
1302
1303 // Evaluate the pressure condition on every region from the velocity
1304 // field @p velocity and the gradient in m_restrictedGradient.
1307 const TData kinvis, const TData scale)
1308 {
1309 for (unsigned int n = 0; n < m_pressureBndPhys.size(); ++n)
1310 {
1311 m_bndVelocityExtractOps[n]->Apply(velocity, m_bndVelocity[n]);
1313 m_bndGradient[n]);
1314
1315 for (unsigned int blk = 0;
1316 blk < m_pressureBndPhys[n].GetBlocks().size(); ++blk)
1317 {
1318 // The extractions, m_normals and m_fbPhys are ordered before
1319 // the stream of the block.
1320 const unsigned int streamID = blk + 1;
1321
1322 auto &velocityBlock = m_bndVelocity[n].GetBlocks()[blk];
1323 auto &gradientBlock = m_bndGradient[n].GetBlocks()[blk];
1324 auto &normalBlock = m_normals[n].GetBlocks()[blk];
1325 auto &fbBlock = m_fbPhys[n].GetBlocks()[blk];
1326 auto &pressureBlock = m_pressureBndPhys[n].GetBlocks()[blk];
1327 auto &energyBlock = m_energyMinusFb[n].GetBlocks()[blk];
1328 auto &divBlock = m_divergence[n].GetBlocks()[blk];
1329 const size_t nPoints =
1330 pressureBlock.GetNumElementsWithPadding() *
1331 pressureBlock.GetNumData();
1332 const size_t compSize = velocityBlock.CompSize();
1333
1334 auto velocityPtr =
1335 velocityBlock.template GetPtr<MemSpace, ReadOnly>(streamID);
1336 auto gradientPtr =
1337 gradientBlock.template GetPtr<MemSpace, ReadOnly>(streamID);
1338 auto normalPtr =
1339 normalBlock.template GetPtr<MemSpace, ReadOnly>(streamID);
1340 auto fbPtr =
1341 fbBlock.template GetPtr<MemSpace, ReadOnly>(streamID);
1342 auto pressurePtr =
1343 pressureBlock.template GetPtr<MemSpace, WriteOnly>(
1344 streamID);
1345 auto energyPtr =
1346 energyBlock.template GetPtr<MemSpace, WriteOnly>(streamID);
1347 auto divPtr =
1348 divBlock.template GetPtr<MemSpace, WriteOnly>(streamID);
1349 if (m_coordDim == 2)
1350 {
1351 HOutflowPressureKernel<ExecSpace, 2>(
1352 nPoints, compSize, velocityPtr, gradientPtr, normalPtr,
1353 fbPtr, kinvis, scale, m_theta, m_alpha1, m_alpha2, m_U0,
1354 m_delta, pressurePtr, energyPtr, divPtr, streamID);
1355 }
1356 else if (m_coordDim == 3)
1357 {
1358 HOutflowPressureKernel<ExecSpace, 3>(
1359 nPoints, compSize, velocityPtr, gradientPtr, normalPtr,
1360 fbPtr, kinvis, scale, m_theta, m_alpha1, m_alpha2, m_U0,
1361 m_delta, pressurePtr, energyPtr, divPtr, streamID);
1362 }
1363 }
1364 }
1365 }
1366
1368 {
1372 m_pressureCoeffSrc, m_pressureMappedCoeff, nullptr, nullptr,
1373 m_pressureUpdateStreams, [this](unsigned int n) {
1374 // The forward transform assumes a zero output, of which
1375 // it sets the vertex modes first.
1376 Math::zero<ExecSpace>(m_pressureBndCoeffs[n]);
1379 });
1380 }
1381
1383 {
1384 for (unsigned int n = 0; n < m_velocityBndPhys.size(); ++n)
1385 {
1386 m_bndPressureExtractOps[n]->Apply(*this->m_pressure,
1387 m_pressureBndPhys[n]);
1388
1389 for (unsigned int blk = 0;
1390 blk < m_velocityBndPhys[n].GetBlocks().size(); ++blk)
1391 {
1392 // The extraction, m_normals, m_energyMinusFb and m_divergence
1393 // are ordered before the stream of the block.
1394 const unsigned int streamID = blk + 1;
1395
1396 auto &pressureBlock = m_pressureBndPhys[n].GetBlocks()[blk];
1397 auto &normalBlock = m_normals[n].GetBlocks()[blk];
1398 auto &energyBlock = m_energyMinusFb[n].GetBlocks()[blk];
1399 auto &divBlock = m_divergence[n].GetBlocks()[blk];
1400 auto &outBlock = m_velocityBndPhys[n].GetBlocks()[blk];
1401 const size_t nPoints = outBlock.GetNumElementsWithPadding() *
1402 outBlock.GetNumData();
1403 const size_t compSize = outBlock.CompSize();
1404
1405 auto pressurePtr =
1406 pressureBlock.template GetPtr<MemSpace, ReadOnly>(streamID);
1407 auto normalPtr =
1408 normalBlock.template GetPtr<MemSpace, ReadOnly>(streamID);
1409 auto energyPtr =
1410 energyBlock.template GetPtr<MemSpace, ReadOnly>(streamID);
1411 auto divPtr =
1412 divBlock.template GetPtr<MemSpace, ReadOnly>(streamID);
1413 auto outPtr =
1414 outBlock.template GetPtr<MemSpace, WriteOnly>(streamID);
1415 if (m_coordDim == 2)
1416 {
1417 HOutflowVelocityKernel<ExecSpace, 2>(
1418 nPoints, compSize, pressurePtr, normalPtr, energyPtr,
1419 divPtr, this->m_kinvis, outPtr, streamID);
1420 }
1421 else if (m_coordDim == 3)
1422 {
1423 HOutflowVelocityKernel<ExecSpace, 3>(
1424 nPoints, compSize, pressurePtr, normalPtr, energyPtr,
1425 divPtr, this->m_kinvis, outPtr, streamID);
1426 }
1427 }
1428 }
1429 }
1430
1443
1444 // Project every region with project(n), on the streams of its blocks,
1445 // copying every block into the array compact on the same stream as soon
1446 // as it is projected. Then gather compact into every domain block on the
1447 // stream of the block. The streams @p updateStreams of the region and
1448 // domain blocks wait on one another through m_opStreamID before and
1449 // after the gathers.
1450 template <typename ProjectFn>
1453 const std::vector<size_t> &offsets, const size_t compSize,
1455 std::vector<LibUtilities::MemoryRegion<size_t>> &coefficientSources,
1456 std::vector<LibUtilities::MemoryRegion<TData>> &mappedCoefficients,
1457 std::vector<LibUtilities::MemoryRegion<size_t>> *groupSources,
1458 std::vector<LibUtilities::MemoryRegion<TData>> *groupValues,
1459 const std::vector<unsigned int> &updateStreams, ProjectFn &&project)
1460 {
1461 if (compSize == 0)
1462 {
1463 return;
1464 }
1465 const unsigned int nComp = fields[0].GetNumComponents();
1466 auto compactPtr =
1467 compact.template GetPtr<MemSpace, WriteOnly>(m_opStreamID);
1468
1469 for (unsigned int n = 0; n < fields.size(); ++n)
1470 {
1471 project(n);
1472
1473 size_t regionOffset = 0;
1474 for (unsigned int blk = 0; blk < fields[n].GetBlocks().size();
1475 ++blk)
1476 {
1477 const unsigned int streamID = blk + 1;
1478 auto &block = fields[n].GetBlocks()[blk];
1479 auto src = block.template GetPtr<MemSpace, ReadOnly>(streamID);
1480 const size_t blockLength =
1481 block.GetNumElements() * block.GetNumData();
1482
1483 // On the stream that projected the block.
1484 for (unsigned int c = 0; c < nComp; ++c)
1485 {
1486 Math::copyKernel<ExecSpace>(
1487 blockLength, src + c * block.CompSize(),
1488 compactPtr + c * compSize + offsets[n] + regionOffset,
1489 streamID);
1490 }
1491 regionOffset += blockLength;
1492 }
1493 }
1494
1495 // Gather compact into the domain blocks v_Apply() and
1496 // ApplyNeumannMaps() read, each on the stream of its block. Every
1497 // gather reads entries written on any region block's stream, so the
1498 // block streams first wait on one another through m_opStreamID.
1499 JoinStreams<ExecSpace>(m_opStreamID, updateStreams);
1500 ReleaseStreams<ExecSpace>(m_opStreamID, updateStreams);
1501
1502 for (unsigned int blk = 0; blk < mappedCoefficients.size(); ++blk)
1503 {
1504 const unsigned int streamID = blk + 1;
1505
1506 MultiRegions::detail::CGBndCondGatherKernel<ExecSpace>(
1507 coefficientSources[blk].size(),
1508 coefficientSources[blk].template GetPtr<MemSpace, ReadOnly>(
1509 streamID),
1510 compactPtr,
1511 mappedCoefficients[blk].template GetPtr<MemSpace, WriteOnly>(
1512 streamID),
1513 streamID);
1514 if (groupSources)
1515 {
1516 MultiRegions::detail::CGBndCondGatherKernel<ExecSpace>(
1517 (*groupSources)[blk].size(),
1518 (*groupSources)[blk].template GetPtr<MemSpace, ReadOnly>(
1519 streamID),
1520 compactPtr,
1521 (*groupValues)[blk].template GetPtr<MemSpace, WriteOnly>(
1522 streamID),
1523 streamID);
1524 }
1525 }
1526
1527 // The next projection overwrites compact on the region block
1528 // streams, which wait on the gathers in turn.
1529 JoinStreams<ExecSpace>(m_opStreamID, updateStreams);
1530 ReleaseStreams<ExecSpace>(m_opStreamID, updateStreams);
1531 }
1532
1534 {
1535 for (unsigned int blk = 0; blk < inout.GetBlocks().size(); ++blk)
1536 {
1537 const unsigned int streamID = blk + 1;
1538
1539 // The targets index the block at its own interleave width.
1540 auto &block = inout.GetBlocks()[blk];
1541 const unsigned int interleaveWidth = block.GetInterleaveWidth();
1542 auto ptr = block.template GetPtr<MemSpace, ReadWrite>(streamID);
1544 interleaveWidth, streamID)
1545 .template GetPtr<MemSpace, ReadOnly>(streamID);
1546 auto coeff =
1547 m_velocityMappedCoeff[blk].template GetPtr<MemSpace, ReadOnly>(
1548 streamID);
1549 const TData *sign =
1551 ? m_velocitySign[blk].template GetPtr<MemSpace, ReadOnly>(
1552 streamID)
1553 : nullptr;
1554 for (unsigned int d = 0; d < m_coordDim; ++d)
1555 {
1556 const size_t offset = m_velocityCompOffsets[blk][d];
1557 const size_t count = m_velocityCompCounts[blk][d];
1558 if (count > 0)
1559 {
1560 if (m_velocitySignChange[d])
1561 {
1562 MultiRegions::detail::NeuBndCondKernel<ExecSpace>(
1563 count, sign + offset, map + offset, coeff + offset,
1564 ptr + d * block.CompSize(), streamID);
1565 }
1566 else
1567 {
1568 MultiRegions::detail::NeuBndCondKernel<ExecSpace>(
1569 count, map + offset, coeff + offset,
1570 ptr + d * block.CompSize(), streamID);
1571 }
1572 }
1573
1574 const size_t groupCount = m_velocityCompGroupCounts[blk][d];
1575 if (groupCount > 0)
1576 {
1577 const size_t groupOffset =
1579 auto groupOffsets =
1581 .template GetPtr<MemSpace, ReadOnly>(streamID) +
1582 groupOffset;
1583 auto groupTargets =
1585 interleaveWidth, streamID)
1586 .template GetPtr<MemSpace, ReadOnly>(streamID) +
1587 groupOffset;
1588 auto groupValues =
1590 .template GetPtr<MemSpace, ReadOnly>(streamID);
1591 if (m_velocitySignChange[d])
1592 {
1593 auto groupSigns =
1595 .template GetPtr<MemSpace, ReadOnly>(streamID);
1596 MultiRegions::detail::NeuBndCondGroupKernel<ExecSpace>(
1597 groupCount, groupOffsets, groupTargets, groupSigns,
1598 groupValues, ptr + d * block.CompSize(), streamID);
1599 }
1600 else
1601 {
1602 MultiRegions::detail::NeuBndCondGroupKernel<ExecSpace>(
1603 groupCount, groupOffsets, groupTargets, groupValues,
1604 ptr + d * block.CompSize(), streamID);
1605 }
1606 }
1607 }
1608 }
1609 }
1610};
1611
1612} // namespace Nektar::detail
#define ASSERTL0(condition, msg)
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Per-block interface of the Expression operator, holding the evaluation settings shared by all back-en...
Public interface of the Expression operator, which evaluates analytical expressions at the quadrature...
Whole-field interface of the IProductWRTBase element operator, which takes a physical-space field to ...
Public interface of the physical-space derivative (PhysDeriv) element operator, which maps a field at...
#define sign(a, b)
return the sign(b)*a
Definition Polylib.cpp:47
LibUtilities::SessionReaderSharedPtr session
int64_t id
Dong's high-order outflow boundary condition, a pressure Dirichlet condition coupled with a velocity ...
std::shared_ptr< MultiRegions::NeuBndCondOp< TData > > m_velocityAdapter
std::shared_ptr< MultiRegions::DirBndCondOp< TData > > m_pressureAdapter
LibUtilities::Field< TData, FieldState::Phys > * m_pressure
Solved pressure, set by SetPressure(); not owned.
TData m_kinvis
Kinematic viscosity, set by SetKinvis().
TData m_scale
Scale of the velocity passed to UpdatePressure(), set by SetScale().
TData m_time
Time of the Neumann value f_b, set by SetTime().
A Field represents expansion data to be operated on.
std::vector< BlockAccessor< TData, TState > > & GetBlocks()
Get BlockAccessors for the field.
A MemoryRegion represents a memory region.
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
static std::set< std::string > GetExpressionVariables(const std::string &expr)
The variables an expression uses: every name in expr that is not called as a function,...
static std::shared_ptr< ExpressionOp< TData > > Create(const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components, const std::string &execStr="", const std::string &implStr="")
Create an Expression operator through the two-stage element-operator factory and initialise its defau...
Whole-field interface of the inner product with the basis: integrates a physical-space field against ...
std::vector< std::string > m_components
Names of the field components the operator was built for.
Definition Operator.hpp:351
MultiRegions::ExpListSharedPtr m_expansionList
Expansion list the operator acts on.
Definition Operator.hpp:349
static std::shared_ptr< PhysDerivOp< TData > > Create(const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components, const std::string &execStr="", const std::string &implStr="")
Create a physical-derivative operator, its per-block operators and, for a multi-plane 3DH1 expansion,...
Adds the surface integral of boundary fields, per component and homogeneous plane,...
Extracts a volume field onto the points of a boundary region of a continuous field.
const BoundaryRegionCollection & GetBoundaryRegions(void) const
Definition Conditions.h:273
const BoundaryConditionCollection & GetBoundaryConditions(void) const
Definition Conditions.h:283
Implementation of HOutflowBndCondOp.
std::vector< std::shared_ptr< MultiRegions::detail::PhysTraceExtractBndCond< ExecSpace, TData > > > m_bndPressureExtractOps
std::vector< LibUtilities::MemoryRegion< size_t > > m_velocityGroupOffset
LibUtilities::Field< TData, FieldState::Phys > m_restrictedGradient
std::vector< LibUtilities::Field< TData, FieldState::Phys > > m_bndGradient
void EvaluatePressure(LibUtilities::Field< TData, FieldState::Phys > &velocity, const TData kinvis, const TData scale)
static void SetRestrictedInterleaveWidth(LibUtilities::Field< TData, FieldState::Phys > &field, const unsigned int interleaveWidth)
std::vector< LibUtilities::Field< TData, FieldState::Coeff > > m_pressureBndCoeffs
static LibUtilities::MemoryRegion< size_t > & TargetsAtInterleaveWidth(CoeffTargets &targets, const unsigned int interleaveWidth, const unsigned int streamID)
std::vector< LibUtilities::Field< TData, FieldState::Phys > > m_divergence
void v_UpdatePressure(LibUtilities::Field< TData, FieldState::Phys > &velocity) override
std::vector< unsigned int > m_pressureUpdateStreams
MultiRegions::detail::CGBndCondSurfaceIntegral< ExecSpace, TData > m_velocitySurfaceIntegral
static std::vector< size_t > PointIndex(const VolumeGather &gather, const std::vector< size_t > &elmts, const unsigned int interleaveWidth, const unsigned int dstInterleaveWidth)
static GatherIndices & GatherIndicesAtInterleaveWidths(VolumeGather &gather, const unsigned int srcInterleaveWidth, const unsigned int dstInterleaveWidth, const unsigned int streamID)
std::vector< LibUtilities::Field< TData, FieldState::Phys > > m_fbPhys
std::vector< LibUtilities::MemoryRegion< size_t > > m_velocityGroupSrc
static LibUtilities::MemoryRegion< size_t > & IndexAtInterleaveWidth(InterleaveWidthIndices &indices, const unsigned int interleaveWidth, const unsigned int streamID, BuildIndexFn &&buildIndex)
MultiRegions::ExpListSharedPtr m_velocityExpansionList
std::vector< LibUtilities::MemoryRegion< TData > > m_velocityGroupValue
void ApplyVelocity(LibUtilities::Field< TData, FieldState::Coeff > &inout)
void ProjectAndGatherCoeffs(std::vector< LibUtilities::Field< TData, FieldState::Coeff > > &fields, const std::vector< size_t > &offsets, const size_t compSize, LibUtilities::MemoryRegion< TData > &compact, std::vector< LibUtilities::MemoryRegion< size_t > > &coefficientSources, std::vector< LibUtilities::MemoryRegion< TData > > &mappedCoefficients, std::vector< LibUtilities::MemoryRegion< size_t > > *groupSources, std::vector< LibUtilities::MemoryRegion< TData > > *groupValues, const std::vector< unsigned int > &updateStreams, ProjectFn &&project)
void ApplyNeumannMaps(LibUtilities::Field< TData, FieldState::Coeff > &inout)
std::vector< std::shared_ptr< MultiRegions::ExpressionOp< TData > > > m_fbExpressionOps
void ApplyPressure(LibUtilities::Field< TData, FieldState::Coeff > &out)
std::vector< LibUtilities::MemoryRegion< size_t > > m_pressureCoeffSrc
std::vector< unsigned int > m_pressureConditionIndices
std::vector< LibUtilities::Field< TData, FieldState::Phys > > m_pressureBndPhys
static constexpr unsigned int m_interleaveWidth
std::vector< LibUtilities::MemoryRegion< size_t > > m_velocityCoeffSrc
std::vector< LibUtilities::Field< TData, FieldState::Coeff > > m_velocityBndCoeffs
std::vector< std::vector< size_t > > m_velocityCompGroupOffsets
std::vector< std::shared_ptr< MultiRegions::FwdTransBCOp< TData > > > m_pressureFwdTransOps
std::vector< LibUtilities::Field< TData, FieldState::Phys > > m_bndVelocity
std::vector< LibUtilities::Field< TData, FieldState::Phys > > m_velocityBndPhys
std::vector< std::shared_ptr< MultiRegions::IProductWRTBaseOp< TData > > > m_velocityIProductOps
static std::vector< unsigned int > UpdateStreams(const size_t nDomainBlocks, std::vector< LibUtilities::Field< TData, FieldState::Coeff > > &fields)
std::vector< std::vector< size_t > > m_velocityCompCounts
static std::vector< size_t > TargetIndex(const CoeffTargets &targets, const unsigned int interleaveWidth)
std::vector< LibUtilities::MemoryRegion< TData > > m_velocityMappedCoeff
std::vector< std::shared_ptr< MultiRegions::detail::PhysTraceExtractBndCond< ExecSpace, TData > > > m_bndGradientExtractOps
std::vector< MultiRegions::ExpListSharedPtr > m_velocityBndExpLists
std::vector< std::vector< size_t > > m_velocityCompOffsets
std::vector< CoeffTargets > BuildCoeffTargets(std::vector< LibUtilities::MemoryRegion< size_t > > &unitWidthIndex, const MultiRegions::ExpListSharedPtr &expansionList)
void BuildBoundaryElementData(const std::vector< std::string > &components)
LibUtilities::MemoryRegion< TData > m_velocityCompactCoeff
HOutflowBndCondOpImpl(const MultiRegions::ExpListSharedPtr &pressureExpansionList, const std::vector< std::string > &pressureComponents)
static std::unique_ptr< MultiRegions::Operator< TData > > Instantiate(const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components)
LibUtilities::Field< TData, FieldState::Phys > m_restrictedVelocity
std::shared_ptr< MultiRegions::PhysDerivOp< TData > > m_physDerivOp
std::vector< LibUtilities::Field< TData, FieldState::Phys > > m_energyMinusFb
std::vector< CoeffTargets > m_velocityGroupTarget
void AddVelocitySurfaceIntegral(LibUtilities::MemoryRegion< TData > &data)
static bool IsHOutflow(const SpatialDomains::BoundaryConditionShPtr &condition)
std::vector< std::vector< size_t > > m_velocityCompGroupCounts
std::vector< MultiRegions::ExpListSharedPtr > m_pressureBndExpLists
LibUtilities::MemoryRegion< TData > m_pressureCompactCoeff
std::vector< LibUtilities::MemoryRegion< TData > > m_pressureMappedCoeff
std::vector< LibUtilities::MemoryRegion< TData > > m_velocityGroupSign
std::vector< unsigned int > m_velocityUpdateStreams
std::vector< LibUtilities::Field< TData, FieldState::Phys > > m_normals
std::vector< LibUtilities::MemoryRegion< TData > > m_velocitySign
void GatherVelocity(LibUtilities::Field< TData, FieldState::Phys > &velocity)
typename ExecSpace::memory_space MemSpace
void ValidateAndBuildVelocityBoundaryData(const std::vector< std::string > &components)
std::vector< LibUtilities::MemoryRegion< TData > > m_pressureSign
std::vector< std::shared_ptr< MultiRegions::detail::PhysTraceExtractBndCond< ExecSpace, TData > > > m_bndVelocityExtractOps
void v_SetVelocityContext(const MultiRegions::ExpListSharedPtr &velocityExpansionList, const std::vector< std::string > &velocityComponents) override
MultiRegions::ExpListSharedPtr m_restrictedVelocityExpansionList
The Dirichlet condition of the pressure system, which applies the pressure of the HOutflowBndCondOpIm...
void SetOwner(HOutflowBndCondOpImpl< ExecSpace, TData > *owner)
Set the operator whose pressure Apply() applies, which must outlive this one.
HOutflowBndCondOpImpl< ExecSpace, TData > * m_owner
void v_Apply(LibUtilities::Field< TData, FieldState::Coeff > &out) override
void v_UpdateBndCoeffs(const TData &time) override
HOutflowPressureAdapter(const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components)
The Neumann condition of the velocity system, which applies the velocity flux of the HOutflowBndCondO...
HOutflowVelocityAdapter(const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components)
void v_UpdateBndCoeffs(const TData &time) override
void v_Apply(LibUtilities::Field< TData, FieldState::Coeff > &inout) override
void v_ExcludeUserDefinedType(const std::string &userDefinedType) override
void v_AddNeumannSurfaceIntegral(LibUtilities::MemoryRegion< TData > &data) override
HOutflowBndCondOpImpl< ExecSpace, TData > * m_owner
void SetOwner(HOutflowBndCondOpImpl< ExecSpace, TData > *owner)
Set the operator whose velocity flux Apply() applies, which must outlive this one.
std::shared_ptr< Expansion > ExpansionSharedPtr
Definition Expansion.h:66
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
Collections::Collection GetCollection(MultiRegions::ExpListSharedPtr expansionList, unsigned int block_idx)
std::shared_ptr< BoundaryConditionBase > BoundaryConditionShPtr
Definition Conditions.h:251
std::map< int, ExpansionInfoShPtr > ExpansionInfoMap
Definition MeshGraph.h:160
bool IEquals(std::string_view a, std::string_view b)
VolumeGather & operator=(const VolumeGather &)=delete
VolumeGather & operator=(VolumeGather &&)=default
std::map< std::pair< unsigned int, unsigned int >, GatherIndices > indices