32#ifndef LDNDC_SCIENTIFIC_METEO_H_
33#define LDNDC_SCIENTIFIC_METEO_H_
35#include "crabmeat-common.h"
37#include "math/cbm_math.h"
38#include "utils/cbm_utils.h"
40#include "constants/cbm_const.h"
42namespace ldndc {
namespace meteo
56 inline double CBM_API afgen(
62 return std::max( ABSMIN, 1.0 - ( 1.0 / ( MAX - MIN)) * std::max( 0.0, value - MIN));
76 inline double CBM_API svp(
79 return exp( 54.8781919 - ( 6790.4985 / t) - ( 5.02808 * log( t)));
96 inline double CBM_API LAMBDA(
100 return ( 3149000.0 - 2370.0 * tak) + (( tak < dtk) ? 334.0 : 0.0);
115 inline double CBM_API DESDT(
120 return ldndc::meteo::svp( t) * 100.0 * fl18 / ( rgc * t * t);
133 inline double CBM_API DES2DT(
140 return cbm::poly2( t - dtk, 2.0 * 1.675, 6.0 * 0.01408, 12.0 * 0.0005818);
152 inline double CBM_API Ft_pow(
157 return pow( _base, ( _temperature - _scale) / _scale);
174 inline double CBM_API Ft_oneill(
180 if ( cbm::flt_equal( _t_opt, _temperature ) || ( cbm::flt_equal_zero( _exp )))
184 if (( _t_max < _temperature) || cbm::flt_equal( _t_max, _temperature ))
188 if ( cbm::flt_equal( _t_max, _t_opt ))
190 return std::numeric_limits< double >::infinity();
193 double d0( _t_max - _temperature);
194 double d1( _t_max - _t_opt);
196 return pow( d0 / d1, _exp) * exp( _exp * ( d1 - d0) / d1);
213 inline double CBM_API F_weibull(
219 return ( 1.0 - ( P3 / ( 1.0 + exp((wfps - P1) * P2))));
231 inline double CBM_API F_surf(
236 return var / ( var + exp( a - b * var));
251 inline double CBM_API Ftemp(
258 return exp( CT - HA / ( cbm::RGAS * tempK)) / ( 1.0 + exp(( DS * tempK - HD) / ( cbm::RGAS * tempK)));
272 inline double CBM_API Three_Point_Effect(
278 if (( T > Tlow) && ( T < Thigh))
280 double l(Topt - Tlow);
281 double h(Thigh - Topt);
283 return ( (( T - Tlow) / l) * pow((( Thigh - T) / h), h / l));
302 inline double CBM_API Ft_q10(
308 if (( T < 0.0) || ( T > Tmax))
314 double wt( log( q10) * ( Tmax - Topt));
315 double f( 1.0 + pow(( 1.0 + 40.0 / wt), 0.5));
317 double xt( wt * wt * f * f / 400.0);
320 double vt(( Tmax - T) / ( Tmax - Topt));
321 return pow( vt, xt) * exp ( xt * ( 1.0 - vt));
339 inline double CBM_API relativeImpact(
345 return 1.0 - 2.0 * cbm::sqr((v - vSat) / vSat);
349 return 2.0 * cbm::sqr( v / vSat);
362 CBM_API stefan_boltzmann(
375 double CBM_API thornton97(
398 double CBM_API latitude_rad(
400 unsigned int * _nd = NULL,
401 unsigned int * _ys = NULL,
402 unsigned int * _ye = NULL);
412 double CBM_API latitude_rad2(
425 double CBM_API sun_declination(
438 double CBM_API sun_declination2(
440 unsigned int _days_in_current_year);
462 double CBM_API solar_elevation_sinus(
465 unsigned int _subday = invalid_uint,
unsigned int _t_res = invalid_uint);
485 double CBM_API solar_elevation_sinus_average(
488 unsigned int _subday = invalid_uint,
unsigned int _t_res = invalid_uint);
500 double CBM_API eccentricity(
501 unsigned int _jday,
unsigned int _days_in_year);
515 double CBM_API daily_solar_radiation(
517 unsigned int _jday,
unsigned int _days_in_year);
537 double CBM_API subdaily_extraterrestrial_radiation(
539 unsigned int _jday,
unsigned int _days_in_year,
540 unsigned int _subday = invalid_uint,
unsigned int _t_res = invalid_uint);
557 double CBM_API subdaily_solar_radiation_fraction(
574 double CBM_API subdaily_solar_radiation_fraction(
591 double CBM_API daily_solar_radiation_fraction(
592 double _rad,
double _rad_max);
604 double CBM_API daylength(
619 double CBM_API daylength_period(
639 double _temp,
double *_vps,
double *_slope=NULL);
654 double CBM_API annual_average_temperature(
655 double _t_ny,
double _t_nd);
668 double CBM_API longwave_radiation(
681 double CBM_API radiation_emissivity_clear_sky(
696 double CBM_API cloud_fraction_angstrom(
700 double _rad_short_day);
Spatially explicit groundwater model.
Definition airchemistryput.h:21