/Users/huttone/Devel/sedflux-new/sedflux/trunk/ew/hydrotrend/hydrocalqsnew.c

Go to the documentation of this file.
00001 /*
00002  *  Hydrocalqsnew.c
00003  *
00004  *  Calculates the Qsbarnew.
00005  *  Author:    A.J. Kettner  (January 2003)
00006  *
00007  *
00008  *  Variable    Def.Location    Type    Units   Usage
00009  *  --------    ------------    ----    -----   -----
00010  *  err                 various                 int             -               error flag, halts program
00011  *  p                   various                 int             -               counter for the outlets  
00012  *  Qsgrandtotaloutlettot Hydrocalqsnew.c double kg/s total Qs of all outlets
00013  *
00014  */
00015 
00016 #include <stdio.h>
00017 #include "hydroparams.h"
00018 #include "hydrotimeser.h"
00019 #include "hydroclimate.h"
00020 #include "hydroinout.h"
00021 
00022 /*----------------------
00023  *  Start main program
00024  *----------------------*/
00025 int hydrocalqsnew(void)
00026 {
00027 
00028 /*-------------------
00029  *  Local Variables
00030  *-------------------*/
00031         int err, p;
00032         double Qsgrandtotaloutlettot;
00033 
00034 /*------------------------
00035  *  Initialize variables
00036  *------------------------*/    
00037         err  = 0;
00038         Qsgrandtotaloutlettot = 0.0;
00039 
00040 /*--------------------------------------------------
00041  *  Calculate mean Qs and calculate the difference
00042  *  between mean Qs and Qsbar.
00043  *--------------------------------------------------*/  
00044         Qsmean[ep]      = Qsgrandtotal[ep] / (nyears[ep]*daysiy*dTOs);
00045         Qsbarnew[ep]= Qsbartot[ep] / Qsmean[ep];
00046         if ( outletmodelflag == 1 ){
00047                 for (p=0; p<maxnoutlet; p++)
00048                         Qsgrandtotaloutlettot += Qsgrandtotaloutlet[ep][p];
00049                 Qsbarnew2[ep] = ( 1.0 -  sedfilter[ep]) * Qsbartot[ep] / ( Qsgrandtotaloutlettot / (nyears[ep]*daysiy*dTOs));
00050                 if (Qsbarnew2[ep] == 0.0)
00051                         printf("Qsbartot=%f, Qsgrandtot=%f, time=%f\n",Qsbartot[ep], Qsgrandtotaloutlettot, nyears[ep]*daysiy*dTOs);
00052         }
00053         return (err);
00054 
00055 }  /* end of Hydrocalqsnew */
00056 

Generated on Fri Jan 4 18:04:14 2008 for sedflux by  doxygen 1.5.2