Merge remote-tracking branch 'origin/release-v4.6.1'
[WRF.git] / chem / KPP / kpp / kpp-2.1 / util / UpdateSun.c
blob81a82ba73136921d3ace1f34c502a0373638dfd4
1 void Update_SUN()
3 KPP_REAL SunRise, SunSet;
4 KPP_REAL Thour, Tlocal, Ttmp;
6 SunRise = 4.5;
7 SunSet = 19.5;
8 Thour = TIME/3600.0;
9 Tlocal = Thour - ((int)Thour/24)*24;
11 if ( (Tlocal >= SunRise) && (Tlocal <= SunSet) ) {
12 Ttmp = (2.0*Tlocal-SunRise-SunSet)/(SunSet-SunRise);
13 if (Ttmp > 0) Ttmp = Ttmp*Ttmp;
14 else Ttmp = -Ttmp*Ttmp;
15 SUN = ( 1.0 + cos(PI*Ttmp) )/2.0;
16 } else {
17 SUN=0.0;