and atan2
Hello all,
I'm trying to initialise a field depending on the polar angle and just noticed, there is no atan2 in swak4foam. The workaround would be to use atan with some conditions as shown here: https://en.wikipedia.org/wiki/Atan2 Atan is not going from -pi to pi. Does somebody have a solution to this problem already? Am I overseening a trivial solution? Regards, Luk |
atan2 in funkySetFieldsDict
1 Attachment(s)
I found a solution to the problem. I used a sequence of ifs written down as ternary operators. The math is taken from here:
https://de.mathworks.com/matlabcentr...from-0-to-2-pi This is the snippet to use in funkySetFieldsDict. Please note, I'm in the y-z-plane instead of the x-y-plane used in the explanation. I simply replaced x by z. Please check if the angle definition fits your coordinate system before use. Code:
myVariables ( |
All times are GMT -4. The time now is 00:48. |