/Users/huttone/Devel/sedflux-new/sedflux/trunk/ew/plume/plumeread.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  * PlumeRead.c  Reads the input file for Plume
00023  *
00024  *
00025  *      Author:         M.D. Morehead
00026  *      Original:       April 1998
00027  *      Modified:       Sep 1998, MDM, Conversion for SEDFLUX3D
00028  *
00029  */
00030 #include "plumeinput.h"
00031 #include "plumevars.h"
00032 #include <stdio.h>
00033 
00034 int plumeread(FILE *fpin , Plume_enviro *env , Plume_grid *grid , Plume_options *opt )
00035 {
00036    char chs[120];
00037    int  ii;
00038    double lambdad; // temporary lambda (1/day)
00039    Plume_river *river = env->river;
00040    Plume_ocean *ocean = env->ocean;
00041 
00042    /*
00043     *   read in the River parameters
00044     *   lines 1-4
00045     */
00046    fscanf( fpin, "%lf", &river->Q);             fgets( chs, 120, fpin );
00047    fscanf( fpin, "%lf", &river->u0);            fgets( chs, 120, fpin );
00048    fscanf( fpin, "%lf", &river->rdirection);    fgets( chs, 120, fpin );
00049    fscanf( fpin, "%lf", &river->b0);            fgets( chs, 120, fpin );
00050    fscanf( fpin, "%lf", &river->rma);           fgets( chs, 120, fpin );
00051    /*
00052     *   Sediment Load Parameters
00053     *   line 5
00054     *   lines 6-8 (multiple sets)
00055     */
00056    fscanf( fpin, "%2d", &env->n_grains);        fgets( chs, 120, fpin );
00057    
00058    river->Cs = eh_new( double , env->n_grains );
00059    
00060    env->sed = eh_new( Plume_sediment , env->n_grains );
00061    
00062    for( ii = 0; ii<env->n_grains; ii++ ) { 
00063       fscanf( fpin, "%lf", &river->Cs[ii]);     fgets( chs, 120, fpin );
00064       fscanf( fpin, "%lf", &lambdad);           fgets( chs, 120, fpin );
00065       fscanf( fpin, "%lf", &env->sed[ii].rho);  fgets( chs, 120, fpin );
00066       env->sed[ii].lambda = lambdad/dTOs;               /* lambda (1/s) */
00067       } /* end for */
00068    /*
00069     *   Ocean Parameters
00070     *   lines 9-13
00071     */
00072    fscanf( fpin, "%lf", &ocean->Cw);            fgets( chs, 120, fpin );
00073    fscanf( fpin, "%lf", &ocean->vo);            fgets( chs, 120, fpin );
00074    fscanf( fpin, "%lf", &ocean->vdirection);    fgets( chs, 120, fpin );
00075    fscanf( fpin, "%lf", &ocean->cc);            fgets( chs, 120, fpin );
00076    fscanf( fpin, "%lf", &ocean->So);            fgets( chs, 120, fpin );
00077    fscanf( fpin, "%lf", &ocean->Sw);            fgets( chs, 120, fpin );
00078    /*
00079     *   Other Parameters
00080     *   line 14-16
00081     */
00082    fscanf( fpin, "%1d", &opt->fjrd);            fgets( chs, 120, fpin );
00083    fscanf( fpin, "%1d", &opt->kwf);             fgets( chs, 120, fpin );
00084    fscanf( fpin, "%d" , &env->lat);             fgets( chs, 120, fpin );
00085 
00086    /*
00087     *   grids
00088     *   lines 17-20
00089     */
00090    fscanf( fpin, "%2d", &grid->ndy);            fgets( chs, 120, fpin );
00091    fscanf( fpin, "%2d", &grid->ndx);            fgets( chs, 120, fpin );
00092    fscanf( fpin, "%lf", &grid->ymin);           fgets( chs, 120, fpin );
00093    fscanf( fpin, "%lf", &grid->ymax);           fgets( chs, 120, fpin );
00094    grid->x_len = 0;
00095    grid->y_len = 0;
00096 
00097    /* 
00098     *   debug and output option flags
00099     *   line 21, dbg removed
00100     *   lines 22-24
00101     */
00102    fscanf( fpin, "%d", &opt->o1);               fgets( chs, 120, fpin );
00103    fscanf( fpin, "%d", &opt->o2);               fgets( chs, 120, fpin );
00104    fscanf( fpin, "%d", &opt->o3);
00105 
00106    fclose(fpin);
00107    return(0);
00108 } // end of PlumeRead
00109 

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