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
35#include <boost/core/ignore_unused.hpp>
36
39
40namespace Nektar
41{
42namespace LibUtilities
43{
49
51{
52 // Allocate the storage for points.
54 size_t npts = m_pointsKey.GetNumPoints();
55
56 // Derived power coefficient.
59 "Must set factor in BLPoints key");
60
61 if (fabs(r - 1.0) < 1e-6)
62 {
63 NekDouble tmp = 2.0 / (npts - 1.0);
64 for (size_t i = 0; i < npts; ++i)
65 {
66 m_points[0][i] = -1.0 + i * tmp;
67 }
68 }
69 else
70 {
71 NekDouble a = 2.0 * (1.0 - r) / (1.0 - pow(r, (double)(npts - 1)));
72 m_points[0][0] = -1.0;
73
74 for (size_t i = 1; i < npts; ++i)
75 {
76 m_points[0][i] = m_points[0][i - 1] + a * pow(r, (double)(i - 1));
77 }
78
79 m_points[0][npts - 1] = 1.0;
80 }
81
83 {
84 std::vector<NekDouble> tmp(npts);
85 for (size_t i = 0; i < npts; ++i)
86 {
87 tmp[i] = -m_points[0][npts - 1 - i];
88 }
89
90 for (size_t i = 0; i < npts; ++i)
91 {
92 m_points[0][i] = tmp[i];
93 }
94 }
95}
96
98{
99}
100
102{
103 //// Allocate the derivative matrix.
105}
106
107std::shared_ptr<Points<NekDouble>> BLPoints::Create(const PointsKey &key)
108{
109 std::shared_ptr<Points<NekDouble>> returnval(
111
112 returnval->Initialize();
113
114 return returnval;
115}
116
117std::shared_ptr<NekMatrix<NekDouble>> BLPoints::CreateMatrix(
118 const PointsKey &pkey)
119{
120 boost::ignore_unused(pkey);
121
122 ASSERTL0(false, "CreateMatrix not available for Boundary Layer Points");
123
124 return nullptr;
125}
126
127const std::shared_ptr<NekMatrix<NekDouble>> BLPoints::v_GetI(
128 const PointsKey &pkey)
129{
130 boost::ignore_unused(pkey);
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(
139{
140 boost::ignore_unused(x);
141
142 ASSERTL0(false, "Interp not available for Boundary Layer Points");
143
144 return nullptr;
145}
146
147const std::shared_ptr<NekMatrix<NekDouble>> BLPoints::v_GetI(
148 size_t numpoints, const Array<OneD, const NekDouble> &x)
149{
150 boost::ignore_unused(numpoints, x);
151
152 ASSERTL0(false, "Interp not available for Boundary Layer Points");
153
154 return nullptr;
155}
156
158 size_t npts, const Array<OneD, const NekDouble> &xpoints,
160{
161 boost::ignore_unused(npts, xpoints, interp);
162
163 ASSERTL0(false,
164 "CalculateInterpMatrix not available for Boundary Layer Points");
165}
166} // end of namespace LibUtilities
167} // end of namespace Nektar
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:215
virtual void v_CalculatePoints() override
Definition: BLPoints.cpp:50
static std::shared_ptr< PointsBaseType > Create(const PointsKey &key)
Definition: BLPoints.cpp:107
virtual void v_CalculateDerivMatrix() override
Definition: BLPoints.cpp:101
std::shared_ptr< NekMatrix< NekDouble > > CreateMatrix(const PointsKey &pkey)
Definition: BLPoints.cpp:117
virtual void v_CalculateWeights() override
Definition: BLPoints.cpp:97
virtual const MatrixSharedPtrType v_GetI(const PointsKey &pkey) override final
Definition: BLPoints.cpp:127
static bool initPointsManager[]
Definition: BLPoints.h:118
void CalculateInterpMatrix(size_t npts, const Array< OneD, const NekDouble > &xpoints, Array< OneD, NekDouble > &interp)
Definition: BLPoints.cpp:157
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:169
Stores a set of points of datatype DataT, defined by a PointKey.
Definition: Points.h:240
Array< OneD, DataType > m_points[3]
Storage for the point locations, allowing for up to a 3D points storage.
Definition: Points.h:361
PointsKey m_pointsKey
Points type for this points distributions.
Definition: Points.h:358
Defines a specification for a set of points.
Definition: Points.h:55
PointsType GetPointsType() const
Definition: Points.h:95
size_t GetNumPoints() const
Definition: Points.h:90
NekDouble GetFactor() const
Definition: Points.h:100
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:79
@ eBoundaryLayerPointsRev
1D power law distribution for boundary layer points
Definition: PointsType.h:81
static const NekDouble kNekUnsetDouble
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
double NekDouble