VirtualFluids 0.2.0
Parallel CFD LBM Solver
Loading...
Searching...
No Matches
ActuatorFarmStandaloneVAWT.h
Go to the documentation of this file.
1//=======================================================================================
2// ____ ____ __ ______ __________ __ __ __ __
3// \ \ | | | | | _ \ |___ ___| | | | | / \ | |
4// \ \ | | | | | |_) | | | | | | | / \ | |
5// \ \ | | | | | _ / | | | | | | / /\ \ | |
6// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____
7// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______|
8// \ \ | | ________________________________________________________________
9// \ \ | | | ______________________________________________________________|
10// \ \| | | | __ __ __ __ ______ _______
11// \ | | |_____ | | | | | | | | | _ \ / _____)
12// \ | | _____| | | | | | | | | | | \ \ \_______
13// \ | | | | |_____ | \_/ | | | | |_/ / _____ |
14// \ _____| |__| |________| \_______/ |__| |______/ (_______/
15//
16// This file is part of VirtualFluids. VirtualFluids is free software: you can
17// redistribute it and/or modify it under the terms of the GNU General Public
18// License as published by the Free Software Foundation, either version 3 of
19// the License, or (at your option) any later version.
20//
21// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT
22// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24// for more details.
25//
26// SPDX-License-Identifier: GPL-3.0-or-later
27// SPDX-FileCopyrightText: Copyright © VirtualFluids Project contributors, see AUTHORS.md in root folder
28//
32#ifndef ActuatorFarmStandaloneVAWT_H
33#define ActuatorFarmStandaloneVAWT_H
34
35#include "ActuatorFarm.h"
36#include <algorithm>
37#include <vector>
38
39
40namespace vf::gpu {
41
43{
44public:
51 real rotorHeight,
52 const std::vector<real>& positionsTurbineX,
53 const std::vector<real>& positionsTurbineY,
54 const std::vector<real>& positionsTurbineZ,
55 const std::vector<real>& rotorSpeeds,
58 const std::vector<real>& polarAngleOfAttackDeg,
59 const std::vector<real>& polarLiftCoefficient,
60 const std::vector<real>& polarDragCoefficient,
61 real bladeChord,
62 real bladePitch,
63 real bladeMountingPoint,
64 real velocityInlet,
65 bool flagLocalizedSmearingWidth = false,
66 bool flagFlowCurvature = false,
67 bool flagEndEffects = false
72 rotorSpeeds(rotorSpeeds),
73 rotorHeight(rotorHeight),
74 bladeChord(bladeChord),
75 bladePitch(bladePitch),
76 bladeMountingPoint(bladeMountingPoint),
77 velocityInlet(velocityInlet),
78 flagFlowCurvature(flagFlowCurvature),
79 flagEndEffects(flagEndEffects),
80 polarAngleOfAttackDeg(polarAngleOfAttackDeg),
81 polarLiftCoefficient(polarLiftCoefficient),
82 polarDragCoefficient(polarDragCoefficient),
83 bladeHeights(computeBladeHeights(rotorHeight, numberOfPointsPerBlade)),
84 endEffectsDistribution(flagEndEffects ? computeEndEffectsDistribution(rotorHeight, bladeChord, numberOfPointsPerBlade)
85 : std::vector<real>(numberOfPointsPerBlade, vf::basics::constant::c1o1))
86{
87 using namespace vf::basics::constant;
88
90 throw std::runtime_error("ActuatorFarmStandaloneVAWT::ActuatorFarmStandaloneVAWT: numberOfPointsPerBlade "
91 "needs to be > 0.");
92 if (numberOfTurbines != this->rotorSpeeds.size())
93 throw std::runtime_error("ActuatorFarmStandaloneVAWT::ActuatorFarmStandaloneVAWT: rotor speeds need to have "
94 "same length as turbine positions!");
95 if (this->rotorHeight <= vf::basics::constant::c0o1)
96 throw std::runtime_error("ActuatorFarmStandaloneVAWT::ActuatorFarmStandaloneVAWT: rotorHeight needs to be positive!");
97 if (this->bladeChord <= vf::basics::constant::c0o1)
98 throw std::runtime_error("ActuatorFarmStandaloneVAWT::ActuatorFarmStandaloneVAWT: bladeChord needs to be positive!");
99 if (this->polarAngleOfAttackDeg.size() != this->polarLiftCoefficient.size() || this->polarAngleOfAttackDeg.size() != this->polarDragCoefficient.size() || this->polarAngleOfAttackDeg.empty())
100 throw std::runtime_error("ActuatorFarmStandaloneVAWT::ActuatorFarmStandaloneVAWT: polarAngleOfAttackDeg/polarLiftCoefficient/polarDragCoefficient vectors need "
101 "same non-zero size!");
102 if (!std::is_sorted(this->polarAngleOfAttackDeg.begin(), this->polarAngleOfAttackDeg.end()))
103 throw std::runtime_error("ActuatorFarmStandaloneVAWT::ActuatorFarmStandaloneVAWT: polarAngleOfAttackDeg values need to be sorted "
104 "in ascending order.");
105
106 VF_LOG_INFO("VAWT parameters:");
107 VF_LOG_INFO("--------------");
108 VF_LOG_INFO("rotorHeight [m] = {}", this->rotorHeight);
109 VF_LOG_INFO("bladeChord [m] = {}", this->bladeChord);
110 VF_LOG_INFO("bladePitch [rad] = {}", this->bladePitch);
111 VF_LOG_INFO("mounting point = {}", this->bladeMountingPoint);
112 VF_LOG_INFO("localized smearing = {}", this->flagLocalSmearingWidth ? "on" : "off");
113 VF_LOG_INFO("flow curvature = {}", this->flagFlowCurvature ? "on" : "off");
114 VF_LOG_INFO("end effects = {}", this->flagEndEffects ? "on" : "off");
115 this->forceNormal.resize(getTotalNumberOfPoints());
116 this->forceTangential.resize(getTotalNumberOfPoints());
117 this->angleOfAttackDeg.resize(getTotalNumberOfPoints());
118 this->azimuthDeg.resize(getTotalNumberOfPoints());
119}
120
121 ~ActuatorFarmStandaloneVAWT() override = default;
122
123 void init() override;
124 void updateForcesAndCoordinates(real time, real deltaT) override;
125
127 static std::vector<real> computeBladeHeights(real rotorHeight, uint numberOfPointsPerBlade);
128
129private:
130 static std::vector<real> solveGauss(std::vector<std::vector<real>> D, std::vector<real> b);
131 static std::vector<real> computeEndEffectsDistribution(real rotorHeight, real bladeChord, uint numberOfPointsPerBlade);
132 static real get_flowCurvature(real vrel, real xchord, real rotorSpeed, real bladeChord);
133
134 void updateCoordinatesVAWT(real time, real deltaT);
135 void updateForcesVAWT(real time, real deltaT);
136 void appendOutputData(std::vector<std::string>& dataNames, std::vector<std::vector<double>>& nodeData) const override;
137
138 const std::vector<real> rotorSpeeds;
139 const real rotorHeight;
140 const real bladeChord;
141 const real bladePitch;
142 const real bladeMountingPoint;
143 const real velocityInlet;
144 const bool flagFlowCurvature;
145 const bool flagEndEffects;
146 std::vector<real> forceTangential, forceNormal, angleOfAttackDeg, azimuthDeg;
147 const std::vector<real> polarAngleOfAttackDeg;
148 const std::vector<real> polarLiftCoefficient;
149 const std::vector<real> polarDragCoefficient;
150 const std::vector<real> bladeHeights;
151 const std::vector<real> endEffectsDistribution;
152};
153
154}
155#endif
156
#define VF_LOG_INFO(...)
Definition Logger.h:50
const bool flagLocalSmearingWidth
const uint numberOfPointsPerBlade
uint getTotalNumberOfPoints() const
const uint numberOfTurbines
static std::vector< real > computeBladeHeights(real rotorHeight, uint numberOfPointsPerBlade)
void updateForcesAndCoordinates(real time, real deltaT) override
ActuatorFarmStandaloneVAWT(SPtr< Parameter > para, SPtr< CudaMemoryManager > cudaMemoryManager, real rotorDiameter, uint numberOfBlades, uint numberOfPointsPerBlade, real rotorHeight, const std::vector< real > &positionsTurbineX, const std::vector< real > &positionsTurbineY, const std::vector< real > &positionsTurbineZ, const std::vector< real > &rotorSpeeds, real smearingWidth, int gridLevelForALM, const std::vector< real > &polarAngleOfAttackDeg, const std::vector< real > &polarLiftCoefficient, const std::vector< real > &polarDragCoefficient, real bladeChord, real bladePitch, real bladeMountingPoint, real velocityInlet, bool flagLocalizedSmearingWidth=false, bool flagFlowCurvature=false, bool flagEndEffects=false)
static std::vector< real > computeBladeRadii(real rotorDiameter, uint numberOfPointsPerBlade)
~ActuatorFarmStandaloneVAWT() override=default
SPtr< CudaMemoryManager > cudaMemoryManager
std::shared_ptr< T > SPtr
float real
Definition DataTypes.h:42
unsigned int uint
Definition DataTypes.h:47