NREL / SOWFA

Other
130 stars 113 forks source link

Confusion about the use of Foam::atan2 in turbine models #93

Open hcOnel opened 1 year ago

hcOnel commented 1 year ago

Hi, I was reading through the actuator disk code and came across this line: https://github.com/NREL/SOWFA/blob/103832ebbae07b62220858a1e3da4b5e7d6375bd/src/turbineModels/turbineModelsStandard/horizontalAxisWindTurbinesADM/horizontalAxisWindTurbinesADM.C#L1274 The actuator line code also has a similar line: https://github.com/NREL/SOWFA/blob/103832ebbae07b62220858a1e3da4b5e7d6375bd/src/turbineModels/turbineModelsStandard/horizontalAxisWindTurbinesALM/horizontalAxisWindTurbinesALM.C#L1212

If I'm not mistaken, the Foam:atan2 function takes the arguments in y, x order: https://github.com/OpenFOAM/OpenFOAM-2.4.x/blob/2b147f41daf9ca07d0fb4c6b0576dc3d10a435f3/src/OpenFOAM/primitives/Scalar/doubleScalar/doubleScalar.H#L95 but the function is used in x, y order in the SOWFA code.

I'm confused about this usage. If it is because of the local coordinate system definition of airfoil sections, I've read the rest of the code (especially the computeWindVectors function) but still couldn't see how this order is justified.

Your input is highly appreciated Best, Hüseyin

EDIT: Since this angle is calculated with respect to the rotor plane tangent direction, x,y order kind of makes sense after drawing the vectors. However, the windVectors variable seems to be never used in the rotor coordinates, there is another variable for that (bladeAlignedVectors). Also I'm still having a hard time picturing the rotor CS by reading the code. Hence, I'm sorry if the answer is too obvious but I still can't see it.

ewquon commented 1 year ago

Hi Huseyin,

windVectors is rotated into the "blade-oriented coordinates" defined by bladeAlignedVectors. I think the important piece of information (and why this is potentially confusing) is to note that this coordinate system is set up with the "x" direction (i.e., component 0) aligned with the rotor disk normal direction: https://github.com/NREL/SOWFA/blob/103832ebbae07b62220858a1e3da4b5e7d6375bd/src/turbineModels/turbineModelsStandard/horizontalAxisWindTurbinesALM/horizontalAxisWindTurbinesALM.C#L1153-L1157

So the arctangent of the normal component divided by the tangential component would give you the "wind angle", i.e., the aerodynamic angle of attack + the local blade geometric angle, relative to the rotor plane.

Hopefully this makes sense.

Eliot

hcOnel commented 1 year ago

Yes, it makes sense now. Thanks for clearing up the confusion!