vic/vic_run/src/canopy_evap.c
double
canopy_evap(layer_data_struct *layer,
            veg_var_struct    *veg_var,
            bool               CALC_EVAP,
            unsigned short     veg_class,
            double            *Wdew,
            double             delta_t,
            double             rad,
            double             vpd,
            double             net_short,
            double             air_temp,
            double             ra,
            double             elevation,
            double             ppt,
            double            *Wmax,
            double            *Wcr,
            double            *Wpwp,
            double            *frost_fract,
            double            *root,
            double            *dryFrac,
            double             shortwave,
            double             Catm,
            double            *CanopLayerBnd)
{
    /** declare global variables **/
    extern veg_lib_struct *vic_run_veg_lib;
    extern option_struct   options;

    /** declare local variables **/
    size_t                 i;
    double                 f;   /* fraction of time step used to fill canopy */
    double                 throughfall;
    double                 Evap;
    double                 tmp_Evap;
    double                 canopyevap;
    double                 tmp_Wdew;
    double                 layertransp[MAX_LAYERS];
    double                 rc;

    Evap = 0;

    /* Initialize variables */
    for (i = 0; i < options.Nlayer; i++) {
        layertransp[i] = 0;
    }
    canopyevap = 0;
    throughfall = 0;
    tmp_Wdew = *Wdew;

    /****************************************************
       Compute Evaporation from Canopy Intercepted Water
    ****************************************************/

    veg_var->Wdew = tmp_Wdew;
    if (tmp_Wdew > veg_var->Wdmax) {
        throughfall = tmp_Wdew - veg_var->Wdmax;
        tmp_Wdew = veg_var->Wdmax;
    }

    rc = calc_rc((double) 0.0, net_short, vic_run_veg_lib[veg_class].RGL,
                 air_temp, vpd, veg_var->LAI, (double) 1.0, false);
    if (veg_var->LAI > 0) {
        canopyevap = pow((tmp_Wdew / veg_var->Wdmax), (2.0 / 3.0)) *
                     penman(air_temp, elevation, rad, vpd, ra, rc,
                            vic_run_veg_lib[veg_class].rarc) *
                     delta_t / CONST_CDAY;
    }
    else {
        canopyevap = 0;
    }

    if (canopyevap > 0.0 && delta_t == CONST_CDAY) {
        /** If daily time step, evap can include current precipitation **/
        f = min(1.0, ((tmp_Wdew + ppt) / canopyevap));
    }
    else if (canopyevap > 0.0) {
        /** If sub-daily time step, evap can not exceed current storage **/
        f = min(1.0, ((tmp_Wdew) / canopyevap));
    }
    else {
        f = 1.0;
    }
    canopyevap *= f;

    /* compute fraction of canopy that is dry */
    if (veg_var->Wdmax > 0) {
        *dryFrac = 1.0 - f * pow((tmp_Wdew / veg_var->Wdmax), (2.0 / 3.0));
    }
    else {
        *dryFrac = 0;
    }

    tmp_Wdew += ppt - canopyevap;
    if (tmp_Wdew < 0.0) {
        tmp_Wdew = 0.0;
    }
    if (tmp_Wdew <= veg_var->Wdmax) {
        throughfall += 0.0;
    }
    else {
        throughfall += tmp_Wdew - veg_var->Wdmax;
        tmp_Wdew = veg_var->Wdmax;
    }

    /*******************************************
       Compute Evapotranspiration from Vegetation
    *******************************************/
    if (CALC_EVAP) {
        transpiration(layer, veg_var, veg_class, rad, vpd, net_short,
                      air_temp, ra, *dryFrac, delta_t, elevation, Wmax, Wcr,
                      Wpwp, layertransp, frost_fract, root, shortwave, Catm,
                      CanopLayerBnd);
    }

    veg_var->canopyevap = canopyevap;
    veg_var->throughfall = throughfall;
    veg_var->Wdew = tmp_Wdew;
    tmp_Evap = canopyevap;
    for (i = 0; i < options.Nlayer; i++) {
        layer[i].transp = layertransp[i];
        tmp_Evap += layertransp[i];
    }

    Evap += tmp_Evap / (MM_PER_M * delta_t);

    return (Evap);
}
/******************************************************************************
 * @brief    Calculation of evaporation from the canopy, including the
 *           possibility of potential evaporation exhausting ppt+canopy storage
 *****************************************************************************/
