/Users/huttone/Devel/sedflux-new/sedflux/trunk/ew/plume/plumeset.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  * PlumeSet.c   Sets various parameters from the input info for Plume
00023  *
00024  *
00025  *      Author:         M.D. Morehead
00026  *      Original:       Sep 1998
00027  *      Modified:       Sep 1998, MDM, Conversion for SEDFLUX3D
00028  *
00029  */
00030 
00031 #include "plumeinput.h"
00032 #include "plumevars.h"
00033 #include <stdio.h>
00034 
00035 //---
00036 // outputs:
00037 //    river.b0 : river width
00038 //    river.d0 : river depth
00039 //    dx       : cross-shore grid spacing
00040 //    dy       : along-shore grid spacing
00041 //
00042 // inputs:
00043 //    river.bo : river width
00044 //    river.Q  : river discharge
00045 //    river.u0 : river velocity
00046 //    ndx      : nodes in river mouth
00047 //    ndy      : nodes in cross-shore direction
00048 //---
00049 
00050 /*
00051  *      Start of PlumeSet
00052  */
00053 int plumeset( Plume_enviro *env , Plume_grid *grid , Plume_options *opt )
00054 {
00055    int ndx = grid->ndx;
00056    int ndy = grid->ndy;
00057    double dx, dy;
00058    Plume_river *river=env->river;
00059    Plume_ocean *ocean=env->ocean;
00060 
00061 // Constants derived from Input Parameters
00062 // NOTE: we round off b0.  i have no idea why we do this.
00063    river->b0 = ndy*rnd(river->b0/ndy);
00064 
00065 // round so that b0 and dy come out in meters
00066    river->d0  = river->Q/(river->b0*river->u0);  // river depth (m)
00067 // NOTE: we no longer round to the nearest meter.  dy, and dx are now DOUBLE.
00068 //   dy = (int)(river->b0/ndy);
00069    dy = river->b0/ndy;                           // along-shore bin spacing (m)
00070    dx = ndx*dy;                                  // cross-shore bin spacing (m)
00071 
00072    if ( ocean->vo > 0 )
00073       ocean->vdirection = river->rdirection + M_PI_2;
00074    else
00075       ocean->vdirection = river->rdirection - M_PI_2;
00076 
00077 //---
00078 // 3D check for direction of kelvin wave propagation
00079 // if the cross product of the Vocean and Vriver is > 0 in the northern
00080 // hemisphere, then the plume is moving in the direction of k.w.p.
00081 // Vo X Vr = |Vo| |Vr| sin( thetao - thetar ) [* perpendicular unit vector]
00082 //---
00083    if ( !(opt->strt || opt->fjrd ) )
00084    {
00085       opt->kwf = 0; 
00086       if( sin( ocean->vdirection - river->rdirection ) > 0 && env->lat > 0 )
00087          opt->kwf = 1;
00088       if( sin( ocean->vdirection - river->rdirection ) < 0 && env->lat < 0 )
00089          opt->kwf = 1;
00090    }
00091 //opt->kwf = 1;
00092 
00093    grid->dx = dx;
00094    grid->dy = dy;
00095 
00096    return(0);
00097 } /* end of PlumeRead */
00098 

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