/Users/huttone/Devel/sedflux-new/sedflux/trunk/ew/plume/plumelog.c

Go to the documentation of this file.
00001 //---
00002 //
00003 // This file is part of sedflux.
00004 //
00005 // sedflux is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation; either version 2 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // sedflux is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with sedflux; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 //
00019 //---
00020 
00021 /*
00022  * PlumeLog.c   Prints various informative paramters to a log file for Plume
00023  *
00024  *      Author:         M.D. Morehead
00025  *      Original:       May 1998
00026  *
00027  */
00028 #include "plumeinput.h"
00029 #include "plumevars.h"
00030 #include <stdio.h>
00031 #include <time.h>
00032 
00033 int plumelog( Plume_enviro *env , Plume_grid *grid , Plume_options *opt , Plume_mass_bal *mb )
00034 {
00035    time_t       tloc;
00036    int  nn;
00037    Plume_river river = *(env->river);
00038    Plume_ocean ocean = *(env->ocean);
00039    Plume_sediment *sedload = env->sed;
00040 
00041    // Temporary printout to insure proper values
00042 #ifdef DBG
00043    fprintf( fidlog," --- PlumeVars.H --- \n\n");
00044    fprintf( fidlog," Constants:\n\n");
00045    fprintf( fidlog," Seconds/day \t = %g \t dTOs \t (s/day) \n", dTOs);
00046    fprintf( fidlog," g \t\t = %g \t grv \t (m/s^2) \n", grv);
00047    fprintf( fidlog," Degree/radian \t = %g \t rTOdeg\t (-) \n", rTOdeg);
00048    fprintf( fidlog," Radian/degree \t = %g \t degTOr\t (-) \n", degTOr);
00049    fprintf( fidlog," sqrt(pi) \t = %g \t sqpi \t (-) \n", sqpi);
00050    fprintf( fidlog," sqrt(2) \t = %g \t sqtwo \t (-) \n", sqtwo);
00051    fprintf( fidlog," Earths rot. \t = %g \t omega \t (s) \n\n", omega);
00052 #endif
00053 
00054    // Model Coefficients
00055    fprintf( fidlog, " Model Coefficients:\n\n");
00056    fprintf( fidlog, " Albertson Constant \t = %g \t C1 \t (-) \n", C1);
00057    fprintf( fidlog, " Critical Velocity \t = %g \t ucrit \t (m/s) \n", ucrit);
00058    fprintf( fidlog, " Critical Conc. \t = %g \t pcrit \t (kg/m^3) \n", pcrit);
00059    fprintf( fidlog, " Length of Plug Flow \t = %g \t plg \t (river widths) \n", plg);
00060    fprintf( fidlog, " Plume spreading angle \t = %g \t\t sprd \t (deg) \n", rTOdeg*atan(sprd));
00061    fprintf( fidlog, " #Pts searched in PlumeCent = %d \t\t npts \t (-) \n", npts);
00062    fprintf( fidlog, " Max. Mass Balance Error = %g \t\t mberr \t (%%) \n\n", mberr);
00063 
00064    fprintf( fidlog, " --- Plume Inputs --- \n\n");
00065    fprintf( fidlog, " River:\t Discharge \t = %g \t river.Q \t (m^3/s) \n", river.Q);
00066    fprintf( fidlog, " \t Velocity \t = %g \t\t river.u0 \t (m/s) \n", river.u0);
00067    fprintf( fidlog, " \t Width \t\t = %g \t river.b0 \t (m) \n", river.b0);
00068    fprintf( fidlog, " \t Depth \t\t = %g \t river.d0 \t (m) \n", river.d0);
00069    fprintf( fidlog, " \t Angle \t\t = %g \t\t river.rma \t (deg) \n\n", river.rma);
00070 
00071    // Sediment Load Parameters
00072    fprintf( fidlog, " Sediment Load: ngrains = %d \n", env->n_grains);
00073    fprintf( fidlog, " \t Grain# \t Lambda (1/day)\t Rho (kg/m^3)\t Cs (kg/m^3) \n");
00074    for ( nn = 0 ; nn<env->n_grains ; nn++ )
00075    { 
00076       fprintf( fidlog, " \t %d \t\t %g \t\t %g \t %g \n", 
00077         nn, sedload[nn].lambda*dTOs, sedload[nn].rho, river.Cs[nn] );
00078    }
00079 
00080    // Ocean Parameters
00081    fprintf( fidlog, "\n Ocean:\t Conc. \t\t\t = %g \t ocean.Cw \t (kg/m^3) \n", ocean.Cw);
00082    fprintf( fidlog, " \t Valong \t\t = %g \t\t ocean.vo \t (m/s) \n", ocean.vo);
00083    fprintf( fidlog, " \t River Tracer Conc. \t = %g \t\t ocean.So \t (-) \n", ocean.So);
00084    fprintf( fidlog, " \t Ocean Tracer Conc. \t = %g \t ocean.Sw \t (-) \n", ocean.Sw);
00085    fprintf( fidlog, " \t Coast Current Width \t = %g \t\t ocean.cc \t (%% Li) \n\n", ocean.cc);
00086 
00087    // Other Parameters
00088    fprintf( fidlog, " Other Parameters:\n\n");
00089    fprintf( fidlog, " Straight Centerline Flag \t = %d \t\t strt \t (-) \n", opt->strt);
00090    fprintf( fidlog, " Fjord Flag \t\t\t = %d \t\t fjrd \t (-) \n", opt->fjrd );
00091    fprintf( fidlog, " Kelvin Wave Flag \t\t = %d \t\t kwf \t (-) \n", opt->kwf );
00092    fprintf( fidlog, " Latitude \t\t\t = %d \t lat \t (deg. N) \n\n", env->lat );
00093 
00094    // grids
00095    fprintf( fidlog, " --- Spatial Array --- \n\n");
00096    fprintf( fidlog, " Points in the River mouth \t = %d \t ndy \n", grid->ndy);
00097    fprintf( fidlog, " X points per Y points \t\t = %d \t ndx \n\n", grid->ndx);
00098    
00099    fprintf( fidlog, " Ygrid: # of Y points \t = %d \t\t ly \t (-) \n", grid->ly);
00100    fprintf( fidlog, " \t grid spacing \t = %f \t\t dy \t (m) \n", grid->dy);
00101    fprintf( fidlog, " \t Minimum \t = %g \t ymin \t (m) \n", grid->ymin);
00102    fprintf( fidlog, " \t Maximum \t = %g \t ymax \t (m) \n", grid->ymax);
00103    fprintf( fidlog, " \t Y=0 index \t = %d \t\t zy \t (-) \n", grid->zy );
00104    fprintf( fidlog, " \t yval[zy] \t = %g \t\t\t (m) \n\n", grid->yval[grid->zy] );
00105    
00106    fprintf( fidlog, " Xgrid: # of X points \t = %d \t\t lx \t (-) \n", grid->lx);
00107    fprintf( fidlog, " \t grid spacing \t = %f \t\t dx \t (m) \n", grid->dx);
00108    fprintf( fidlog, " \t Minimum \t = %g \t\t xmin \t (m) \n", grid->xmin);
00109    fprintf( fidlog, " \t Maximum \t = %g \t xmax \t (m) \n", grid->xmax);
00110    fprintf( fidlog, " \t X=0 index \t = %d \t\t zx \t (-) \n", grid->zx );
00111    fprintf( fidlog, " \t xval[zx] \t = %g \t\t\t (m) \n\n", grid->xval[grid->zx] );
00112 
00113    // Mass Balance Values
00114    fprintf( fidlog, " --- Mass Balance Summary --- \n\n");
00115    fprintf( fidlog, "Sediment Balance (kg/day):\n");
00116    fprintf( fidlog, "\t Qs discharging from river \t = %g \t Tsr \n", mb->Tsr);
00117    fprintf( fidlog, "\t Initial seafloor Deposit \t = %g \t Tsd[0] \n", mb->Tsd[0]);
00118    fprintf( fidlog, "\t Percent error \t\t\t = %g \t merr \n", mb->merr);
00119    fprintf( fidlog, "\t Modified seafloor Deposit\t = %g \t Tsd[1] \n\n", mb->Tsd[1]);
00120 
00121    if( opt->strt )
00122    {
00123       fprintf( fidlog, "Sediment Flux Balance (kg/s):\n");
00124       fprintf( fidlog, "\t Qs (river) = %g \t Qsr      \n", mb->Qsr);
00125       fprintf( fidlog, "\t Qs ( 5 km) = %g \t Qsw[0]   \n", mb->Qsw[0]);
00126       fprintf( fidlog, "\t Qs (10 km) = %g \t Qsw[1]   \n", mb->Qsw[1]);
00127       fprintf( fidlog, "\t Qs (20 km) = %g \t Qsw[2]   \n", mb->Qsw[2]);
00128       fprintf( fidlog, "\t Qs (40 km) = %g \t Qsw[3] \n\n", mb->Qsw[3]);
00129    }
00130 
00131    // Print the program stop time
00132    tloc = time( &tloc );
00133 
00134    /*
00135    localtime_r( &tloc, &timeptr );
00136    strftime( pst, TMLEN, "%X  %x", &timeptr );
00137    fprintf(fidlog,"\n Stop: %19s \n", pst);
00138    */
00139 
00140    fprintf(fidlog,"\n Stop: %s\n",ctime(&tloc));
00141    fprintf(fidlog," ------------------------- \n\n");
00142 
00143    return(0);
00144 
00145 } // end of PlumeLog
00146    

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