calculating solar time (stime)

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Feb 2009
Posts: 9
Reputation: tendolm is an unknown quantity at this point 
Solved Threads: 0
tendolm tendolm is offline Offline
Newbie Poster

calculating solar time (stime)

 
0
  #1
Feb 18th, 2009
# 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,

  1. B= 360*(N-81)/364;
  2. E=987*sin(2*B)-7.53*cos(B)-1.5*sin(B);
  3. E1=4*(SMER-LMER);
  4. Tcorr = E+E1;
  5. 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
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 476
Reputation: nucleon has a spectacular aura about nucleon has a spectacular aura about 
Solved Threads: 91
nucleon's Avatar
nucleon nucleon is offline Offline
Posting Pro in Training

Re: calculating solar time (stime)

 
0
  #2
Feb 18th, 2009
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:
  1. hours = stime % 60;
  2. minutes = stime / 60;
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C Forum
Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC