0

# 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

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by nucleon
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;
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.