/Users/huttone/Devel/sedflux-new/sedflux/trunk/ew/plume/plumeread2d.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  * PlumeRead2D.c        Reads the 2D 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 plumeread2d(char *fileName , Plume_enviro *env , Plume_grid *grid , Plume_options *opt )
00035 {
00036    static int first_time=1;
00037    FILE *fidin;
00038    char chs[120];
00039    Plume_ocean ocean = *(env->ocean);
00040 
00041    if ( first_time )
00042    {
00043       // Open the input file
00044       if( (fidin = fopen(fileName,"r")) == NULL)
00045       {
00046          fprintf(stderr, "  PlumeRead ERROR: Unable to open the input file: %s \n",fileName);
00047          eh_exit(1);
00048       }
00049 
00050       // Ocean parameters.
00051       fscanf( fidin, "%lf", &ocean.Cw);    fgets( chs, 120, fidin );
00052       fscanf( fidin, "%lf", &ocean.vo);    fgets( chs, 120, fidin );
00053       fscanf( fidin, "%lf", &ocean.vdirection); fgets( chs, 120, fidin );
00054       fscanf( fidin, "%lf", &ocean.cc);    fgets( chs, 120, fidin );
00055       fscanf( fidin, "%lf", &ocean.So);    fgets( chs, 120, fidin );
00056       fscanf( fidin, "%lf", &ocean.Sw);    fgets( chs, 120, fidin );
00057 
00058       // Other Parameters
00059       // line 14-16
00060       fscanf( fidin, "%1d", &opt->fjrd);   fgets( chs, 120, fidin );
00061       fscanf( fidin, "%1d", &opt->kwf);    fgets( chs, 120, fidin );
00062       fscanf( fidin, "%d" , &env->lat);    fgets( chs, 120, fidin );
00063 
00064       // grids
00065       // lines 17-18
00066       fscanf( fidin, "%2d", &grid->ndy);   fgets( chs, 120, fidin );
00067       fscanf( fidin, "%2d", &grid->ndx);   fgets( chs, 120, fidin );
00068 
00069       // debug and output option flags
00070       // line 21, dbg, removed
00071       // lines 22-24
00072       fscanf( fidin, "%d", &opt->o1);      fgets( chs, 120, fidin );
00073       fscanf( fidin, "%d", &opt->o2);      fgets( chs, 120, fidin );
00074       fscanf( fidin, "%d", &opt->o3);
00075 
00076       fclose(fidin);
00077       first_time=0;
00078    }
00079 
00080    return(0);
00081 
00082 } // end of PlumeRead
00083 

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