/***************************************************************************** MassEnergyBalance() *****************************************************************************/ void MassEnergyBalance(int y, int x, float SineSolarAltitude, float DX, float DY, int Dt, int HeatFluxOption, int CanopyRadAttOption, int MaxVegLayers, PIXMET *LocalMet, ROADSTRUCT *LocalNetwork, CHANNEL *ChannelData, PRECIPPIX *LocalPrecip, VEGTABLE *VType, VEGCHEMPIX *LocalVeg, SOILTABLE *SType, SOILPIX *LocalSoil, SNOWPIX *LocalSnow, EVAPPIX *LocalEvap, PIXRAD *TotalRad, CHEMTABLE *ChemTable, SOILCHEMTABLE *SCType, VEGCHEMTABLE *VCType, DATE CurDate, BASINWIDE * Basinwide, GWPIX *LocalGW, GEOTABLE *GType, float Slope, MAPSIZE *Map, VEGCHEMPIX **VegChemMap,OPTIONSTRUCT *Options, int NSoilLayers, SOILPIX ** SoilMap, GWPIX ** Groundwater, int NpsCats, NPSPIX **NpsMap, NONPOINTSOURCE **NpsTable, AGGREGATED *Total, int NChems, int HasGroundwater, TOPOPIX ** TopoMap, float **PopulationMap) { PIXRAD LocalRad; /* Radiation balance components (W/m^2) */ float SurfaceWater_m; /* Pixel average depth of water before infiltration is calculated (m) */ float Infiltration; /* Infiltration into the top soil layer (m) */ float LowerRa; /* Aerodynamic resistance for lower layer (s/m) */ float LowerWind; /* Wind for lower layer (m/s) */ float MaxInfiltration; /* Maximum infiltration into the top soil layer (m) */ float MaxRoadbedInfiltration; /* Maximum infiltration through the road bed soil layer (m) */ float MeltEnergy; /* Energy used to melt snow and change of cold content of snow pack */ float MoistureFlux; /* Amount of water transported from the pixel to the atmosphere (m/timestep) */ float NetRadiation; /* Net radiation for a layer (W/m2) */ float Reference; /* Reference height for sensible heat calculation (m) */ float RoadbedInfiltration; /* Infiltration through the road bed (m) */ float Roughness; /* Roughness length (m) */ float Rp; /* radiation flux in visible part of the spectrum (W/m^2) */ float UpperRa; /* Aerodynamic resistance for upper layer (s/m) */ float UpperWind; /* Wind for upper layer (m/s) */ float SnowLongIn; /* Incoming longwave radiation at snow surface (W/m2) */ float SnowNetShort; /* Net amount of short wave radiation at the snow surface (W/m2) */ float SnowRa; /* Aerodynamic resistance for snow */ float SnowWind; /* Wind 2 m above snow */ float Tsurf; /* Surface temperature used in LongwaveBalance() (C) */ int NVegLActual; /* Number of vegetation layers above snow */ int HasSnow; float SurfaceSoilWaterFlux; /* Track the movement from soil to surfce or vice versa for use in Chemistry routing, MWW -sc */ float Thrufall = 0.0; /* Temporarily stores the amount of rainfall for use in atmospheric deposition of Chems, MWW -sc */ int CurMonth = CurDate.Month; /* current month*/ ApplyNonPointSources(x,y,NSoilLayers, SoilMap, Groundwater, ChemTable, NpsCats, NpsMap, NpsTable, Total, NChems, HasGroundwater, Map, TopoMap, PopulationMap, VType, VegChemMap); NVegLActual = VType->NVegLayers; if (LocalSnow->HasSnow == TRUE && VType->UnderStory == TRUE)--NVegLActual; /* initialize the total amount of evapotranspiration, and MeltEnergy */ LocalEvap->ETot = 0.0; LocalEvap->ET_potential = 0.0; MeltEnergy = 0.0; MoistureFlux = 0.0; /* calculate the radiation balance for the ground/snow surface and the vegetation layers above that surface */ RadiationBalance(HeatFluxOption, CanopyRadAttOption, SineSolarAltitude, LocalMet->Sin, LocalMet->SinBeam, LocalMet->SinDiffuse, LocalMet->Lin, LocalMet->Tair, LocalVeg->Tcanopy, LocalSoil->TSurf, SType->Albedo, VType, LocalSnow, &LocalRad); /* calculate the actual aerodynamic resistances and wind speeds */ UpperWind = VType->U[0] * LocalMet->Wind; UpperRa = VType->Ra[0] / LocalMet->Wind; if((isnan(UpperRa))) assert(FALSE); //JASONS EDIT: 061025 moved from 3 lines above, because otherwise, was checking isNAN before being set! if (VType->OverStory == TRUE) { LowerWind = VType->U[1] * LocalMet->Wind; LowerRa = VType->Ra[1] / LocalMet->Wind; } else { LowerWind = UpperWind; LowerRa = UpperRa; } /* calculate the amount of interception storage, and the amount of throughfall. Of course this only needs to be done if there is vegetation present. */ #ifndef NO_SNOW if (VType->OverStory == TRUE && (LocalPrecip->IntSnow[0] || LocalPrecip->SnowFall > 0.0)) { SnowInterception(y, x, Dt, VType->Fract[0], VType->LAI[0], VType->MaxInt[0], VType->MaxSnowInt, VType->MDRatio, VType->SnowIntEff, UpperRa, LocalMet->AirDens, LocalMet->Eact, LocalMet->Lv, &LocalRad, LocalMet->Press, LocalMet->Tair, LocalMet->Vpd, UpperWind, &(LocalPrecip->RainFall), &(LocalPrecip->SnowFall), &(LocalPrecip->IntRain[0]), &(LocalPrecip->IntSnow[0]), &(LocalPrecip->TempIntStorage), &(LocalSnow->CanopyVaporMassFlux), &(LocalVeg->Tcanopy), &MeltEnergy); MoistureFlux -= LocalSnow->CanopyVaporMassFlux; // Because we now have a new estimate of the canopy temperature we can recalculate the longwave balance if (LocalSnow->HasSnow == TRUE)Tsurf = LocalSnow->TSurf; else if (HeatFluxOption == TRUE)Tsurf = LocalSoil->TSurf; else Tsurf = LocalMet->Tair; LongwaveBalance(VType->OverStory, VType->Fract[0], LocalMet->Lin, LocalVeg->Tcanopy, Tsurf, &LocalRad); }//if no snow, then calculate rain interception else if (VType->NVegLayers > 0) { LocalVeg->Tcanopy = LocalMet->Tair; LocalSnow->CanopyVaporMassFlux = 0.0; LocalPrecip->TempIntStorage = 0.0; InterceptionStorage(VType->NVegLayers, NVegLActual, VType->MaxInt,VType->Fract, LocalPrecip->IntRain,&(LocalPrecip->RainFall)); } Thrufall = LocalPrecip->RainFall; /* if snow is present, simulate the snow pack dynamics */ if (LocalSnow->HasSnow || LocalPrecip->SnowFall > 0.0) { if (VType->OverStory == TRUE) { SnowLongIn = LocalRad.LongIn[1]; SnowNetShort = LocalRad.NetShort[1]; } else { SnowLongIn = LocalRad.LongIn[0]; SnowNetShort = LocalRad.NetShort[0]; } SnowWind = VType->USnow * LocalMet->Wind; SnowRa = VType->RaSnow / LocalMet->Wind; LocalSnow->Outflow = SnowMelt(y, x, Dt, 2. + Z0_SNOW, 0.f, Z0_SNOW, SnowRa, LocalMet->AirDens, LocalMet->Eact, LocalMet->Lv, SnowNetShort, SnowLongIn, LocalMet->Press, LocalPrecip->RainFall, LocalPrecip->SnowFall, LocalMet->Tair, LocalMet->Vpd, SnowWind, &(LocalSnow->PackWater), &(LocalSnow->SurfWater), &(LocalSnow->Swq), &(LocalSnow->VaporMassFlux), &(LocalSnow->TPack), &(LocalSnow->TSurf), &MeltEnergy, &(LocalSnow->ShearStress), &(LocalSnow->IceA), &(LocalSnow->IceVelocity), Slope ); /* Rainfall was added to SurfWater of the snow pack and has to be set to zero */ LocalPrecip->RainFall = 0.0; MoistureFlux -= LocalSnow->VaporMassFlux; /* Because we now have a new estimate of the snow surface temperature we can recalculate the longwave balance */ Tsurf = LocalSnow->TSurf; LongwaveBalance(VType->OverStory, VType->Fract[0], LocalMet->Lin, LocalVeg->Tcanopy, Tsurf, &LocalRad); } else { LocalSnow->Outflow = 0.0; LocalSnow->VaporMassFlux = 0.0; } /* Determine whether a snow pack is still present, or whether everything has melted */ if (LocalSnow->Swq > 0.0)LocalSnow->HasSnow = TRUE; else LocalSnow->HasSnow = FALSE; /*do the glacier add */ if (LocalSnow->Swq < 1.0 && VType->Index == GLACIER) { printf("resetting glacier swe of %f to 5.0 meters\n", LocalSnow->Swq); LocalSnow->Glacier += (5.0 - LocalSnow->Swq); LocalSnow->Swq = 5.0; LocalSnow->TPack = 0.0; LocalSnow->TSurf = 0.0; } #endif //end if there is snow #ifndef NO_ET /* calculate the amount of evapotranspiration from each vegetation layer above the ground/soil surface. Also calculate the total amount of evapotranspiration from the vegetation */ // NetRadiation=0; //JASONS EDIT: BUGBUG: the following line uses this as a param, but it is not yet defined. /* Calculate the potentail ET, this is not used for any other calcs but is a desired output in some situations, VARID added as 100. MWW 052405 */ /* LocalEvap->ET_potential = ((LocalMet->Slope/(LocalMet->Slope + LocalMet->Gamma) * NetRadiation) + (LocalMet->Gamma/(LocalMet->Slope + LocalMet->Gamma) * (6.43*(1+0.536*LocalMet->Wind)*LocalMet->Vpd/1000)/LocalMet->Lv))/ (WATER_DENSITY * LocalMet->Lv); LocalEvap->ET_potential *=Dt; // convert to meters per timestep */ //calculate evapotranspiration if overstory present if (VType->OverStory == TRUE) { Rp = VISFRACT * LocalRad.NetShort[0]; NetRadiation = LocalRad.NetShort[0] + LocalRad.LongIn[0] - 2 * VType->Fract[0] * LocalRad.LongOut[0]; EvapoTranspiration(0, Dt, LocalMet, NetRadiation, Rp, VType, SType, MoistureFlux, LocalSoil, &(LocalPrecip->IntRain[0]), LocalEvap, LocalNetwork->Adjust, UpperRa, Total); MoistureFlux += LocalEvap->EAct[0] + LocalEvap->EInt[0]; if (LocalSnow->HasSnow != TRUE) {//calc understory evapotranspiration if there is no snow Rp = VISFRACT * LocalRad.NetShort[1]; NetRadiation = LocalRad.NetShort[1] + LocalRad.LongIn[1] - VType->Fract[1] * LocalRad.LongOut[1]; EvapoTranspiration(1, Dt, LocalMet, NetRadiation, Rp, VType, SType, MoistureFlux, LocalSoil, &(LocalPrecip->IntRain[1]), LocalEvap, LocalNetwork->Adjust, LowerRa, Total); MoistureFlux += LocalEvap->EAct[1] + LocalEvap->EInt[1]; } else {//calc understory evapotranspiration if there is snow LocalEvap->EAct[1] = 0.; LocalEvap->EInt[1] = 0.; } }//end overstory == true // calc evapotranspiration if there is understory but not overstory and no snow else if (LocalSnow->HasSnow != TRUE && VType->UnderStory == TRUE) { Rp = VISFRACT * LocalRad.NetShort[0]; NetRadiation = LocalRad.NetShort[0] + LocalRad.LongIn[0] - VType->Fract[0] * LocalRad.LongOut[0]; EvapoTranspiration(0, Dt, LocalMet, NetRadiation, Rp, VType, SType,MoistureFlux, LocalSoil, &(LocalPrecip->IntRain[0]), LocalEvap, LocalNetwork->Adjust, LowerRa, Total); MoistureFlux += LocalEvap->EAct[0] + LocalEvap->EInt[0]; } // calc evapotranspiration if there is snow and understory else if (VType->UnderStory == TRUE) { LocalEvap->EAct[0] = 0.; LocalEvap->EInt[0] = 0.; } // Calculate soil evaporation from the upper soil layer if no snow is present and there is no understory if (LocalSnow->HasSnow != TRUE && VType->UnderStory != TRUE) { if (VType->OverStory == TRUE){ printf("this should never happen."); ASSERTTEST(NetRadiation = LocalRad.NetShort[1] + LocalRad.LongIn[1] - LocalRad.LongOut[1]); } else ASSERTTEST(NetRadiation =LocalRad.NetShort[0] + LocalRad.LongIn[0] - LocalRad.LongOut[0]); NEGTEST(LocalEvap->EvapSoil = SoilEvaporation(Dt, LocalMet->Tair, LocalMet->Slope, LocalMet->Gamma, LocalMet->Lv, LocalMet->AirDens, LocalMet->Vpd, NetRadiation, LowerRa, MoistureFlux, SType->Porosity[0], SType->Ks[0], SType->Press[0], SType->PoreDist[0], VType->RootDepth_m[0], &(LocalSoil->Moist_m_m[0]), LocalNetwork->Adjust[0], &(LocalEvap->ET_potential))); } else LocalEvap->EvapSoil = 0.0; ASSERTTEST(MoistureFlux += LocalEvap->EvapSoil); if(LocalEvap->ETot <0){ printf("negative total evap: %g\n",LocalEvap->ETot); LocalEvap->ETot=0; } #endif /* add the water that was not intercepted to the upper soil layer */ #ifndef NO_SOIL LocalSoil->SurfaceWater_m = 0.0; NEGTEST(SurfaceWater_m = LocalPrecip->RainFall + LocalSoil->Runoff_m + LocalSnow->Outflow); NEGTEST(MaxInfiltration = (1 - VType->ImpervFrac) * LocalNetwork->PercArea[0] * SType->MaxInfiltrationRate * Dt); Infiltration = min(MaxInfiltration,(1 - VType->ImpervFrac) * LocalNetwork->PercArea[0] *SurfaceWater_m); if (Infiltration > MaxInfiltration)assert(FALSE); Total->Soil.Infiltration_m+=Infiltration; NEGTEST(MaxRoadbedInfiltration = (1 - LocalNetwork->PercArea[0]) * LocalNetwork->MaxInfiltrationRate * Dt); NEGTEST(RoadbedInfiltration = (1 - LocalNetwork->PercArea[0]) *SurfaceWater_m); //temporary measure JSB 4-4-09 There is no roadbed - why is roadbedinterception >0? RoadbedInfiltration=0; if (RoadbedInfiltration > MaxRoadbedInfiltration) RoadbedInfiltration = MaxRoadbedInfiltration; ASSERTTEST(LocalSoil->Runoff_m = SurfaceWater_m - Infiltration - RoadbedInfiltration); if(LocalSoil->Runoff_m<0){ if(LocalSoil->Runoff_m < -0.0001){ //add this check, in case very small float multiplication rounding error may occur printf("Warning: Negative runoff: %.5f m at X: %d Y: %d \n",LocalSoil->Runoff_m,y,x); assert(FALSE); } LocalSoil->Runoff_m=0; } // if(LocalSoil->Runoff_m>1)assert(FALSE); NEGTEST(LocalSoil->SurfaceWater_m = LocalSoil->Runoff_m); /* Calculate unsaturated soil water movement, and adjust soil water table depth */ UnsaturatedFlow(Dt, Infiltration, RoadbedInfiltration,SType->NLayers, LocalSoil->Depth, VType->RootDepth_m, SType->Ks, SType->PoreDist, SType->Porosity, SType->FCap, LocalSoil->Perc, LocalNetwork->PercArea, LocalNetwork->Adjust, LocalNetwork->CutBankZone,LocalNetwork->BankHeight, &(LocalSoil->TableDepth_m), &(LocalSoil->Runoff_m), LocalSoil->Moist_m_m, LocalSoil->ChannelReturn,y,x); NEGTEST(LocalSoil->Runoff_m); //if(LocalSoil->Runoff_m>1)printf("Warning: surface runoff is %.3f m at X: %d Y: %d \n",LocalSoil->Runoff_m,y,x); /* positive SurfaceSoilWaterFlux, means water has moved from the surface into the soil */ ASSERTTEST(SurfaceSoilWaterFlux = (LocalSoil->SurfaceWater_m - LocalSoil->Runoff_m)); if(ChemTable->NChems > 0) { /* MWW Add new chems from veg to surface and soil, also Track the source of surface waters and route disolved chems appropriately */ SoilChemistry(y, x, Dt, DX, DY,LocalSoil, SType, LocalVeg, VType, GType, ChemTable, Thrufall, SurfaceSoilWaterFlux, SCType, VCType, LocalMet, CurMonth,Basinwide, CurDate,Options); } if (HeatFluxOption == TRUE) { if (LocalSnow->HasSnow == TRUE) { Reference = 2. + Z0_SNOW; Roughness = Z0_SNOW; } else { Reference = 2. + Z0_GROUND; Roughness = Z0_GROUND; } SensibleHeatFlux(y, x, Dt, LowerRa, Reference, 0.0f, Roughness, LocalMet, LocalRad.PixelNetShort, LocalRad.PixelLongIn, MoistureFlux, SType->NLayers, VType->RootDepth_m, SType, MeltEnergy, LocalSoil); Tsurf = LocalSoil->TSurf; LongwaveBalance(VType->OverStory, VType->Fract[0], LocalMet->Lin, LocalVeg->Tcanopy, Tsurf, &LocalRad); } else NoSensibleHeatFlux(Dt, LocalMet, MoistureFlux, LocalSoil); #endif /* ----------------------------------------------------------*/ /* Assign local met data to the Stream Channel variables for */ /* stream temperature calculations. Added 08/12/2004 MWW */ if (channel_grid_has_channel(ChannelData->stream_map, x, y)) { /* assign Pixel met data to channel segment for the current time step */ if (LocalSnow->HasSnow)HasSnow = 1; else HasSnow = 0; channel_grid_metdata(ChannelData->stream_map, x, y, LocalMet->Tair, LocalRad.PixelNetShort, LocalRad.PixelLongIn, LowerWind, LocalMet->Rh, LocalMet->Press, HasSnow); } /* -END-STREAM-TEMP-SECTION-----------------------------------*/ /* add the components of the radiation balance for the current pixel to the total */ AggregateRadiation(MaxVegLayers, VType->NVegLayers, &LocalRad, TotalRad); }
/***************************************************************************** Function name: MassEnergyBalance() Purpose : Calculate mass and energy balance Required : Returns : void Modifies : Comments : Reference : Epema, G.F. and H.T. Riezbos, 1983, Fall Velocity of waterdrops at different heights as a factor influencing erosivity of simulated rain. Rainfall simulation, Runoff and Soil Erosion. Catena suppl. 4, Braunschweig. Jan de Ploey (Ed), 1-17. Laws, J.o., and D.A. Parsons, 1943, the relation of raindrop size to intensity. Trans. Am. Geophys. Union, 24: 452-460. Wicks, J.M. and J.C. Bathurst, 1996, SHESED: a physically based, distributed erosion and sediment yield component for the SHE hydrological modeling system, Journal of Hydrology, 175, 213-238. *****************************************************************************/ void MassEnergyBalance(OPTIONSTRUCT *Options, int y, int x, float SineSolarAltitude, float DX, float DY, int Dt, int HeatFluxOption, int CanopyRadAttOption, int RoadRouteOption, int InfiltOption, int MaxVegLayers, PIXMET *LocalMet, ROADSTRUCT *LocalNetwork, PRECIPPIX *LocalPrecip, VEGTABLE *VType, VEGPIX *LocalVeg, SOILTABLE *SType, SOILPIX *LocalSoil, SNOWPIX *LocalSnow, EVAPPIX *LocalEvap, PIXRAD *TotalRad, CHANNEL *ChannelData, float **skyview) { PIXRAD LocalRad; /* Radiation balance components (W/m^2) */ float SurfaceWater; /* Pixel average depth of water before infiltration is calculated (m) */ float RoadWater; /* Average depth of water on the road surface (normalized by grid cell area) before infiltration is calculated (m) */ float ChannelWater; /* Precip that hits the channel */ float Infiltration; /* Infiltration into the top soil layer (m) */ float Infiltrability; /* Dynamic infiltration capacity (m/s)*/ float B; /* Capillary drive and soil saturation deficit used in dynamic infiltration calculation*/ float LowerRa; /* Aerodynamic resistance for lower layer (s/m) */ float LowerWind; /* Wind for lower layer (m/s) */ float MaxInfiltration; /* Maximum infiltration into the top soil layer (m) */ float MaxRoadbedInfiltration; /* Maximum infiltration through the road bed soil layer (m) */ float MeltEnergy; /* Energy used to melt snow and change of cold content of snow pack */ float MoistureFlux; /* Amount of water transported from the pixel to the atmosphere (m/timestep) */ float NetRadiation; /* Total Net long- and shortwave radiation for each veg layer (W/m2) */ float PercArea; /* Surface area of percolation corrected for channel and road area, divided by the grid cell area (0-1) */ float Reference; /* Reference height for sensible heat calculation (m) */ float RoadbedInfiltration;/* Infiltration through the road bed (m) */ float Roughness; /* Roughness length (m) */ float Rp; /* radiation flux in visible part of the spectrum (W/m^2) */ float UpperRa; /* Aerodynamic resistance for upper layer (s/m) */ float UpperWind; /* Wind for upper layer (m/s) */ float SnowLongIn; /* Incoming longwave radiation at snow surface (W/m2) */ float SnowNetShort; /* Net amount of short wave radiation at the snow surface (W/m2) */ float SnowRa; /* Aerodynamic resistance for snow */ float SnowWind; /* Wind 2 m above snow */ float Tsurf; /* Surface temperature used in LongwaveBalance() (C) */ float RainfallIntensity; /* Rainfall intensity (mm/h) */ float MS_Rainfall; /* Momentum squared for rain throughfall((kg* m/s)^2 /(m^2 * s)) */ int MS_Index; /* Index for determining alpha and beta cooresponding to RainfallIntensity*/ int NVegLActual; /* Number of vegetation layers above snow */ float alpha[4]={2.69e-8,3.75e-8,6.12e-8,11.75e-8}; /* empirical coefficient for rainfall momentum after Wicks and Bathurst (1996) */ float beta[4]={1.6896,1.5545,1.4242,1.2821}; /* empirical coefficient for rainfall momentum after Wicks and Bathurst (1996) */ int i; float CanopyHeight[18] = {0.5,1,1.5,2,3,4,5,6,7,8,9,10,11,12, 13,14,15,16}; /* Canopy height at which drip fall velocity is prescribed after Epema and Riezebos (1983) (m)*/ float FallVelocity[18] = {2.96,4.12,5.12,5.82,6.84,7.54,8.05,8.36, 8.54,8.66,8.75,8.82,8.87,8.91,8.96,9.02,9.07,9.13}; /* Drip fall velocity corresponding to CanopyHeight after Epema and Riezebos (1983) (m/s)*/ float LD_FallVelocity; /* Leaf drip fall velocity corresponding to the canopy height in vegetation map (m/s) */ /* Calculate the number of vegetation layers above the snow */ NVegLActual = VType->NVegLayers; if (LocalSnow->HasSnow == TRUE && VType->UnderStory == TRUE) --NVegLActual; /* initialize the total amount of evapotranspiration, and MeltEnergy */ LocalEvap->ETot = 0.0; MeltEnergy = 0.0; MoistureFlux = 0.0; /* calculate the radiation balance for the ground/snow surface and the vegetation layers above that surface */ /* related files: settings.h data.h Calendar.h DHSVMerror.h massenergy.h constants.h */ // RadiationBalance(Options, HeatFluxOption, CanopyRadAttOption, SineSolarAltitude, // LocalMet->VICSin, LocalMet->Sin, LocalMet->SinBeam, LocalMet->SinDiffuse, // LocalMet->Lin, LocalMet->Tair, LocalVeg->Tcanopy, // LocalSoil->TSurf, SType->Albedo, VType, LocalSnow, &LocalRad); CRadiationBalance * crb = new CRadiationBalance; crb->init(Options, HeatFluxOption, CanopyRadAttOption, SineSolarAltitude, LocalMet->VICSin, LocalMet->Sin, LocalMet->SinBeam, LocalMet->SinDiffuse, LocalMet->Lin, LocalMet->Tair, LocalVeg->Tcanopy, LocalSoil->TSurf, SType->Albedo, VType, LocalSnow, &LocalRad); crb->execute(); delete crb; /* calculate the actual aerodynamic resistances and wind speeds */ UpperWind = VType->U[0] * LocalMet->Wind; UpperRa = VType->Ra[0] / LocalMet->Wind; if (VType->OverStory == TRUE) { LowerWind = VType->U[1] * LocalMet->Wind; LowerRa = VType->Ra[1] / LocalMet->Wind; } else { LowerWind = UpperWind; LowerRa = UpperRa; } /* Leaf drip impact*/ /* Find corresponding fall velocity for overstory and understory heights by weighting scheme */ /* related files: independent module */ // if (VType->OverStory){ // /* staring at 1 assumes the overstory height > 0.5 m */ // for (i = 1; i <= 17; i++ ) { // if (VType->Height[0] < CanopyHeight[i]) { // LD_FallVelocity = ((VType->Height[0] - CanopyHeight[i-1]) // *FallVelocity[i] + // (CanopyHeight[i] - VType->Height[0])*FallVelocity[i-1]) / // (CanopyHeight[i] - CanopyHeight[i-1]); // } // } // if (VType->UnderStory) { // /* ending at 16 assumes the understory height < 16 m */ // for (i = 0; i <= 16; i++) { // if (VType->Height[1] < CanopyHeight[i]) { // LD_FallVelocity = ((VType->Height[1] - CanopyHeight[i])*FallVelocity[i] + // (CanopyHeight[i+1] - VType->Height[1])*FallVelocity[i-1]) / // (CanopyHeight[i+1] - CanopyHeight[i]); // } // } // } // } // else if (VType->UnderStory) { // /* ending at 16 assumes the understory height < 16 m */ // for (i = 0; i <= 16; i++) { // if (VType->Height[0] < CanopyHeight[i]) { // LD_FallVelocity = ((VType->Height[0] - CanopyHeight[i])*FallVelocity[i] + // (CanopyHeight[i+1] - VType->Height[0])*FallVelocity[i-1]) / // (CanopyHeight[i+1] - CanopyHeight[i]); // } // } // } // else LD_FallVelocity = 0; CLeafDripImpact * cLeafDripImpact = new CLeafDripImpact(); cLeafDripImpact->init(VType, CanopyHeight, FallVelocity); cLeafDripImpact->execute(); cLeafDripImpact->query(&LD_FallVelocity); delete cLeafDripImpact; /* RainFall impact */ /* 3600 is conversion factor (number of seconds per hour) */ /* related files: independant */ // if (LocalPrecip->RainFall > 0.) { // RainfallIntensity = LocalPrecip->RainFall * (1./MMTOM) * (3600./Dt); // // /* Momentum is later weighted with the overstory/understory fraction */ // if (RainfallIntensity < 10.) // MS_Index = 0; // else if (RainfallIntensity >= 10. && RainfallIntensity < 100.) // MS_Index = floor((RainfallIntensity + 49)/50); // else // MS_Index = 3; // // /* Eq. 1, Wicks and Bathurst (1996) */ // MS_Rainfall = alpha[MS_Index] * pow(RainfallIntensity, beta[MS_Index]); // // /* Calculating mediam raindrop diameter after Laws and Parsons (1943) */ // LocalPrecip->Dm = 0.00124 * pow((double)RainfallIntensity, 0.182); // } // else { // MS_Rainfall = 0; // LocalPrecip->Dm = LEAF_DRIP_DIA; // } CRainfallImpact * cRainfallImpact = new CRainfallImpact(); cRainfallImpact->init(LocalPrecip->RainFall, Dt); cRainfallImpact->execute(); cRainfallImpact->query(&MS_Rainfall, &(LocalPrecip->Dm)); delete cRainfallImpact; /* calculate the amount of interception storage, and the amount of throughfall. Of course this only needs to be done if there is vegetation present. */ /* related files: SnowInterception.c brent.h constants.h settings.h massenergy.h data.h Calendar.h snow.h functions.h DHSVMChannel.h getinit.h channel.h channel_grid.h RadiationBalance.c settings.h data.h Calendar.h DHSVMerror.h massenergy.h constants.h InterceptionStorage.c settings.h data.h Calendar.h DHSVMerror.h massenergy.h constants.h SnowMelt.c brent.h constants.h settings.h massenergy.h data.h Calendar.h functions.h DHSVMChannel.h getinit.h channel.h channel_grid.h snow.h */ #ifndef NO_SNOW if (VType->OverStory == TRUE && (LocalPrecip->IntSnow[0] || LocalPrecip->SnowFall > 0.0)) { // SnowInterception(y, x, Dt, VType->Fract[0], VType->LAI[0], // VType->MaxInt[0], VType->MaxSnowInt, VType->MDRatio, // VType->SnowIntEff, UpperRa, LocalMet->AirDens, // LocalMet->Eact, LocalMet->Lv, &LocalRad, LocalMet->Press, // LocalMet->Tair, LocalMet->Vpd, UpperWind, // &(LocalPrecip->RainFall), &(LocalPrecip->SnowFall), // &(LocalPrecip->IntRain[0]), &(LocalPrecip->IntSnow[0]), // &(LocalPrecip->TempIntStorage), // &(LocalSnow->CanopyVaporMassFlux), &(LocalVeg->Tcanopy), // &MeltEnergy, &(LocalPrecip->MomentSq), VType->Height, // VType->UnderStory, MS_Rainfall, LD_FallVelocity); CSnowInterception * cSnowInterception = new CSnowInterception(); cSnowInterception->init(y, x, Dt, VType->Fract[0], VType->LAI[0], VType->MaxInt[0], VType->MaxSnowInt, VType->MDRatio, VType->SnowIntEff, UpperRa, LocalMet->AirDens, LocalMet->Eact, LocalMet->Lv, &LocalRad, LocalMet->Press, LocalMet->Tair, LocalMet->Vpd, UpperWind, &(LocalPrecip->RainFall), &(LocalPrecip->SnowFall), &(LocalPrecip->IntRain[0]), &(LocalPrecip->IntSnow[0]), &(LocalPrecip->TempIntStorage), &(LocalSnow->CanopyVaporMassFlux), &(LocalVeg->Tcanopy), &MeltEnergy, &(LocalPrecip->MomentSq), VType->Height, VType->UnderStory, MS_Rainfall, LD_FallVelocity); delete cSnowInterception; MoistureFlux -= LocalSnow->CanopyVaporMassFlux; /* Because we now have a new estimate of the canopy temperature we can recalculate the longwave balance */ if (LocalSnow->HasSnow == TRUE) Tsurf = LocalSnow->TSurf; else if (HeatFluxOption == TRUE) Tsurf = LocalSoil->TSurf; else Tsurf = LocalMet->Tair; LongwaveBalance(Options, VType->OverStory, VType->Fract[0], LocalMet->Lin, LocalVeg->Tcanopy, Tsurf, &LocalRad); } else if (VType->NVegLayers > 0) { LocalVeg->Tcanopy = LocalMet->Tair; LocalSnow->CanopyVaporMassFlux = 0.0; LocalPrecip->TempIntStorage = 0.0; // InterceptionStorage(VType->NVegLayers, NVegLActual, VType->MaxInt, // VType->Fract, LocalPrecip->IntRain, // &(LocalPrecip->RainFall), &(LocalPrecip->MomentSq), // VType->Height, VType->UnderStory, Dt, MS_Rainfall, // LD_FallVelocity); CInterceptionStorage * cInterceptionStorage = new CInterceptionStorage(); cInterceptionStorage->init(VType->NVegLayers, NVegLActual, VType->MaxInt, VType->Fract, LocalPrecip->IntRain, &(LocalPrecip->RainFall), &(LocalPrecip->MomentSq), VType->Height, VType->UnderStory, Dt, MS_Rainfall, LD_FallVelocity); cInterceptionStorage->execute(); delete cInterceptionStorage; } else { /* If no vegetation, kinetic energy is all due to direct precipitation. */ if(LocalPrecip->RainFall > 0.0) LocalPrecip->MomentSq = MS_Rainfall; } /* If snow on the ground, assume no overland flow erosion. */ if(LocalSnow->HasSnow) LocalPrecip->MomentSq = 0.0; /* if snow is present, simulate the snow pack dynamics */ if (LocalSnow->HasSnow || LocalPrecip->SnowFall > 0.0) { if (VType->OverStory == TRUE) { SnowLongIn = LocalRad.LongIn[1]; SnowNetShort = LocalRad.NetShort[1]; } else { SnowLongIn = LocalRad.LongIn[0]; SnowNetShort = LocalRad.NetShort[0]; } SnowWind = VType->USnow * LocalMet->Wind; SnowRa = VType->RaSnow / LocalMet->Wind; // LocalSnow->Outflow = // SnowMelt(y, x, Dt, 2. + Z0_SNOW, 0.f, Z0_SNOW, SnowRa, LocalMet->AirDens, // LocalMet->Eact, LocalMet->Lv, SnowNetShort, SnowLongIn, // LocalMet->Press, LocalPrecip->RainFall, LocalPrecip->SnowFall, // LocalMet->Tair, LocalMet->Vpd, SnowWind, // &(LocalSnow->PackWater), &(LocalSnow->SurfWater), // &(LocalSnow->Swq), &(LocalSnow->VaporMassFlux), // &(LocalSnow->TPack), &(LocalSnow->TSurf), &MeltEnergy); CSnowMelt * cSnowMelt = new CSnowMelt(); cSnowMelt->init(y, x, Dt, 2. + Z0_SNOW, 0.f, Z0_SNOW, SnowRa, LocalMet->AirDens, LocalMet->Eact, LocalMet->Lv, SnowNetShort, SnowLongIn, LocalMet->Press, LocalPrecip->RainFall, LocalPrecip->SnowFall, LocalMet->Tair, LocalMet->Vpd, SnowWind, &(LocalSnow->PackWater), &(LocalSnow->SurfWater), &(LocalSnow->Swq), &(LocalSnow->VaporMassFlux), &(LocalSnow->TPack), &(LocalSnow->TSurf), &MeltEnergy, &(LocalSnow->Outflow)); cSnowMelt->execute(); delete cSnowMelt; /* Rainfall was added to SurfWater of the snow pack and has to be set to zero */ LocalPrecip->RainFall = 0.0; MoistureFlux -= LocalSnow->VaporMassFlux; /* Because we now have a new estimate of the snow surface temperature we can recalculate the longwave balance */ Tsurf = LocalSnow->TSurf; LongwaveBalance(Options, VType->OverStory, VType->Fract[0], LocalMet->Lin, LocalVeg->Tcanopy, Tsurf, &LocalRad); } else { LocalSnow->Outflow = 0.0; LocalSnow->VaporMassFlux = 0.0; } /* Determine whether a snow pack is still present, or whether everything has melted */ if (LocalSnow->Swq > 0.0) LocalSnow->HasSnow = TRUE; else LocalSnow->HasSnow = FALSE; /*do the glacier add */ if (LocalSnow->Swq < 1.0 && VType->Index == GLACIER) { printf("resetting glacier swe of %f to 5.0 meters\n", LocalSnow->Swq); LocalSnow->Glacier += (5.0 - LocalSnow->Swq); LocalSnow->Swq = 5.0; LocalSnow->TPack = 0.0; LocalSnow->TSurf = 0.0; } #endif #ifndef NO_ET /* calculate the amount of evapotranspiration from each vegetation layer above the ground/soil surface. Also calculate the total amount of evapotranspiration from the vegetation */ /* related files: EvapoTranspiration.c settings.h data.h Calendar.h DHSVMerror.h massenergy.h constants.h SoilEvaporation.c settings.h DHSVMerror.h massenergy.h data.h Calendar.h constants.h */ if (VType->OverStory == TRUE) { Rp = VISFRACT * LocalRad.NetShort[0]; NetRadiation = LocalRad.NetShort[0] + LocalRad.LongIn[0] - 2 * VType->Fract[0] * LocalRad.LongOut[0]; // EvapoTranspiration(0, Dt, LocalMet, NetRadiation, Rp, VType, SType, // MoistureFlux, LocalSoil, &(LocalPrecip->IntRain[0]), // LocalEvap, LocalNetwork->Adjust, UpperRa); CEvapoTranspiration* cEvapoTranspiration = new CEvapoTranspiration(); cEvapoTranspiration->init(0, Dt, LocalMet, NetRadiation, Rp, VType, SType, MoistureFlux, LocalSoil, &(LocalPrecip->IntRain[0]), LocalEvap, LocalNetwork->Adjust, UpperRa); cEvapoTranspiration->execute(); delete cEvapoTranspiration; MoistureFlux += LocalEvap->EAct[0] + LocalEvap->EInt[0]; if (LocalSnow->HasSnow != TRUE && VType->UnderStory == TRUE) { Rp = VISFRACT * LocalRad.NetShort[1]; NetRadiation = LocalRad.NetShort[1] + LocalRad.LongIn[1] - VType->Fract[1] * LocalRad.LongOut[1]; EvapoTranspiration(1, Dt, LocalMet, NetRadiation, Rp, VType, SType, MoistureFlux, LocalSoil, &(LocalPrecip->IntRain[1]), LocalEvap, LocalNetwork->Adjust, LowerRa); MoistureFlux += LocalEvap->EAct[1] + LocalEvap->EInt[1]; } else if (VType->UnderStory == TRUE) { LocalEvap->EAct[1] = 0.; LocalEvap->EInt[1] = 0.; } } /* end if(VType->OverStory == TRUE) */ else if (LocalSnow->HasSnow != TRUE && VType->UnderStory == TRUE) { Rp = VISFRACT * LocalRad.NetShort[0]; NetRadiation = LocalRad.NetShort[0] + LocalRad.LongIn[0] - VType->Fract[0] * LocalRad.LongOut[0]; EvapoTranspiration(0, Dt, LocalMet, NetRadiation, Rp, VType, SType, MoistureFlux, LocalSoil, &(LocalPrecip->IntRain[0]), LocalEvap, LocalNetwork->Adjust, LowerRa); MoistureFlux += LocalEvap->EAct[0] + LocalEvap->EInt[0]; } else if (VType->UnderStory == TRUE) { LocalEvap->EAct[0] = 0.; LocalEvap->EInt[0] = 0.; } /* Calculate soil evaporation from the upper soil layer if no snow is present and there is no understory */ if (LocalSnow->HasSnow != TRUE && VType->UnderStory != TRUE) { if (VType->OverStory == TRUE) NetRadiation = LocalRad.NetShort[1] + LocalRad.LongIn[1] - LocalRad.LongOut[1]; else NetRadiation = LocalRad.NetShort[0] + LocalRad.LongIn[0] - LocalRad.LongOut[0]; // LocalEvap->EvapSoil = // SoilEvaporation(Dt, LocalMet->Tair, LocalMet->Slope, LocalMet->Gamma, // LocalMet->Lv, LocalMet->AirDens, LocalMet->Vpd, // NetRadiation, LowerRa, MoistureFlux, SType->Porosity[0], // SType->Ks[0], SType->Press[0], SType->PoreDist[0], // VType->RootDepth[0], &(LocalSoil->Moist[0]), // LocalNetwork->Adjust[0]); { CSoilEvaporation * cSoilEvaporation = new CSoilEvaporation(); cSoilEvaporation->init(Dt, LocalMet->Tair, LocalMet->Slope, LocalMet->Gamma, LocalMet->Lv, LocalMet->AirDens, LocalMet->Vpd, NetRadiation, LowerRa, MoistureFlux, SType->Porosity[0], SType->Ks[0], SType->Press[0], SType->PoreDist[0], VType->RootDepth[0], &(LocalSoil->Moist[0]), LocalNetwork->Adjust[0], &(LocalEvap->EvapSoil)); cSoilEvaporation->execute(); delete cSoilEvaporation; } } else LocalEvap->EvapSoil = 0.0; MoistureFlux += LocalEvap->EvapSoil; LocalEvap->ETot += LocalEvap->EvapSoil; #endif /* add the water that was not intercepted to the upper soil layer */ #ifndef NO_SOIL /* This has been modified so that PercArea for infiltration is calculated locally to account for the fact that some cells have roads and streams. I am not sure if the old PercArea (which does not account for the fact that some cells have roads and streams) needs to remain the same. Currently, the old PercArea is passed to UnsaturatedFlow */ MaxRoadbedInfiltration = 0.; MaxInfiltration = 0.; ChannelWater = 0.; RoadWater = 0.; SurfaceWater = 0.; PercArea = 1.; RoadbedInfiltration = 0.; /* ChannelWater is precipitation falling on the channel */ /* (if there is no road, LocalNetwork->RoadArea = 0) */ if (channel_grid_has_channel(ChannelData->stream_map, x, y)){ PercArea = 1. - (LocalNetwork->Area + LocalNetwork->RoadArea)/(DX*DY); ChannelWater = LocalNetwork->Area/(DX*DY) * LocalPrecip->RainFall; } /* If there is a road and no channel, the PercArea is based on the road only */ else if (channel_grid_has_channel(ChannelData->road_map, x, y)){ PercArea = 1. - (LocalNetwork->RoadArea)/(DX*DY); MaxRoadbedInfiltration = (1. - PercArea) * LocalNetwork->MaxInfiltrationRate * Dt; } /* SurfaceWater is rain falling on the hillslope + snowmelt on the hillslope (there is no snowmelt on the channel) + existing IExcess */ /* related files: independant */ // SurfaceWater = (PercArea * LocalPrecip->RainFall) + // ((1. - (LocalNetwork->RoadArea)/(DX*DY)) * LocalSnow->Outflow) + // LocalSoil->IExcess; CSurfaceWater * cSurfaceWater = new CSurfaceWater(); //float m_PercArea, float m_Rainfall, float m_RoadArea, float m_DX, float m_DY, float m_Outflow, float m_IExcess cSurfaceWater->init(PercArea,LocalPrecip->RainFall,LocalNetwork->RoadArea, DX, DY, LocalSnow->Outflow, LocalSoil->IExcess ); cSurfaceWater->execute(); cSurfaceWater->query(&SurfaceWater); delete cSurfaceWater; /* RoadWater is rain falling on the road surface + snowmelt on the road surface + existing Road IExcess (Existing road IExcess = 0). WORK IN PROGRESS*/ /* related files: independant */ // RoadWater = (LocalNetwork->RoadArea/(DX*DY) * // (LocalPrecip->RainFall + LocalSnow->Outflow)) + // LocalNetwork->IExcess; CRoadWater * cRoadWater = new CRoadWater(); cRoadWater->init(LocalNetwork->RoadArea, DX, DY, LocalPrecip->RainFall, LocalSnow->Outflow, LocalNetwork->IExcess); cRoadWater->execute(); cRoadWater->query(&RoadWater); delete cRoadWater; /* Infiltration module * related files or modules: SurfaceWater, RoadWater,UnsaturatedFlow.c constants.h settings.h functions.h data.h Calendar.h DHSVMChannel.h getinit.h channel.h channel_grid.h soilmoisture.h */ if(InfiltOption == STATIC) MaxInfiltration = (1. - VType->ImpervFrac) * PercArea * SType->MaxInfiltrationRate * Dt; else { /* InfiltOption == DYNAMIC Dynamic Infiltration Capacity after Parlange and Smith 1978, as used in KINEROS and THALES */ Infiltration = 0.0; if (SurfaceWater > 0.) { /* Infiltration is a function of the amount of water infiltrated since the storm started */ if (LocalPrecip->PrecipStart){ LocalSoil->MoistInit = LocalSoil->Moist[0]; LocalSoil->InfiltAcc = 0.0; } /* Check that the B parameter > 0 */ if ((LocalSoil->InfiltAcc > 0.) && (SType->Porosity[0] > LocalSoil->MoistInit)) { B = (SType->Porosity[0] - LocalSoil->MoistInit) * (SType->G_Infilt + SurfaceWater); Infiltrability = SType->Ks[0] * exp((LocalSoil->InfiltAcc)/B) / (exp((LocalSoil->InfiltAcc)/B) - 1.); } else Infiltrability = SurfaceWater/Dt ; MaxInfiltration = Infiltrability * PercArea * (1. - VType->ImpervFrac) * Dt; LocalPrecip->PrecipStart = FALSE; }/* end if (SurfaceWater > 0.) */ else LocalPrecip->PrecipStart = TRUE; } /* end Dynamic MaxInfiltration calculation */ Infiltration = (1. - VType->ImpervFrac) * SurfaceWater; if (Infiltration > MaxInfiltration) Infiltration = MaxInfiltration; RoadbedInfiltration = RoadWater; if (RoadbedInfiltration > MaxRoadbedInfiltration) RoadbedInfiltration = MaxRoadbedInfiltration; if (RoadRouteOption == FALSE) LocalSoil->IExcess = SurfaceWater - Infiltration + RoadWater - RoadbedInfiltration; else { LocalSoil->IExcess = SurfaceWater - Infiltration; LocalNetwork->IExcess = RoadWater - RoadbedInfiltration; if (LocalNetwork->IExcess < 0.){ LocalNetwork->IExcess = 0.; printf("MEB: NetIExcess(%f), reset to 0\n", LocalNetwork->IExcess); } } if (LocalSoil->IExcess < 0.){ printf("MEB: SoilIExcess(%f), reset to 0\n", LocalSoil->IExcess); LocalSoil->IExcess = 0.; } /*Add water that hits the channel network to the channel network */ /* related files: channel_grid.c channel_grid.h channel.h settings.h data.h Calendar.h tableio.h errorhandler.h DHSVMChannel.h getinit.h */ if (ChannelWater > 0.){ channel_grid_inc_inflow(ChannelData->stream_map, x, y, ChannelWater * DX * DY); LocalSoil->ChannelInt += ChannelWater; } /* Calculate unsaturated soil water movement, and adjust soil water table depth */ /* related files: UnsaturatedFlow.c constants.h settings.h functions.h data.h Calendar.h DHSVMChannel.h getinit.h channel.h channel_grid.h soilmoisture.h */ // LocalSoil->Depth, LocalNetwork->Area, VType->RootDepth, // SType->Ks, SType->PoreDist, SType->Porosity, SType->FCap, // LocalSoil->Perc, LocalNetwork->PercArea, // LocalNetwork->Adjust, LocalNetwork->CutBankZone, // LocalNetwork->BankHeight, &(LocalSoil->TableDepth), // &(LocalSoil->IExcess), LocalSoil->Moist, RoadRouteOption, // InfiltOption, &(LocalNetwork->IExcess)); CUnsaturatedFlow * cUnsaturatedFlow = new CUnsaturatedFlow(); cUnsaturatedFlow->init(Dt, DX, DY, Infiltration, RoadbedInfiltration, LocalSoil->SatFlow, SType->NLayers, LocalSoil->Depth, LocalNetwork->Area, VType->RootDepth, SType->Ks, SType->PoreDist, SType->Porosity, SType->FCap, LocalSoil->Perc, LocalNetwork->PercArea, LocalNetwork->Adjust, LocalNetwork->CutBankZone, LocalNetwork->BankHeight, &(LocalSoil->TableDepth), &(LocalSoil->IExcess), LocalSoil->Moist, RoadRouteOption, InfiltOption, &(LocalNetwork->IExcess)); cUnsaturatedFlow->execute(); delete cUnsaturatedFlow; /* Infiltration is updated in UnsaturatedFlow and accumulated below */ if ((InfiltOption == DYNAMIC) && (SurfaceWater > 0.)) LocalSoil->InfiltAcc += Infiltration; if (HeatFluxOption == TRUE) { if (LocalSnow->HasSnow == TRUE) { Reference = 2. + Z0_SNOW; Roughness = Z0_SNOW; } else { Reference = 2. + Z0_GROUND; Roughness = Z0_GROUND; } /* Calculate sensible heat flux related file: SensibleHeatFlux.c settings.h data.h Calendar.h DHSVMerror.h massenergy.h constants.h brent.h functions.h DHSVMChannel.h getinit.h channel.h channel_grid.h */ // SensibleHeatFlux(y, x, Dt, LowerRa, Reference, 0.0f, Roughness, // LocalMet, LocalRad.PixelNetShort, LocalRad.PixelLongIn, // MoistureFlux, SType->NLayers, VType->RootDepth, // SType, MeltEnergy, LocalSoil); CSensibleHeatFlux *cSensibleHeatFlux = new CSensibleHeatFlux(); cSensibleHeatFlux->init(y, x, Dt, LowerRa, Reference, 0.0f, Roughness, LocalMet, LocalRad.PixelNetShort, LocalRad.PixelLongIn, MoistureFlux, SType->NLayers, VType->RootDepth, SType, MeltEnergy, LocalSoil); cSensibleHeatFlux->execute(); delete cSensibleHeatFlux; Tsurf = LocalSoil->TSurf; /* Calculate long wave balance related files: RadiationBalance.c settings.h data.h Calendar.h DHSVMerror.h massenergy.h constants.h */ LongwaveBalance(Options, VType->OverStory, VType->Fract[0], LocalMet->Lin, LocalVeg->Tcanopy, Tsurf, &LocalRad); } else /* Calculate No sensible heat flux related files: SensibleHeatFlux.c settings.h data.h Calendar.h DHSVMerror.h massenergy.h constants.h brent.h functions.h DHSVMChannel.h getinit.h channel.h channel_grid.h */ // NoSensibleHeatFlux(Dt, LocalMet, MoistureFlux, LocalSoil); { CNoSensibleHeatFlux *cNoSensibleHeatFlux = new CNoSensibleHeatFlux(); cNoSensibleHeatFlux->init(Dt, LocalMet, MoistureFlux, LocalSoil); cNoSensibleHeatFlux->execute(); delete cNoSensibleHeatFlux; } #endif /* add the components of the radiation balance for the current pixel to the total */ /* related files: AggregateRadiation.c settings.h data.h Calendar.h massenergy.h */ // AggregateRadiation(MaxVegLayers, VType->NVegLayers, &LocalRad, TotalRad); CAggregateRadiation *cAggregateRadiation = new CAggregateRadiation(); cAggregateRadiation->init(MaxVegLayers, VType->NVegLayers, &LocalRad, TotalRad); cAggregateRadiation->execute(); delete cAggregateRadiation; /* For RBM model, save the energy fluxes for outputs */ /* related files: channel_grid.c channel_grid.h channel.h settings.h data.h Calendar.h tableio.h errorhandler.h DHSVMChannel.h getinit.h */ if (Options->StreamTemp) { if (channel_grid_has_channel(ChannelData->stream_map, x, y)) channel_grid_inc_other(ChannelData->stream_map, x, y, &LocalRad, LocalMet, skyview[y][x]); } }