Nektar++
Loading...
Searching...
No Matches
BndCondSlipWallCFEOpImpl.hpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: BndCondSlipWallCFEOpImpl.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:
32//
33///////////////////////////////////////////////////////////////////////////////
34
35#pragma once
36
38
41
42namespace Nektar::detail
43{
44
45/// Tags this operator claims: the two name the same condition.
46inline bool IsSlipWallTag(const std::string &tag)
47{
48 return tag == "Wall" || tag == "Symmetry";
49}
50
51template <typename ExecSpace, typename TData>
53{
54 using MemSpace = typename ExecSpace::memory_space;
55
56public:
58 const MultiRegions::ExpListSharedPtr &expansionList,
59 const std::vector<std::string> &components)
60 : BndCondSlipWallCFEOp<TData>(expansionList, components)
61 {
62 m_numComp = components.size();
63 m_coordDim = MultiRegions::GetCollection(expansionList, 0)
64 .GetExpVector()[0]
65 ->GetCoordim();
66
68 "A compressible slip wall needs density, one momentum "
69 "component per direction and energy.");
70 }
71
72 // className - for OperatorFactory
73 static std::string className;
74
75 // instantiation function for CreatorFunction in OperatorFactory
76 static std::unique_ptr<MultiRegions::Operator<TData>> Instantiate(
77 const MultiRegions::ExpListSharedPtr &expansionList,
78 const std::vector<std::string> &components)
79 {
80 return std::make_unique<BndCondSlipWallCFEOpImpl<ExecSpace, TData>>(
81 expansionList, components);
82 }
83
84protected:
85 unsigned int m_numComp = 0;
86 unsigned int m_coordDim = 0;
87
88 /// The mirrored state *is* the exterior state, so the diffusion must not
89 /// reflect it a second time.
90 bool v_GhostIsReflected() const override
91 {
92 return true;
93 }
94
95 std::vector<bool> v_GetOwnedBlocks() const override
96 {
97 ASSERTL1(this->m_bndCondPhysOp,
98 "No boundary storage attached: call SetBndCondPhysOp().");
99
100 const auto numBlocks = this->m_bndCondPhysOp->GetNumBlocks();
101 std::vector<bool> owned(numBlocks, false);
102
103 for (unsigned blk = 0; blk < numBlocks; ++blk)
104 {
105 owned[blk] =
106 IsSlipWallTag(this->m_bndCondPhysOp->GetBndUserDefined(blk, 0));
107 }
108
109 return owned;
110 }
111
112 /**
113 * @brief Nothing to keep: this condition prescribes no value of its own.
114 *
115 * The wall is imposed by reflecting the interior state the caller seeds,
116 * so there is nothing the session evaluated for it to copy.
117 */
118 void v_SetBndCondPhysOp() override
119 {
120 }
121
122 void v_Apply() override
123 {
124 ASSERTL1(this->m_bndCondPhysOp,
125 "No boundary storage attached: call SetBndCondPhysOp().");
126
127 const auto owned = v_GetOwnedBlocks();
128
129 for (unsigned blk = 0; blk < owned.size(); ++blk)
130 {
131 if (!owned[blk])
132 {
133 continue;
134 }
135
136 const auto stride = this->m_bndCondPhysOp->GetBlockCompStride(blk);
137 auto bndPtr =
138 this->m_bndCondPhysOp->UpdateBlockPtr(blk, this->m_opStreamID);
139 const TData *norms = this->m_bndCondPhysOp->GetBlockNormals(blk);
140
141 MirrorNormalMomentumBlock<ExecSpace>(stride, m_coordDim, norms,
142 bndPtr, this->m_opStreamID);
143 }
144 }
145};
146
147} // namespace Nektar::detail
#define ASSERTL0(condition, msg)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Inviscid slip wall and symmetry plane.
std::vector< LocalRegions::ExpansionSharedPtr > & GetExpVector()
Definition Collection.h:102
void v_SetBndCondPhysOp() override
Nothing to keep: this condition prescribes no value of its own.
BndCondSlipWallCFEOpImpl(const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components)
bool v_GhostIsReflected() const override
The mirrored state is the exterior state, so the diffusion must not reflect it a second time.
static std::unique_ptr< MultiRegions::Operator< TData > > Instantiate(const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components)
std::vector< bool > v_GetOwnedBlocks() const override
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
Collections::Collection GetCollection(MultiRegions::ExpListSharedPtr expansionList, unsigned int block_idx)
bool IsSlipWallTag(const std::string &tag)
Tags this operator claims: the two name the same condition.