00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #if !defined(SED_SEDIMENT_H)
00022 #define SED_SEDIMENT_H
00023
00024 #include <stdio.h>
00025 #include <glib.h>
00026
00027 #include "datadir_path.h"
00028
00029 #if !defined( DATADIR )
00030 # define DATADIR "/usr/local/share"
00031 #endif
00032
00033 #define SED_SEDIMENT_TEST_FILE DATADIR "/sedflux/sample_sediment.kvf"
00034
00035 new_handle( Sed_type );
00036 new_handle( Sed_sediment );
00037
00038
00039 typedef gint32 Sed_size_class;
00040
00041 typedef double (*Sed_type_property_func_0) ( const Sed_type );
00042 typedef double (*Sed_type_property_func_1) ( const Sed_type , double );
00043 typedef double (*Sed_type_property_func_2) ( const Sed_type , double , double );
00044 typedef double (*Sed_type_property_func_with_data) ( const Sed_type , gpointer user_data );
00045
00046 #include "sed_cell.h"
00047 #include "sed_const.h"
00048 #include "sed_property.h"
00049
00050 typedef enum
00051 {
00052 S_PROPERTY_ID_BAD_VAL = 0,
00053 S_PROPERTY_ID_BULK_DENSITY,
00054 S_PROPERTY_ID_GRAIN_SIZE,
00055 S_PROPERTY_ID_PLASTIC_INDEX,
00056 S_PROPERTY_ID_FACIES,
00057 S_PROPERTY_ID_AGE,
00058 S_PROPERTY_ID_VELOCITY,
00059 S_PROPERTY_ID_VOID_RATIO,
00060 S_PROPERTY_ID_VOID_RATIO_MIN,
00061 S_PROPERTY_ID_VISCOSITY,
00062 S_PROPERTY_ID_FRICTION_ANGLE,
00063 S_PROPERTY_ID_PERMEABILITY,
00064 S_PROPERTY_ID_POROSITY,
00065 S_PROPERTY_ID_RELATIVE_DENSITY,
00066 S_PROPERTY_ID_MV,
00067 S_PROPERTY_ID_CV,
00068 S_PROPERTY_ID_SHEAR_STRENGTH,
00069 S_PROPERTY_ID_COHESION,
00070 S_PROPERTY_ID_EXCESS_PRESSURE,
00071 S_PROPERTY_ID_CONSOLIDATION,
00072 S_PROPERTY_ID_CONSOLIDATION_RATE,
00073 S_PROPERTY_ID_RELATIVE_PRESSURE,
00074 S_PROPERTY_ID_SAND_FRACTION,
00075 S_PROPERTY_ID_SILT_FRACTION,
00076 S_PROPERTY_ID_CLAY_FRACTION,
00077 S_PROPERTY_ID_MUD_FRACTION,
00078 S_PROPERTY_ID_GRAIN_DENSITY,
00079 S_PROPERTY_ID_MAX_DENSITY,
00080 S_PROPERTY_ID_GRAIN_SIZE_IN_M,
00081 S_PROPERTY_ID_POROSITY_MIN,
00082 S_PROPERTY_ID_POROSITY_MAX,
00083 S_PROPERTY_ID_HYDRAULIC_CONDUCTIVITY,
00084 S_PROPERTY_ID_VOID_RATIO_MAX,
00085 S_PROPERTY_ID_CC,
00086 S_PROPERTY_ID_YIELD_STRENGTH,
00087 S_PROPERTY_ID_DYNAMIC_VISCOSITY,
00088 S_PROPERTY_ID_COMPRESSIBILITY,
00089 S_PROPERTY_ID_PRESSURE,
00090 S_PROPERTY_ID_FRACTION = 100
00091 }
00092 Sed_property_id;
00093
00094 #define S_SED_TYPE_NONE ((Sed_size_class)(0)) // no size class
00095 #define S_SED_TYPE_BOULDER ((Sed_size_class)(1<<0 )) // -8 -> -12 f
00096 #define S_SED_TYPE_COBBLE ((Sed_size_class)(1<<1 )) // -5 -> -8 f
00097 #define S_SED_TYPE_PEBBLE ((Sed_size_class)(1<<2 )) // -2 -> -5 f
00098 #define S_SED_TYPE_GRANULE ((Sed_size_class)(1<<3 )) // -1 -> -2 f
00099 #define S_SED_TYPE_VERY_COARSE_SAND ((Sed_size_class)(1<<4 )) // 0 -> -1 f
00100 #define S_SED_TYPE_COARSE_SAND ((Sed_size_class)(1<<5 )) // 1 -> 0 f
00101 #define S_SED_TYPE_MEDIUM_SAND ((Sed_size_class)(1<<6 )) // 2 -> 1 f
00102 #define S_SED_TYPE_FINE_SAND ((Sed_size_class)(1<<7 )) // 3 -> 2 f
00103 #define S_SED_TYPE_VERY_FINE_SAND ((Sed_size_class)(1<<8 )) // 4 -> 3 f
00104 #define S_SED_TYPE_COARSE_SILT ((Sed_size_class)(1<<9 )) // 5 -> 4 f
00105 #define S_SED_TYPE_MEDIUM_SILT ((Sed_size_class)(1<<10)) // 6 -> 5 f
00106 #define S_SED_TYPE_FINE_SILT ((Sed_size_class)(1<<11)) // 7 -> 6 f
00107 #define S_SED_TYPE_VERY_FINE_SILT ((Sed_size_class)(1<<12)) // 8 -> 7 f
00108 #define S_SED_TYPE_COARSE_CLAY ((Sed_size_class)(1<<13)) // 9 -> 8 f
00109 #define S_SED_TYPE_MEDIUM_CLAY ((Sed_size_class)(1<<14)) // 10 -> 9 f
00110 #define S_SED_TYPE_FINE_CLAY ((Sed_size_class)(1<<15)) // 11 -> 10 f
00111
00112 #define S_SED_TYPE_GRAVEL ((Sed_size_class)( \
00113 S_SED_TYPE_PEBBLE \
00114 | S_SED_TYPE_GRANULE ))
00115 #define S_SED_TYPE_SAND ((Sed_size_class)( \
00116 S_SED_TYPE_VERY_COARSE_SAND \
00117 | S_SED_TYPE_COARSE_SAND \
00118 | S_SED_TYPE_MEDIUM_SAND \
00119 | S_SED_TYPE_FINE_SAND \
00120 | S_SED_TYPE_VERY_FINE_SAND ))
00121 #define S_SED_TYPE_SILT ((Sed_size_class)( \
00122 S_SED_TYPE_COARSE_SILT \
00123 | S_SED_TYPE_MEDIUM_SILT \
00124 | S_SED_TYPE_FINE_SILT \
00125 | S_SED_TYPE_VERY_FINE_SILT ))
00126 #define S_SED_TYPE_CLAY ((Sed_size_class)( \
00127 S_SED_TYPE_COARSE_CLAY \
00128 | S_SED_TYPE_MEDIUM_CLAY \
00129 | S_SED_TYPE_FINE_CLAY ))
00130 #define S_SED_TYPE_MUD ((Sed_size_class)( \
00131 S_SED_TYPE_SILT \
00132 | S_SED_TYPE_CLAY ))
00133
00134
00135 #define S_SED_TYPE_BOULDER_PHI (-8.)
00136 #define S_SED_TYPE_COBBLE_PHI (-5.)
00137 #define S_SED_TYPE_PEBBLE_PHI (-2.)
00138 #define S_SED_TYPE_GRANULE_PHI (-1.)
00139 #define S_SED_TYPE_VERY_COARSE_SAND_PHI ( 0.)
00140 #define S_SED_TYPE_COARSE_SAND_PHI ( 1.)
00141 #define S_SED_TYPE_SAND_PHI ( 2.)
00142 #define S_SED_TYPE_FINE_SAND_PHI ( 3.)
00143 #define S_SED_TYPE_VERY_FINE_SAND_PHI ( 4.)
00144 #define S_SED_TYPE_COARSE_SILT_PHI ( 5.)
00145 #define S_SED_TYPE_SILT_PHI ( 6.)
00146 #define S_SED_TYPE_FINE_SILT_PHI ( 7.)
00147 #define S_SED_TYPE_VERY_FINE_SILT_PHI ( 8.)
00148 #define S_SED_TYPE_COARSE_CLAY_PHI ( 9.)
00149 #define S_SED_TYPE_MEDIUM_CLAY_PHI (10.)
00150 #define S_SED_TYPE_FINE_CLAY_PHI (11.)
00151
00152 Sed_sediment sed_sediment_new ( void );
00153 Sed_sediment sed_sediment_new_sized( gssize n );
00154 Sed_sediment sed_sediment_copy ( Sed_sediment , const Sed_sediment );
00155 Sed_sediment sed_sediment_dup ( const Sed_sediment );
00156 gssize sed_sediment_n_types ( const Sed_sediment );
00157 Sed_sediment sed_sediment_add_type ( Sed_sediment , const Sed_type );
00158 Sed_sediment sed_sediment_insert_sorted( Sed_sediment s , Sed_type t ) G_GNUC_INTERNAL;
00159 gboolean sed_sediment_has_type ( Sed_sediment s , Sed_type t );
00160 Sed_sediment sed_sediment_append ( Sed_sediment s , Sed_type t ) G_GNUC_INTERNAL;
00161 void sed_sediment_foreach ( Sed_sediment s , GFunc f , gpointer user_data );
00162 double* sed_sediment_property ( Sed_sediment s , Sed_type_property_func_0 f );
00163 double sed_sediment_property_avg ( Sed_sediment s , double* f , Sed_type_property_func_0 p_func );
00164 double sed_sediment_property_avg_1( Sed_sediment s , double* f , double arg_1 , Sed_type_property_func_1 p_func );
00165 double sed_sediment_property_avg_2( Sed_sediment s , double* f , double arg_1 , double arg_2 , Sed_type_property_func_2 p_func );
00166 double sed_sediment_property_avg_with_data( Sed_sediment s , double* f , Sed_type_property_func_with_data p_func , gpointer user_data );
00167 gssize sed_sediment_fprint ( FILE* fp , Sed_sediment s );
00168 void sed_sediment_fprint_default( FILE *fp );
00169 Sed_type sed_sediment_type ( const Sed_sediment , gssize );
00170 Sed_sediment sed_sediment_destroy ( Sed_sediment );
00171 gssize sed_sediment_write ( FILE* , const Sed_sediment );
00172 Sed_sediment sed_sediment_load ( FILE* );
00173 Sed_sediment sed_sediment_scan ( const char* , GError** );
00174
00175 Sed_sediment sed_sediment_set_env ( Sed_sediment s );
00176 Sed_sediment sed_sediment_unset_env ( );
00177 Sed_sediment sed_sediment_env ( ) G_GNUC_INTERNAL;
00178 gboolean sed_sediment_env_is_set ( );
00179 gssize sed_sediment_env_size ( ) G_GNUC_DEPRECATED;
00180 gint sed_sediment_env_n_types( );
00181 Sed_sediment sed_sediment_resize ( Sed_sediment s , gssize new_len ) G_GNUC_INTERNAL;
00182
00183 Sed_type sed_type_set_rho_sat ( Sed_type t , double rho_sat );
00184 Sed_type sed_type_set_rho_grain ( Sed_type t , double rho_grain );
00185 Sed_type sed_type_set_grain_size ( Sed_type t , double gz );
00186 Sed_type sed_type_set_plastic_index ( Sed_type t , double pi ) G_GNUC_DEPRECATED;
00187 Sed_type sed_type_set_void_ratio_min ( Sed_type t , double void_min );
00188 Sed_type sed_type_set_diff_coef ( Sed_type t , double k );
00189 Sed_type sed_type_set_lambda ( Sed_type t , double l );
00190 Sed_type sed_type_set_settling_velocity ( Sed_type t , double w );
00191 Sed_type sed_type_set_c_consolidation ( Sed_type t , double c_v );
00192 Sed_type sed_type_set_compressibility ( Sed_type t , double c );
00193
00194 double sed_type_plastic_index( const Sed_type t ) G_GNUC_DEPRECATED;
00195
00196 double sed_type_rho_sat( const Sed_type t );
00197 double sed_type_rho_grain( const Sed_type t );
00198 double sed_type_grain_size( const Sed_type t );
00199 double sed_type_void_ratio_min(const Sed_type t );
00200 double sed_type_diff_coef(const Sed_type t );
00201 double sed_type_lambda( const Sed_type t );
00202 double sed_type_lambda_in_per_seconds ( const Sed_type t );
00203 double sed_type_settling_velocity( const Sed_type t );
00204 double sed_removal_rate_to_settling_velocity( double l );
00205 double sed_type_c_consolidation( const Sed_type t );
00206 double sed_type_compressibility( const Sed_type t );
00207 double sed_type_density_0( const Sed_type t );
00208 double sed_type_sat_density( const Sed_type t );
00209 double sed_type_rho_max( const Sed_type t );
00210 double sed_type_grain_size_in_meters( const Sed_type t );
00211 double sed_type_inv_grain_size_in_meters( const Sed_type t );
00212 double sed_type_grain_size_in_phi( const Sed_type t );
00213 double sed_type_is_sand( const Sed_type t );
00214 double sed_type_is_silt( const Sed_type t );
00215 double sed_type_is_clay( const Sed_type t );
00216 double sed_type_is_mud( const Sed_type t );
00217 Sed_size_class sed_type_grain_size_in_wentworth ( const Sed_type t );
00218 Sed_size_class sed_type_size_class( const Sed_type t );
00219 double sed_type_velocity( const Sed_type t );
00220 double sed_type_viscosity( const Sed_type t );
00221 double sed_type_dynamic_viscosity( const Sed_type t );
00222 double sed_type_relative_density( const Sed_type t );
00223 double sed_type_void_ratio( Sed_type t );
00224 double sed_type_void_ratio_max( Sed_type t );
00225 double sed_type_porosity( const Sed_type t );
00226 double sed_type_porosity_min( const Sed_type t );
00227 double sed_type_porosity_max(const Sed_type t );
00228 double sed_type_permeability( const Sed_type t );
00229 double sed_type_hydraulic_conductivity( const Sed_type t );
00230 double sed_type_water_content( const Sed_type t );
00231 double sed_specific_gravity( const Sed_type t );
00232 double sed_type_friction_angle( const Sed_type t );
00233 double sed_type_yield_strength( const Sed_type t );
00234 double sed_type_mv( const Sed_type t );
00235 double sed_type_cv( const Sed_type t );
00236 double sed_type_shear_strength( const Sed_type t , double load );
00237 double sed_type_cohesion( const Sed_type t , double load );
00238 double sed_type_consolidation( const Sed_type t , double d , double dt );
00239 double sed_type_consolidation_rate( const Sed_type t , double d , double dt );
00240 double sed_calculate_avg_consolidation( double c_v , double d , double t );
00241 double sed_calculate_consolidation( double c_v , double d , double z , double t );
00242 double sed_type_is_size_class( Sed_type t , Sed_size_class size );
00243 Sed_size_class sed_size_class( const double phi );
00244
00245 double sed_type_shear_strength_with_data( const Sed_type t , gpointer data ) G_GNUC_INTERNAL;
00246 double sed_type_cohesion_with_data( const Sed_type t , gpointer data ) G_GNUC_INTERNAL;
00247 double sed_type_consolidation_with_data( const Sed_type t , gpointer data ) G_GNUC_INTERNAL;
00248 double sed_type_consolidation_rate_with_data( const Sed_type t , gpointer data ) G_GNUC_INTERNAL;
00249 double sed_type_is_size_class_with_data( Sed_type t , gpointer size ) G_GNUC_INTERNAL;
00250 double sed_type_sum_size_classes_with_data( Sed_type t , gpointer size ) G_GNUC_INTERNAL;
00251 double sed_type_void_ratio_compacted( Sed_type t , gpointer d ) G_GNUC_INTERNAL;
00252 double sed_type_density_compacted( Sed_type t , gpointer d ) G_GNUC_INTERNAL;
00253
00254 double sed_removal_rate_to_settling_velocity( double );
00255 double sed_settling_velocity_to_removal_rate( double w_s );
00256 Sed_size_class sed_grain_size_in_wentworth( const Sed_sediment , gssize );
00257
00258 Sed_type sed_type_new ( );
00259 Sed_type sed_type_destroy( Sed_type s );
00260 Sed_type sed_type_copy ( Sed_type dest , Sed_type src );
00261 Sed_type sed_type_dup ( Sed_type src );
00262 gssize sed_type_fprint ( FILE* fp , Sed_type t );
00263 gssize sed_type_write ( FILE* fp , Sed_type t );
00264 Sed_type sed_type_read ( FILE* fp );
00265 Sed_type sed_type_init ( Eh_symbol_table t );
00266 gboolean sed_type_is_same( Sed_type t_1 , Sed_type t_2 );
00267 gboolean sed_type_is_same_size( Sed_type t_1 , Sed_type t_2 );
00268
00269 double sed_gravity ( void );
00270 double sed_gravity_units ( Sed_units units );
00271 double sed_set_gravity ( double new_val );
00272 double sed_rho_sea_water ( void );
00273 double sed_rho_sea_water_units ( Sed_units units );
00274 double sed_set_rho_sea_water ( double new_val );
00275 double sed_rho_fresh_water ( void );
00276 double sed_rho_fresh_water_units ( Sed_units units );
00277 double sed_set_rho_fresh_water ( double new_val );
00278 double sed_mu_water ( void );
00279 double sed_mu_water_units ( Sed_units units );
00280 double sed_set_mu_water ( double new_val );
00281 double sed_sea_salinity ( void );
00282 double sed_sea_salinity_units ( Sed_units units );
00283 double sed_set_sea_salinity ( double new_val );
00284 double sed_rho_quartz ( void );
00285 double sed_rho_quartz_units ( Sed_units units );
00286 double sed_set_rho_quartz ( double new_val );
00287 double sed_rho_mantle ( void );
00288 double sed_rho_mantle_units ( Sed_units units );
00289 double sed_set_rho_mantle ( double new_val );
00290
00291 #endif
00292