954,479 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

calculating solar time (stime)

# include “udf.h”
/* definition variables LTIME =local time, SMER=standard meridian on which local time is based (in degrees), LMER= meridian of the observer (in degrees), N = nth day of the year*/
#define LTIME 12:00
#define SMER 116.25
#define LMER 123.44
#define N 173
DEFINE_PROFILE(heat_flux, t, i)
{
Real B, E, stime,

B= 360*(N-81)/364;
E=987*sin(2*B)-7.53*cos(B)-1.5*sin(B);
E1=4*(SMER-LMER);
Tcorr = E+E1;
stime = LTIME +Tcorr;


/* Tcorr= time correction in minutes*/

This is part of the C code that I want to use for calculating solar time. This is the time based on apparent angular motion of the sun across the sky, with solar noon the time the sun crosses the meridian of the observer.
I want to use this code in a Computational Fluid Dynamics (CFD) package, Fluent. When I try to interpret the code into fluent, I am getting the following error:

Error:E:\simulation\first energy example.c line 46:parse error.

Line 46 is the line to calculate stime. Please can you help me with a formula for adding hours and minutes

tendolm
Newbie Poster
9 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 

LTIME must be either 12 (for hours) or 720 (for minutes), it cannot be 12:00 since that is not a proper C constant. Since you are implying that Tcorr is minutes, make LTIME 720. Then if you need the time in hours and minutes:

hours = stime % 60;
minutes = stime / 60;
nucleon
Posting Pro in Training
478 posts since Oct 2008
Reputation Points: 163
Solved Threads: 91
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You