/home/runner/work/amr-wind/amr-wind/amr-wind/wind_energy/actuator/aero/AirfoilTableI.H Source File

AMR-Wind API: /home/runner/work/amr-wind/amr-wind/amr-wind/wind_energy/actuator/aero/AirfoilTableI.H Source File
AMR-Wind API v0.1.0
CFD solver for wind plant simulations
Loading...
Searching...
No Matches
AirfoilTableI.H
Go to the documentation of this file.
1#ifndef AIRFOILTABLEI_H
2#define AIRFOILTABLEI_H
3
5
6#include <string>
7
8namespace amr_wind::actuator {
9
10template <typename IStream>
11std::unique_ptr<AirfoilTable> AirfoilLoader::load_text_file(IStream& affile)
12{
13 int num_entries;
14 affile >> num_entries;
15
16 std::unique_ptr<AirfoilTable> aftab(new AirfoilTable(num_entries));
17 for (int i = 0; i < num_entries; ++i) {
18 auto& pp = aftab->m_polar[i];
19 affile >> aftab->m_aoa[i] >> pp.x() >> pp.y() >> pp.z();
20 }
21
22 aftab->convert_aoa_to_radians();
23 return aftab;
24}
25
26template <typename IStream>
27std::unique_ptr<AirfoilTable>
29{
30 std::string buf;
31 int num_entries = -1;
32 while (affile.good() && num_entries < 0) {
33 std::getline(affile, buf);
34 const auto found = buf.find("NumAlf");
35 if (found != std::string::npos) {
36 std::stringstream ss(buf);
37 ss >> num_entries;
38 }
39 }
40
41 if (!affile.good() && (num_entries < 0)) {
42 amrex::Abort("AirfoilLoader: Error reading OpenFAST airfoil file");
43 }
44
45 // Skip two comment lines
46 std::getline(affile, buf);
47 std::getline(affile, buf);
48
49 std::unique_ptr<AirfoilTable> aftab(new AirfoilTable(num_entries));
50 for (int i = 0; i < num_entries; ++i) {
51 auto& pp = aftab->m_polar[i];
52 affile >> aftab->m_aoa[i] >> pp.x() >> pp.y() >> pp.z();
53 }
54
55 aftab->convert_aoa_to_radians();
56 return aftab;
57}
58
59} // namespace amr_wind::actuator
60#endif
static std::unique_ptr< AirfoilTable > load_openfast_airfoil(const std::string &af_file)
Definition AirfoilTable.cpp:62
static std::unique_ptr< AirfoilTable > load_text_file(const std::string &af_file)
Definition AirfoilTable.cpp:51
Definition AirfoilTable.H:16
Definition ActParser.H:6