/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.
2
3#include <string>
4
5namespace amr_wind::actuator {
6
7template <typename IStream>
8std::unique_ptr<AirfoilTable> AirfoilLoader::load_text_file(IStream& affile)
9{
10 int num_entries;
11 affile >> num_entries;
12
13 std::unique_ptr<AirfoilTable> aftab(new AirfoilTable(num_entries));
14 for (int i = 0; i < num_entries; ++i) {
15 auto& pp = aftab->m_polar[i];
16 affile >> aftab->m_aoa[i] >> pp.x() >> pp.y() >> pp.z();
17 }
18
19 aftab->convert_aoa_to_radians();
20 return aftab;
21}
22
23template <typename IStream>
24std::unique_ptr<AirfoilTable>
26{
27 std::string buf;
28 int num_entries = -1;
29 while (affile.good() && num_entries < 0) {
30 std::getline(affile, buf);
31 const auto found = buf.find("NumAlf");
32 if (found != std::string::npos) {
33 std::stringstream ss(buf);
34 ss >> num_entries;
35 }
36 }
37
38 if (!affile.good() && (num_entries < 0)) {
39 amrex::Abort("AirfoilLoader: Error reading OpenFAST airfoil file");
40 }
41
42 // Skip two comment lines
43 std::getline(affile, buf);
44 std::getline(affile, buf);
45
46 std::unique_ptr<AirfoilTable> aftab(new AirfoilTable(num_entries));
47 for (int i = 0; i < num_entries; ++i) {
48 auto& pp = aftab->m_polar[i];
49 affile >> aftab->m_aoa[i] >> pp.x() >> pp.y() >> pp.z();
50 }
51
52 aftab->convert_aoa_to_radians();
53 return aftab;
54}
55
56} // namespace amr_wind::actuator
static std::unique_ptr< AirfoilTable > load_openfast_airfoil(const std::string &af_file)
Definition AirfoilTable.cpp:63
static std::unique_ptr< AirfoilTable > load_text_file(const std::string &af_file)
Definition AirfoilTable.cpp:52
Definition AirfoilTable.H:13
Definition ActParser.H:6