Nektar++
Loading...
Searching...
No Matches
AdvectionDealiasBlockOp.hpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: AdvectionDealiasBlockOp.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: Fused 3/2-rule spectral/hp dealiased advection:
32// scale * advVel . grad(u).
33///////////////////////////////////////////////////////////////////////////////
34
35#pragma once
36
37#include <vector>
38
40
42{
43
44template <typename TData>
46 : public ElmtBlockOp<FieldState::Phys, FieldState::Phys, TData>
47{
48public:
49 static std::shared_ptr<AdvectionDealiasBlockOp<TData>> Create(
50 const unsigned int block_idx,
53 const std::string &execStr, const std::string &implStr)
54 {
56 template Create<AdvectionDealiasBlockOp>(
57 block_idx, exp, dataWarehouse, execStr, implStr);
58 }
59
60 static inline const std::string name = "BlockAdvectionDealias";
61
62 void SetScale(const TData &scale)
63 {
64 m_scale = scale;
65 }
66
67 void SetAppend(const bool &append)
68 {
69 this->m_append = append;
70 }
71
76
77protected:
78 TData m_scale = 1.0;
79 bool m_append = false;
81
83 const unsigned int block_idx,
86 : ElmtBlockOp<FieldState::Phys, FieldState::Phys, TData>(block_idx, exp,
87 dataWarehouse)
88 {
89 }
90
91 ~AdvectionDealiasBlockOp() override = default;
92
93 /// \brief The per-direction point counts of the @p scale over-integrated
94 /// grid this operator's interpolation and projection matrices are built
95 /// for.
96 ///
97 /// Direction 0 scales outright, and a direction carrying one point fewer
98 /// than direction 0 keeps that offset, which is what lets the switch
99 /// templating see the same relationship on the over-integrated grid as on
100 /// the native one.
101 static std::vector<unsigned int> GetScaledNumPoints(
102 const std::vector<unsigned int> &nq, const NekDouble scale)
103 {
104 std::vector<unsigned int> nqScaled;
105 nqScaled.reserve(nq.size());
106
107 for (size_t d = 0; d < nq.size(); ++d)
108 {
109 nqScaled.push_back((d != 0 && nq[0] - nq[d] == 1)
110 ? static_cast<unsigned int>(scale * nq[0]) -
111 1
112 : static_cast<unsigned int>(scale * nq[d]));
113 }
114
115 return nqScaled;
116 }
117};
118
119} // namespace Nektar::MultiRegions
Block-level base class, implementation-strategy tags and device launch helpers shared by every elemen...
Get the BlockAttributes for a given field state from an ExpList. This method basically captures ident...
Definition Block.hpp:144
static std::vector< unsigned int > GetScaledNumPoints(const std::vector< unsigned int > &nq, const NekDouble scale)
The per-direction point counts of the scale over-integrated grid this operator's interpolation and pr...
LibUtilities::BlockAccessor< TData, FieldState::Phys > * m_advVel
AdvectionDealiasBlockOp(const unsigned int block_idx, const LocalRegions::ExpansionSharedPtr &exp, LibUtilities::NekDataWarehouseSharedPtr dataWarehouse)
static std::shared_ptr< AdvectionDealiasBlockOp< TData > > Create(const unsigned int block_idx, const LocalRegions::ExpansionSharedPtr &exp, LibUtilities::NekDataWarehouseSharedPtr dataWarehouse, const std::string &execStr, const std::string &implStr)
void SetAdvVel(LibUtilities::BlockAccessor< TData, FieldState::Phys > &Vel)
Base class of the per-family block operators: applies one element operation to every element of one b...
std::shared_ptr< NekDataWarehouse > NekDataWarehouseSharedPtr
std::shared_ptr< Expansion > ExpansionSharedPtr
Definition Expansion.h:66
FieldState
Possible states for Field data.