Nektar++
ProcessLocalStabilityAnalysis.cpp
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////////////
2//
3// File: ProcessLocalStabilityAnalysis.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: Local linear stability analysis of compressible flow.
32//
33////////////////////////////////////////////////////////////////////////////////
34
35#include <iostream>
36#include <string>
37
41
43
44#define _DEBUG_
45
46using namespace std;
47
48namespace Nektar::FieldUtils
49{
50
53 ModuleKey(eProcessModule, "localStabilityAnalysis"),
55 "Perform local (linear) stability analysis (LST).");
56
59{
60 f->m_writeBndFld = false; // turned on in upstream ProcessBoundaryExtract
61
62 m_config["opt"] =
63 ConfigOption(false, "6", "Option for quantity to compute.\n \
64 6 - scan frequency\n \
65 7 - scan spanwise wavenumber\n \
66 8 - scan both frequency and spanwise wavenumber");
67 m_config["finVal1"] =
68 ConfigOption(false, "0.1", "Final value for the 1st quantity.");
69 m_config["numStep1"] =
70 ConfigOption(false, "10", "Number of steps to scan the 1st range.");
71 m_config["finVal2"] = ConfigOption(
72 false, "0.1", "Final value for the 2nd quantity (optional).");
73 m_config["numStep2"] = ConfigOption(
74 false, "10", "Number of steps to scan the 2nd range (optional).");
75}
76
78{
79}
80
82{
83 // Update settins from the session file
84 if (m_f->m_session->DefinesParameter("Pr"))
85 {
86 m_PRANDTL = m_f->m_session->GetParameter("Pr");
87 }
88
89 if (m_f->m_session->DefinesParameter("Gamma"))
90 {
91 m_GAMMA = m_f->m_session->GetParameter("Gamma");
92 }
93
94 if (m_f->m_session->DefinesParameter("RGAS"))
95 {
96 m_RGAS = m_f->m_session->GetParameter("RGAS");
97 }
98
99 if (m_f->m_session->DefinesParameter("ITOLRAY"))
100 {
101 m_ITOLRAY = m_f->m_session->GetParameter("ITOLRAY");
102 }
103
104 if (m_f->m_session->DefinesParameter("NGLOBAL"))
105 {
106 m_NGLOBAL = m_f->m_session->GetParameter("NGLOBAL");
107 }
108
109 if (m_f->m_session->DefinesParameter("NLOCAL"))
110 {
111 m_NLOCAL = m_f->m_session->GetParameter("NLOCAL");
112 }
113
114 if (m_f->m_session->DefinesParameter("BETALIN"))
115 {
116 m_BETALIN = m_f->m_session->GetParameter("BETALIN");
117 }
118
119 ASSERTL0(m_f->m_session->DefinesParameter("FREQLIN"),
120 "The disturbance frequency for local linear stability analysis "
121 "must be defined.");
122 m_FREQLIN = m_f->m_session->GetParameter("FREQLIN");
123
124 if (m_f->m_session->DefinesParameter("ITSE"))
125 {
126 m_ITSE = m_f->m_session->GetParameter("ITSE");
127 }
128
129 if (m_f->m_session->DefinesParameter("INEUTRL"))
130 {
131 m_INEUTRL = m_f->m_session->GetParameter("INEUTRL");
132 }
133
134 ofstream ofs;
135 ofs.open("PSEREAD.NAM", ios::out);
136
137 // Write $PSEUSER tag
138 ofs << "$PSEUSER\n"
139 << "NSTART=" << m_NSTART << "\n"
140 << "ITSE=" << m_ITSE << "\n"
141 << "INEUTRL=" << m_INEUTRL << "\n"
142 << "BETALIN=" << m_BETALIN << "\n"
143 << "FREQLIN=" << m_FREQLIN << "\n"
144 << "$END\n"
145 << endl;
146 // Write $PSEUSER tag
147 ofs << "$PSENONL\n$END\n" << endl;
148
149 // Weite $PSECNTL tag
150 ofs << "$PSECNTL\n"
151 << "NGLOBAL=" << m_NGLOBAL << "\n"
152 << "NLOCAL=" << m_NLOCAL << "\n"
153 << "ITOLRAY=" << m_ITOLRAY << "\n"
154 << "$END\n"
155 << endl;
156
157 // Write $PSEOUT tag
158 ofs << "$PSEOUT\n"
159 << "LABEL=" << m_LABEL << "\n"
160 << "ITSPRES=" << m_ITSPRES << "\n"
161 << "IEIGL=" << m_IEIGL << "\n"
162 << "$END\n"
163 << endl;
164
165 // Write $PSEGAS tag
166 ofs << "$PSEGAS\n"
167 << "RGAS=" << m_RGAS << "\n"
168 << "GAMMA=" << m_GAMMA << "\n"
169 << "PRANDTL=" << m_PRANDTL << "\n"
170 << "$END\n"
171 << endl;
172
173 ofs.close();
174}
175
177{
179
180 // Initialize sampling parameters
181 const long int option = m_config["opt"].as<long int>(); // 6,7,8
182 const NekDouble finalValue1 = m_config["finVal1"].as<NekDouble>();
183 const long int numStep1 = m_config["numStep1"].as<long int>();
184 const NekDouble finalValue2 = m_config["finVal2"].as<NekDouble>();
185 const long int numStep2 = m_config["numStep2"].as<long int>();
186
187 // Create PSEREAD.NAMgit d
189
190 // call_hello(); // test calling
191 call_lst(option, &finalValue1, numStep1, &finalValue2, numStep2);
192}
193} // namespace Nektar::FieldUtils
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
FieldSharedPtr m_f
Field object.
Definition: Module.h:239
std::map< std::string, ConfigOption > m_config
List of configuration values.
Definition: Module.h:272
This processing module sets up for the boundary field to be extracted.
void v_Process(po::variables_map &vm) override
void call_lst(const long int &option, const NekDouble *finalValue1, const long int &numStep1, const NekDouble *finalValue2, const long int &numStep2)
void v_Process(po::variables_map &vm) override
Write mesh to output file.
static std::shared_ptr< Module > create(FieldSharedPtr f)
Creates an instance of this class.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
std::shared_ptr< Field > FieldSharedPtr
Definition: Field.hpp:1026
std::pair< ModuleType, std::string > ModuleKey
Definition: Module.h:180
ModuleFactory & GetModuleFactory()
Definition: Module.cpp:47
double NekDouble
STL namespace.
Represents a command-line configuration option.
Definition: Module.h:129