@brief    Calculation of evaporation from the canopy, including the
possibility of potential evaporation exhausting ppt+canopy storage
@brief Calculation of evaporation from the canopy including the possibility of potential evaporation exhausting ppt + canopy storage
double
canopy_evap(layer_data_struct *layer,
            veg_var_struct    *veg_var,
            bool               CALC_EVAP,
            unsigned short     veg_class,
            double            *Wdew,
            double             delta_t,
            double             rad,
            double             vpd,
            double             net_short,
            double             air_temp,
            double             ra,
            double             elevation,
            double             ppt,
            double            *Wmax,
            double            *Wcr,
            double            *Wpwp,
            double            *frost_fract,
            double            *root,
            double            *dryFrac,
            double             shortwave,
            double             Catm,
            double            *CanopLayerBnd)
{
    extern veg_lib_struct *vic_run_veg_lib;
    extern option_struct   options;
    size_t                 i;
    double                 f;   
    double                 throughfall;
    double                 Evap;
    double                 tmp_Evap;
    double                 canopyevap;
    double                 tmp_Wdew;
    double                 layertransp[MAX_LAYERS];
    double                 rc;
    Evap = 0;
    for (i = 0; i < options.Nlayer; i++) {
        layertransp[i] = 0;
    }
    canopyevap = 0;
    throughfall = 0;
    tmp_Wdew = *Wdew;
    veg_var->Wdew = tmp_Wdew;
    if (tmp_Wdew > veg_var->Wdmax) {
        throughfall = tmp_Wdew - veg_var->Wdmax;
        tmp_Wdew = veg_var->Wdmax;
    }
    rc = calc_rc((double) 0.0, net_short, vic_run_veg_lib[veg_class].RGL,
                 air_temp, vpd, veg_var->LAI, (double) 1.0, false);
    if (veg_var->LAI > 0) {
        canopyevap = pow((tmp_Wdew / veg_var->Wdmax), (2.0 / 3.0)) *
                     penman(air_temp, elevation, rad, vpd, ra, rc,
                            vic_run_veg_lib[veg_class].rarc) *
                     delta_t / CONST_CDAY;
    }
    else {
        canopyevap = 0;
    }
    if (canopyevap > 0.0 && delta_t == CONST_CDAY) {
        f = min(1.0, ((tmp_Wdew + ppt) / canopyevap));
    }
    else if (canopyevap > 0.0) {
        f = min(1.0, ((tmp_Wdew) / canopyevap));
    }
    else {
        f = 1.0;
    }
    canopyevap *= f;
    if (veg_var->Wdmax > 0) {
        *dryFrac = 1.0 - f * pow((tmp_Wdew / veg_var->Wdmax), (2.0 / 3.0));
    }
    else {
        *dryFrac = 0;
    }
    tmp_Wdew += ppt - canopyevap;
    if (tmp_Wdew < 0.0) {
        tmp_Wdew = 0.0;
    }
    if (tmp_Wdew <= veg_var->Wdmax) {
        throughfall += 0.0;
    }
    else {
        throughfall += tmp_Wdew - veg_var->Wdmax;
        tmp_Wdew = veg_var->Wdmax;
    }
    if (CALC_EVAP) {
        transpiration(layer, veg_var, veg_class, rad, vpd, net_short,
                      air_temp, ra, *dryFrac, delta_t, elevation, Wmax, Wcr,
                      Wpwp, layertransp, frost_fract, root, shortwave, Catm,
                      CanopLayerBnd);
    }
    veg_var->canopyevap = canopyevap;
    veg_var->throughfall = throughfall;
    veg_var->Wdew = tmp_Wdew;
    tmp_Evap = canopyevap;
    for (i = 0; i < options.Nlayer; i++) {
        layer[i].transp = layertransp[i];
        tmp_Evap += layertransp[i];
    }
    Evap += tmp_Evap / (MM_PER_M * delta_t);
    return (Evap);
}
double canopy_evap ( layer_data_struct * layer , veg_var_struct * veg_var , bool CALC_EVAP , unsigned short veg_class , double * Wdew , double delta_t , double rad , double vpd , double net_short , double air_temp , double ra , double elevation , double ppt , double * Wmax , double * Wcr , double * Wpwp , double * frost_fract , double * root , double * dryFrac , double shortwave , double Catm , double * CanopLayerBnd ) { extern veg_lib_struct * vic_run_veg_lib ; extern option_struct options ; size_t i ; double f ; double throughfall ; double Evap ; double tmp_Evap ; double canopyevap ; double tmp_Wdew ; double layertransp [ MAX_LAYERS ] ; double rc ; Evap = 0 ; for ( i = 0 ; i < options . Nlayer ; i ++ ) { layertransp [ i ] = 0 ; } canopyevap = 0 ; throughfall = 0 ; tmp_Wdew = * Wdew ; veg_var -> Wdew = tmp_Wdew ; if ( tmp_Wdew > veg_var -> Wdmax ) { throughfall = tmp_Wdew - veg_var -> Wdmax ; tmp_Wdew = veg_var -> Wdmax ; } rc = calc_rc ( ( double ) 0.0 , net_short , vic_run_veg_lib [ veg_class ] . RGL , air_temp , vpd , veg_var -> LAI , ( double ) 1.0 , false ) ; if ( veg_var -> LAI > 0 ) { canopyevap = pow ( ( tmp_Wdew / veg_var -> Wdmax ) , ( 2.0 / 3.0 ) ) * penman ( air_temp , elevation , rad , vpd , ra , rc , vic_run_veg_lib [ veg_class ] . rarc ) * delta_t / CONST_CDAY ; } else { canopyevap = 0 ; } if ( canopyevap > 0.0 && delta_t == CONST_CDAY ) { f = min ( 1.0 , ( ( tmp_Wdew + ppt ) / canopyevap ) ) ; } else if ( canopyevap > 0.0 ) { f = min ( 1.0 , ( ( tmp_Wdew ) / canopyevap ) ) ; } else { f = 1.0 ; } canopyevap *= f ; if ( veg_var -> Wdmax > 0 ) { * dryFrac = 1.0 - f * pow ( ( tmp_Wdew / veg_var -> Wdmax ) , ( 2.0 / 3.0 ) ) ; } else { * dryFrac = 0 ; } tmp_Wdew += ppt - canopyevap ; if ( tmp_Wdew < 0.0 ) { tmp_Wdew = 0.0 ; } if ( tmp_Wdew <= veg_var -> Wdmax ) { throughfall += 0.0 ; } else { throughfall += tmp_Wdew - veg_var -> Wdmax ; tmp_Wdew = veg_var -> Wdmax ; } if ( CALC_EVAP ) { transpiration ( layer , veg_var , veg_class , rad , vpd , net_short , air_temp , ra , * dryFrac , delta_t , elevation , Wmax , Wcr , Wpwp , layertransp , frost_fract , root , shortwave , Catm , CanopLayerBnd ) ; } veg_var -> canopyevap = canopyevap ; veg_var -> throughfall = throughfall ; veg_var -> Wdew = tmp_Wdew ; tmp_Evap = canopyevap ; for ( i = 0 ; i < options . Nlayer ; i ++ ) { layer [ i ] . transp = layertransp [ i ] ; tmp_Evap += layertransp [ i ] ; } Evap += tmp_Evap / ( MM_PER_M * delta_t ) ; return ( Evap ) ; }
@brief    Calculation of evaporation from the canopy, including the
           possibility of potential evaporation exhausting ppt+canopy storage
@brief Calculation of evaporation from the canopy including the possibility of potential evaporation exhausting ppt + canopy storage
/** declare global variables **/ /** declare local variables **/ /* fraction of time step used to fill canopy */ /* Initialize variables */ /****************************************************
       Compute Evaporation from Canopy Intercepted Water
    ****************************************************/ /** If daily time step, evap can include current precipitation **/ /** If sub-daily time step, evap can not exceed current storage **/ /* compute fraction of canopy that is dry */ /*******************************************
       Compute Evapotranspiration from Vegetation
    *******************************************/