Nektar++
BLPoints.cpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: BLPoints.cpp
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: 1D boundary layer points
32//
33///////////////////////////////////////////////////////////////////////////////
34
37
39{
45
47{
48 // Allocate the storage for points.
50 size_t npts = m_pointsKey.GetNumPoints();
51
52 // Derived power coefficient.
55 "Must set factor in BLPoints key");
56
57 if (fabs(r - 1.0) < 1e-6)
58 {
59 NekDouble tmp = 2.0 / (npts - 1.0);
60 for (size_t i = 0; i < npts; ++i)
61 {
62 m_points[0][i] = -1.0 + i * tmp;
63 }
64 }
65 else
66 {
67 NekDouble a = 2.0 * (1.0 - r) / (1.0 - pow(r, (double)(npts - 1)));
68 m_points[0][0] = -1.0;
69
70 for (size_t i = 1; i < npts; ++i)
71 {
72 m_points[0][i] = m_points[0][i - 1] + a * pow(r, (double)(i - 1));
73 }
74
75 m_points[0][npts - 1] = 1.0;
76 }
77
79 {
80 std::vector<NekDouble> tmp(npts);
81 for (size_t i = 0; i < npts; ++i)
82 {
83 tmp[i] = -m_points[0][npts - 1 - i];
84 }
85
86 for (size_t i = 0; i < npts; ++i)
87 {
88 m_points[0][i] = tmp[i];
89 }
90 }
91}
92
94{
95}
96
98{
99 //// Allocate the derivative matrix.
101}
102
103std::shared_ptr<Points<NekDouble>> BLPoints::Create(const PointsKey &key)
104{
105 std::shared_ptr<Points<NekDouble>> returnval(
107
108 returnval->Initialize();
109
110 return returnval;
111}
112
113std::shared_ptr<NekMatrix<NekDouble>> BLPoints::CreateMatrix(
114 [[maybe_unused]] const PointsKey &pkey)
115{
116 ASSERTL0(false, "CreateMatrix not available for Boundary Layer Points");
117
118 return nullptr;
119}
120
121const std::shared_ptr<NekMatrix<NekDouble>> BLPoints::v_GetI(
122 [[maybe_unused]] const PointsKey &pkey)
123{
124 ASSERTL0(false, "Interp not available for Boundary Layer Points");
125
126 return nullptr;
127}
128
129const std::shared_ptr<NekMatrix<NekDouble>> BLPoints::v_GetI(
130 [[maybe_unused]] const Array<OneD, const NekDouble> &x)
131{
132 ASSERTL0(false, "Interp not available for Boundary Layer Points");
133
134 return nullptr;
135}
136
137const std::shared_ptr<NekMatrix<NekDouble>> BLPoints::v_GetI(
138 [[maybe_unused]] size_t numpoints,
139 [[maybe_unused]] const Array<OneD, const NekDouble> &x)
140{
141 ASSERTL0(false, "Interp not available for Boundary Layer Points");
142
143 return nullptr;
144}
145
147 [[maybe_unused]] size_t npts,
148 [[maybe_unused]] const Array<OneD, const NekDouble> &xpoints,
149 [[maybe_unused]] Array<OneD, NekDouble> &interp)
150{
151 ASSERTL0(false,
152 "CalculateInterpMatrix not available for Boundary Layer Points");
153}
154} // namespace Nektar::LibUtilities
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
void v_CalculatePoints() override
Definition: BLPoints.cpp:46
static std::shared_ptr< PointsBaseType > Create(const PointsKey &key)
Definition: BLPoints.cpp:103
void v_CalculateDerivMatrix() override
Definition: BLPoints.cpp:97
std::shared_ptr< NekMatrix< NekDouble > > CreateMatrix(const PointsKey &pkey)
Definition: BLPoints.cpp:113
void v_CalculateWeights() override
Definition: BLPoints.cpp:93
const MatrixSharedPtrType v_GetI(const PointsKey &pkey) final
Definition: BLPoints.cpp:121
static bool initPointsManager[]
Definition: BLPoints.h:116
void CalculateInterpMatrix(size_t npts, const Array< OneD, const NekDouble > &xpoints, Array< OneD, NekDouble > &interp)
Definition: BLPoints.cpp:146
bool RegisterCreator(const KeyType &key, const CreateFuncType &createFunc)
Register the given function and associate it with the key. The return value is just to facilitate cal...
Definition: NekManager.hpp:168
Stores a set of points of datatype DataT, defined by a PointKey.
Definition: Points.h:235
Array< OneD, DataType > m_points[3]
Storage for the point locations, allowing for up to a 3D points storage.
Definition: Points.h:356
PointsKey m_pointsKey
Points type for this points distributions.
Definition: Points.h:353
Defines a specification for a set of points.
Definition: Points.h:50
PointsType GetPointsType() const
Definition: Points.h:90
size_t GetNumPoints() const
Definition: Points.h:85
NekDouble GetFactor() const
Definition: Points.h:95
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
PointsManagerT & PointsManager(void)
@ eBoundaryLayerPoints
1D power law distribution for boundary layer points
Definition: PointsType.h:77
@ eBoundaryLayerPointsRev
1D power law distribution for boundary layer points
Definition: PointsType.h:79
static const NekDouble kNekUnsetDouble
double NekDouble