/Users/huttone/Devel/sedflux-new/sedflux/trunk/ew/failure/failure.h

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 #ifndef _FAILURE_INCLUDED_
00022 # define _FAILURE_INCLUDED_
00023 
00024 #include <sed/sed_sedflux.h>
00025 
00026 # ifndef MIN_FAILURE_LENGTH
00027 #  define MIN_FAILURE_LENGTH (5)
00028 # endif
00029 # ifndef MAX_FAILURE_LENGTH
00030 #  define MAX_FAILURE_LENGTH (100)
00031 # endif
00032 # ifndef MIN_FACTOR_OF_SAFETY
00033 #  define MIN_FACTOR_OF_SAFETY (1.)
00034 # endif
00035 
00036 #define DECIDER_MAX_LENGTH        (2500.0)
00037 #define DECIDER_THRESHOLD         (0.4)
00038 #define DECIDER_TURBIDITY_CURRENT (0)
00039 #define DECIDER_DEBRIS_FLOW       (1)
00040 #define DECIDER_SLUMP             (2)
00041 
00042 #define FAILURE_DEFAULT_CONSOLIDATION     (1e-6)
00043 #define FAILURE_DEFAULT_COHESION          (1000.)
00044 #define FAILURE_DEFAULT_FRICTION_ANGLE    (30.)
00045 #define FAILURE_DEFAULT_GRAVITY           (9.81)
00046 #define FAILURE_DEFAULT_DENSITY_SEA_WATER (1028.)
00047 
00048 #define FAIL_FOS_NOT_VALID  (-1.)
00049 #define FAIL_IGNORE_SURFACE (-2.)
00050 #define FAIL_MIN_DELTA_H    (1e-5)
00051 
00052 typedef struct
00053 {
00054    double depth;        // Depth of the failure slicei (m).
00055    double c;            // Sediment cohesion (Pa).
00056    double W;            // Weight of sediment (N/m).
00057    double b;            // Width of a slice (m).
00058    double u;            // Excess pore pressure (Pa).
00059    double phi;          // Coulomb friction angle (rads).
00060    double alpha;        // Slope at bottom of failure (rads).
00061    double fs;           // Factor of safety of the slice (-).
00062    double a_vertical;   // vertical ground acceleration (m/s/s).
00063    double a_horizontal; // horizontal ground acceleration (m/s/s).
00064 } fs_t;
00065 
00066 typedef struct
00067 {
00068    double depth;
00069    double c;
00070    double u;
00071    double w;
00072    double b;
00073    double phi;
00074    double alpha;
00075    double fs;
00076    double a_vertical;
00077    double a_horizontal;
00078 }
00079 Fail_slice;
00080 
00081 typedef struct
00082 {
00083    double *w;                     // weight of the overlying sediment.
00084    double *u;                     // excess porewater pressure at the cell.
00085    double *phi;                   // average friction angle of overlying sediment.
00086    double *height;                // height to each cell.
00087    double *c;                     // average sediment cohesion.
00088    double fs[MAX_FAILURE_LENGTH]; // factor of safety for each ellipse.
00089    int size;                      // number of cells in column.
00090    int len;                       // number of cells allocated (length of w, u, etc).
00091    double failure_line;           // elevation to the bottom of the column.
00092    gboolean need_update;
00093 }
00094 Fail_column;
00095 
00096 typedef struct
00097 {
00098    double consolidation;
00099    double cohesion;
00100    double frictionAngle;
00101    double gravity;
00102    double density_sea_water;
00103 }
00104 Failure_t;
00105 
00106 typedef struct
00107 {
00108    Fail_column **col;    
00109    Sed_cube p;           
00110    double fs_min_val;    
00111    int fs_min_start;     
00112    int fs_min_len;       
00113    Failure_t fail_const; 
00114    int size;             
00115    int len;              
00116    int count;
00117 }
00118 Fail_profile;
00119 
00120 void factor_of_safety(double x,gconstpointer,double *fn, double *dfn);
00121 double rtsafe_fos( void (*funcd)(double, gconstpointer, double *, double *) ,
00122                    gconstpointer data ,
00123                    double x1 ,
00124                    double x2 ,
00125                    double xacc);
00126 Sed_cube get_failure_surface(const Sed_cube,int,int);
00127 double *get_ellipse(const Sed_cube,int,int,double*);
00128 double *get_circle(const Sed_cube,int,int,double*);
00129 double get_factor_of_safety( const Sed_cube p ,
00130                              const Failure_t *failure_const );
00131 int decider( const Sed_cube , double );
00132 
00133 Fail_column *fail_create_fail_column( int n , gboolean allocate );
00134 Fail_column *fail_reuse_fail_column( Fail_column *f );
00135 Fail_column *fail_resize_fail_column( Fail_column *f , int n );
00136 Fail_column *fail_init_fail_column( Sed_column c ,
00137                                     double h ,
00138                                     Failure_t fail_const );
00139 Fail_column *fail_reinit_fail_column( Fail_column *f ,
00140                                       Sed_column c ,
00141                                       double h ,
00142                                       Failure_t fail_const );
00143 void fail_destroy_fail_column( Fail_column *f );
00144 void fail_dump_fail_column( Fail_column *f , FILE *fp );
00145 gboolean fail_load_fail_column( Fail_column *f , FILE *fp );
00146 
00147 Fail_profile *fail_reuse_fail_profile( Fail_profile *f );
00148 Fail_profile *fail_create_fail_profile( int n_cols );
00149 void fail_dump_fail_profile( Fail_profile *f , FILE *fp );
00150 void fail_load_fail_profile( FILE *fp );
00151 Fail_profile *fail_resize_fail_profile( Fail_profile *f , int n_cols );
00152 Fail_profile *fail_reinit_fail_profile( Fail_profile *f ,
00153                                         Sed_cube p ,
00154                                         Failure_t fail_const );
00155 Fail_profile *fail_init_fail_profile( Sed_cube p ,
00156                                       Failure_t fail_const );
00157 void fail_examine_fail_profile( Fail_profile *p );
00158 void fail_reset_fail_profile( Fail_profile *p );
00159 void fail_update_fail_profile( Fail_profile *p );
00160 
00161 void fail_destroy_failure_profile( Fail_profile *f );
00162 double *fail_get_failure_line( Sed_cube p );
00163 double fail_get_fail_profile_fos( Fail_profile *f , int start , int len );
00164 void get_node_fos( gpointer data , gpointer user_data );
00165 gboolean fail_fos_is_valid( double fos );
00166 gboolean fail_surface_is_valid( double h );
00167 void fail_set_failure_surface_ignore( Fail_profile *f , int start , int len );
00168 gboolean fail_get_ignore_surface( Fail_profile *f , int start , int len );
00169 Fail_slice **fail_get_janbu_parameters( Fail_profile *f ,
00170                                         int start ,  
00171                                         double *fail_height ,
00172                                         int fail_len );
00173 gboolean fail_check_failure_plane_is_valid( const Sed_cube p ,
00174                                             int start ,
00175                                             int len ,
00176                                             const double *failure_plane );
00177 
00178 #endif /* failure.h is included */
00179 

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