# Understanding solar calculator code

 Register Blogs Members List Search Today's Posts Mark Forums Read

 December 14, 2021, 06:50 Understanding solar calculator code #1 Member   Bushra Rasheed Join Date: Dec 2020 Posts: 97 Rep Power: 5 Hi! I am trying to understand how solar calculator calculates coordinates for sun direction. I have gone through all the formulas for calculating azimuth and altitude angle but I don't understand how open foam converts these angles into coordinates. In solarCalculator.C, there is a piece of code that calculates xyz coordinates as: Code: ``` direction_.z() = -sin(beta_); direction_.y() = cos(beta_)*cos(theta_); // South axis direction_.x() = cos(beta_)*sin(theta_); // West axis``` The above trigonometric formulas do not consider the hypotenuse multiplication to calculates x, y and z coordinates. I might be missing something. Please guide Thanks!

 December 21, 2021, 14:41 #2 Senior Member   Michael Alletto Join Date: Jun 2018 Location: Bremen Posts: 615 Rep Power: 15 This looks like sperical coordinates

 December 23, 2021, 04:42 #3 New Member   Federico Nahuel Ramírez Join Date: Dec 2020 Location: Spain Posts: 16 Rep Power: 5 It seems that these lines are not calculating the coordinates, but the unit vectors of x, y, and z. B_R_Khan likes this.

December 23, 2021, 14:27
#4
Member

Bushra Rasheed
Join Date: Dec 2020
Posts: 97
Rep Power: 5
Quote:
 Originally Posted by fedenr It seems that these lines are not calculating the coordinates, but the unit vectors of x, y, and z.
Yes you are right. I figured out that they are unit vectors calculated via theta and beta in radians.
Thanks!

 June 13, 2023, 14:31 Solar calculator with transient simulation #5 New Member   Join Date: May 2023 Posts: 1 Rep Power: 0 I've modelled a solar dryer that I want to simulate with irradiance data from the solar calculator. I would like to know how to run the simulation daily for a month for a year. Thanks in advance for your help!