static void _MDRainPotETPsTaylor (int itemID) { // Priestley and Taylor (1972) PE in mm for day // Input float dayLen; // daylength in fraction of day float i0hDay; // daily potential insolation on horizontal [MJ/m2] float albedo; // albedo float airT; // air temperatur [degree C] float solRad; // daily solar radiation on horizontal [MJ/m2] float vPress; // daily average vapor pressure [kPa] float sHeat = 0.0; // average subsurface heat storage for day [W/m2] // Local float solNet; // average net solar radiation for daytime [W/m2] float lngNet; // average net longwave radiation for day [W/m2] float aa; // available energy [W/m2] float es; // vapor pressure at airT [kPa] float delta; // dEsat/dTair [kPa/K] float dd; // vapor pressure deficit [kPa] float le; // latent heat [W/m2] // Output float pet; if (MFVarTestMissingVal (_MDInDayLengthID, itemID) || MFVarTestMissingVal (_MDInI0HDayID, itemID) || MFVarTestMissingVal (_MDInCParamAlbedoID, itemID) || MFVarTestMissingVal (_MDInAtMeanID, itemID) || MFVarTestMissingVal (_MDInSolRadID, itemID) || MFVarTestMissingVal (_MDInVPressID, itemID)) { MFVarSetMissingVal (_MDOutPetID,itemID); return; } dayLen = MFVarGetFloat (_MDInDayLengthID, itemID, 0.0); i0hDay = MFVarGetFloat (_MDInI0HDayID, itemID, 0.0); albedo = MFVarGetFloat (_MDInCParamAlbedoID, itemID, 0.0); airT = MFVarGetFloat (_MDInAtMeanID, itemID, 0.0); solRad = MFVarGetFloat (_MDInSolRadID, itemID, 0.0); vPress = MFVarGetFloat (_MDInVPressID, itemID, 0.0); solNet = (1.0 - albedo) * solRad / MDConstIGRATE; lngNet = MDSRadNETLong (i0hDay,airT,solRad,vPress); aa = solNet + lngNet - sHeat; es = MDPETlibVPressSat (airT); delta = MDPETlibVPressDelta (airT); dd = es - vPress; le = MDConstPTALPHA * delta * aa / (delta + MDConstPSGAMMA); pet = MDConstEtoM * MDConstIGRATE * le; MFVarSetFloat (_MDOutPetID,itemID,pet); }
static void _MDRainPotETPstd (int itemID) { // Penman (1948) PE in mm for day also given by Chidley and Pike (1970) // Input float dayLen; // daylength in fraction of day float i0hDay; // daily potential insolation on horizontal [MJ/m2] float albedo; // albedo float airT; // air temperatur [degree C] float solRad; // daily solar radiation on horizontal [MJ/m2] float vPress; // daily average vapor pressure [kPa] float wSpeed; // average wind speed for the day [m/s] float sHeat = 0.0; // average subsurface heat storage for day [W/m2] // Local float solNet; // average net solar radiation for day [W/m2] float novern; // sunshine duration fraction of daylength float effem; // effective emissivity from clear sky float cldCor; // cloud cover correction to net longwave under clear sky float lngNet; // average net longwave radiation for day [W/m2] float aa; // available energy [W/m2] float fu; // Penman wind function, [mm d-1 kPa-1] float es; // vapor pressure at airT [kPa] float delta; // dEsat/dTair [kPa/K] // Output float pet; if (MFVarTestMissingVal (_MDInDayLengthID, itemID) || MFVarTestMissingVal (_MDInI0HDayID, itemID) || MFVarTestMissingVal (_MDInCParamAlbedoID, itemID) || MFVarTestMissingVal (_MDInAtMeanID, itemID) || MFVarTestMissingVal (_MDInSolRadID, itemID) || MFVarTestMissingVal (_MDInVPressID, itemID) || MFVarTestMissingVal (_MDInWSpeedID, itemID)) { MFVarSetMissingVal (_MDOutPetID,itemID); return; } dayLen = MFVarGetFloat (_MDInDayLengthID, itemID, 12.0); i0hDay = MFVarGetFloat (_MDInI0HDayID, itemID, 0.0); albedo = MFVarGetFloat (_MDInCParamAlbedoID, itemID, 0.0); airT = MFVarGetFloat (_MDInAtMeanID, itemID, 0.0); solRad = MFVarGetFloat (_MDInSolRadID, itemID, 0.0); vPress = MFVarGetFloat (_MDInVPressID, itemID, 0.0); wSpeed = fabs (MFVarGetFloat (_MDInWSpeedID, itemID, 0.0)); if (wSpeed < 0.2) wSpeed = 0.2; solNet = (1.0 - albedo) * solRad / MDConstIGRATE; // net solar with Penman (1948) albedo of 0.25 effem = 0.44 + 0.252 * sqrt (vPress); // Brunt method for effective emissivity with Penman (1948) coefficients novern = ((solRad / i0hDay) - 0.18) / 0.55; // Penman's relation of SOLRAD / I0HDAY to sunshine duration n/N if (novern > 1.0) novern = 1.0; cldCor = 0.1 + 0.9 * novern; //Penman's (1948) longwave cloud correction coefficient lngNet = (effem - 1.0) * cldCor * MDConstSIGMA * pow (airT + 273.15,4.0); aa = solNet + lngNet - sHeat; es = MDPETlibVPressSat (airT); delta = MDPETlibVPressDelta (airT); fu = 2.6 * (1.0 + 0.54 * wSpeed); // Penman wind function given by Brutsaert (1982) eq 10.17 // Penman equation from Brutsaert eq 10.15 pet = (delta * MDConstEtoM * MDConstIGRATE * aa + MDConstPSGAMMA * fu * (es - vPress)) / (delta + MDConstPSGAMMA); MFVarSetFloat (_MDOutPetID,itemID,pet); }
static void _MDRainPotETSWGday (int itemID) { // daily Shuttleworth-Wallace-Gurney (1985, 1990) PE in mm for day // Input float dayLen; // daylength in fraction of day float i0hDay; // daily potential insolation on horizontal [MJ/m2] float albedo; // albedo float height; // canopy height [m] float lWidth; // average leaf width [m] float rss; // soil surface resistance [s/m] float r5; // solar radiation at which conductance is halved [W/m2] float cd; // vpd at which conductance is halved [kPa] float cr; // light extinction coefficient for projected LAI float glMax; // maximum leaf surface conductance for all sides of leaf [m/s] float z0g; // z0g - ground surface roughness [m] float lai; // projected leaf area index float sai; // projected stem area index float airT; // air temperatur [degree C] float airTMin; // daily minimum air temperature [degree C] float solRad; // daily solar radiation on horizontal [MJ/m2] float vPress; // daily average vapor pressure [kPa] float wSpeed; // average wind speed for the day [m/s] float sHeat = 0.0; // average subsurface heat storage for day [W/m2] // Local float solNet; // average net solar radiation for daytime [W/m2] float lngNet; // average net longwave radiation [W/m2] float z0; // roughness parameter [m] float disp; // height of zero-plane [m] float z0c; // roughness parameter (closed canopy) float dispc; // zero-plane displacement (closed canopy) float aa; // available energy [W/m2] float asubs; // available energy at ground [W/m2] float es; // vapor pressure at airT [kPa] float delta; // dEsat/dTair [kPa/K] float dd; // vapor pressure deficit [kPa] float rsc; // canopy resistance [s/m] float le; // latent heat [W/m2] float rn; // net radiation [W/m2] float rns; // net radiation at ground [W/m2] float raa; // aerodynamic resistance [s/m] float rac; // leaf boundary layer resistance [s/m] float ras; // ground aerodynamic resistance [s/m] // Output float pet; if (MFVarTestMissingVal (_MDInDayLengthID, itemID) || MFVarTestMissingVal (_MDInI0HDayID, itemID) || MFVarTestMissingVal (_MDInCParamAlbedoID, itemID) || MFVarTestMissingVal (_MDInCParamCHeightID,itemID) || MFVarTestMissingVal (_MDInCParamLWidthID, itemID) || MFVarTestMissingVal (_MDInCParamRSSID, itemID) || MFVarTestMissingVal (_MDInCParamR5ID, itemID) || MFVarTestMissingVal (_MDInCParamCDID, itemID) || MFVarTestMissingVal (_MDInCParamCRID, itemID) || MFVarTestMissingVal (_MDInCParamGLMaxID, itemID) || MFVarTestMissingVal (_MDInCParamZ0gID, itemID) || MFVarTestMissingVal (_MDInLeafAreaIndexID,itemID) || MFVarTestMissingVal (_MDInStemAreaIndexID,itemID) || MFVarTestMissingVal (_MDInAtMeanID, itemID) || MFVarTestMissingVal (_MDInAtMinID, itemID) || MFVarTestMissingVal (_MDInSolRadID, itemID) || MFVarTestMissingVal (_MDInVPressID, itemID) || MFVarTestMissingVal (_MDInWSpeedID, itemID)) { MFVarSetMissingVal (_MDOutPetID,itemID); return; } dayLen = MFVarGetFloat (_MDInDayLengthID, itemID, 0.1); i0hDay = MFVarGetFloat (_MDInI0HDayID, itemID, 0.0); albedo = MFVarGetFloat (_MDInCParamAlbedoID, itemID, 0.0); height = MFVarGetFloat (_MDInCParamCHeightID, itemID, 0.0); lWidth = MFVarGetFloat (_MDInCParamLWidthID, itemID, 0.0); rss = MFVarGetFloat (_MDInCParamRSSID, itemID, 0.0); r5 = MFVarGetFloat (_MDInCParamR5ID, itemID, 0.0); cd = MFVarGetFloat (_MDInCParamCDID, itemID, 0.0); cr = MFVarGetFloat (_MDInCParamCRID, itemID, 0.0); glMax = MFVarGetFloat (_MDInCParamGLMaxID, itemID, 0.0); z0g = MFVarGetFloat (_MDInCParamZ0gID, itemID, 0.0); lai = MFVarGetFloat (_MDInLeafAreaIndexID, itemID, 0.0); sai = MFVarGetFloat (_MDInStemAreaIndexID, itemID, 0.0); airT = MFVarGetFloat (_MDInAtMeanID, itemID, 0.0); airTMin = MFVarGetFloat (_MDInAtMinID, itemID, 0.0); solRad = MFVarGetFloat (_MDInSolRadID, itemID, 0.0); vPress = MFVarGetFloat (_MDInVPressID, itemID, 0.0); wSpeed = fabs (MFVarGetFloat (_MDInWSpeedID, itemID, 0.0)); if (wSpeed < 0.2) wSpeed = 0.2; solNet = (1.0 - albedo) * solRad / MDConstIGRATE; z0c = MDPETlibRoughnessClosed (height,z0g); dispc = height - z0c / 0.3; disp = MDPETlibZPDisplacement (height,lai,sai,z0g); z0 = MDPETlibRoughness (disp,height,lai,sai,z0g); lngNet = MDSRadNETLong (i0hDay,airT,solRad,vPress); rn = solNet + lngNet; aa = rn - sHeat; rns = rn * exp (-cr * (lai + sai)); asubs = rns - sHeat; es = MDPETlibVPressSat (airT); delta = MDPETlibVPressDelta (airT); dd = es - vPress; rsc = MDPETlibCanopySurfResistance (airTMin,solRad,dd,lai,sai,r5,cd,cr,glMax); raa = MDPETlibBoundaryResistance (wSpeed,height,z0g,z0c,dispc,z0,disp); rac = MDPETlibLeafResistance (wSpeed,height,lWidth,z0g,lai,sai,z0c,dispc); ras = MDPETlibGroundResistance (wSpeed,height,z0g,z0c,dispc,z0,disp); // ras=70; // raa=50; rsc=70; le = MDPETlibShuttleworthWallace (rss,aa,asubs,dd,raa,rac,ras,rsc,delta); pet = MDConstEtoM * MDConstIGRATE * le; // float pet1 = MFVarGetFloat (_MDInRefETPIDDEBUG, itemID, 0.0); // printf ("height %f lWidth %f rss %f r4 %f cd %f cr %f glMax %f z0g %f lai %f sai %f \n",height , lWidth ,rss, r5 ,cd ,cr, glMax ,z0g ,lai , sai ); // printf ("pet BMF %f pet FAO %f albedo %f\n",pet,pet1,albedo); MFVarSetFloat (_MDOutPetID,itemID,pet); }
static void _MDIrrRefEvapotransFAO (int itemID) { /* day-night Penman-Monteith PE in mm for day */ // Input // float dayLen; // daylength in fraction of day float i0hDay; // daily potential insolation on horizontal [MJ/m2] float airT; // air temperatur [degree C] float airTMin; // daily minimum air temperature [degree C] float airTMax; // daily maximum air temperature [degree C] float solRad; // daily solar radiation on horizontal [MJ/m2] float vPress; // daily average vapor pressure [kPa] float wSpeed; // average wind speed for the day [m/s] // Local float solNet; // average net solar radiation for daytime [W/m2] float es; // vapor pressure at airT [kPa] float es_min; // vapor pressure at airT [kPa] float es_max; // vapor pressure at airT [kPa] float delta; // dEsat/dTair [kPa/K] float psychometricConstant; float FAOEtp; float solNet_MJm2d; float nom; float denom; float meanAirTemp; float atmosPressure; float elevation; float nen; float temp; // dayLen = MFVarGetFloat (_MDInDayLengthID, itemID,0); i0hDay = MFVarGetFloat (_MDInI0HDayID, itemID,0); elevation = MFVarGetFloat (_MDInElevationID, itemID,0); airT = MFVarGetFloat (_MDInAtMeanID, itemID,0); solRad = MFVarGetFloat (_MDInSolRadID, itemID,0); vPress = MFVarGetFloat (_MDInVPressID, itemID,0); wSpeed = fabs (MFVarGetFloat (_MDInWSpeedID, itemID,0)); if (wSpeed < 0.2) wSpeed = 0.2; airTMin = MFVarGetFloat (_MDInAtMinID, itemID, 0.0); airTMax = MFVarGetFloat (_MDInAtMaxID, itemID, 0.0); atmosPressure = (293.0 - 0.0065 * elevation) / 293.0; atmosPressure = pow (atmosPressure, 5.26); atmosPressure = atmosPressure * 101.3; psychometricConstant = 0.665 * atmosPressure / 1000.0; meanAirTemp = (airTMin + airTMax) / 2.0; solNet = (1.0 - 0.23) * solRad ;// in MJ/m2 es_min = MDPETlibVPressSat (airTMin); es_max = MDPETlibVPressSat (airTMax); es = (es_min + es_max) / 2.0; solNet_MJm2d = solNet; // 0.0864; FAO equation wants SolNet in MJ/m2. nen = 4098 * (0.6108 * exp (17.27 * airT / (airT + 237.3))); delta = nen / ((airT + 237.3)*(airT + 237.3)); temp = es-vPress; nom = 0.408 * delta * solNet_MJm2d + psychometricConstant * 900 / (273.3 + airT) * wSpeed * temp; //FBM nimmt vapor pressure in kPA! denom = delta + psychometricConstant*(1+0.34 * wSpeed); FAOEtp = nom / denom; MFVarSetFloat (_MDOutIrrRefEvapotransID,itemID,FAOEtp); }