00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <stdio.h>
00022 #include <math.h>
00023
00024 #include <glib.h>
00025 #include <utils/utils.h>
00026 #include "flow.h"
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073 #define SED_RATE_DEFAULT (.005)
00074 #define DEPTH_DEFAULT (1500.)
00075 #define PSI_BASE_DEFAULT (80.)
00076 #define DZ_DEFAULT (25.)
00077 #define DT_DEFAULT (48000.)
00078 #define END_TIME_DEFAULT (1280000.)
00079 #define PSI_MIN_DEFAULT (10.)
00080 #define N_DEFAULT (10)
00081 #define VERBOSE_DEFAULT (FALSE)
00082
00083 void print_profile( double t , double *psi , int n );
00084
00085 static char *help_msg[] = {
00086 " flow - sovle the 1d consolidation equation. ",
00087 " ",
00088 " options: ",
00089 " r : sedimentation rate (m/s) ",
00090 " d : initial depth of the sediment (m) ",
00091 " u0 : excess porewater pressure at the base of the model ",
00092 " umin : excess porewater pressure of surface sediment ",
00093 " dz : vertical resolution of the model (m) ",
00094 " dt : time resolution of the model (s) ",
00095 " end : length of the model (s) ",
00096 " ",
00097 NULL };
00098
00099
00100 int main( int argc , char *argv[] )
00101 {
00102 double sed_rate;
00103 double depth;
00104 double psi_base;
00105 double psi_min;
00106 double dz;
00107 double dt;
00108 double dt_init;
00109 double end_time;
00110 gboolean verbose;
00111 int i, n;
00112 double t=0;
00113 double *psi;
00114 double *k, *c;
00115 Eh_args *args;
00116
00117 args = eh_opts_init( argc , argv );
00118 if ( eh_check_opts( args , NULL , NULL , help_msg )!=0 )
00119 eh_exit(-1);
00120
00121 sed_rate = eh_get_opt_dbl ( args , "r" , SED_RATE_DEFAULT );
00122 depth = eh_get_opt_dbl ( args , "d" , DEPTH_DEFAULT );
00123 psi_base = eh_get_opt_dbl ( args , "u0" , PSI_BASE_DEFAULT );
00124 psi_min = eh_get_opt_dbl ( args , "umin" , PSI_MIN_DEFAULT );
00125 dz = eh_get_opt_dbl ( args , "dz" , DZ_DEFAULT );
00126 dt_init = eh_get_opt_dbl ( args , "dt" , DT_DEFAULT );
00127 end_time = eh_get_opt_dbl ( args , "end" , END_TIME_DEFAULT );
00128 n = eh_get_opt_int ( args , "n" , N_DEFAULT );
00129 verbose = eh_get_opt_bool( args , "v" , VERBOSE_DEFAULT );
00130
00131 if ( verbose )
00132 {
00133 eh_print_opt( args , "r" );
00134 eh_print_opt( args , "d" );
00135 eh_print_opt( args , "u0" );
00136 eh_print_opt( args , "umin" );
00137 eh_print_opt( args , "dz" );
00138 eh_print_opt( args , "dt" );
00139 eh_print_opt( args , "end" );
00140 eh_print_opt( args , "n" );
00141 }
00142
00143
00144 n = pow(2,n)+1;
00145
00146 dz = depth/(n-1);
00147
00148
00149 psi = eh_linspace( psi_base , psi_min , n );
00150 k = eh_new( double , n );
00151 c = eh_new( double , n );
00152
00153 for ( i=0 ; i<n ; i++ )
00154 {
00155 psi[i] = 1;
00156 k[i] = 1.;
00157 c[i] = 1.;
00158
00159 if ( i>n/4 && i<n/2 )
00160 k[i] = .1;
00161
00162 }
00163 psi[n-1] = psi_min;
00164
00165
00166 print_profile( t , psi , n );
00167
00168 for ( t=0 ; t<end_time ; t+=dt)
00169 {
00170
00171
00172
00173
00174
00175
00176
00177 dt = dt_init;
00178
00179 solve_excess_pore_pressure( psi , k , c , n , dz , dt , psi_min , sed_rate );
00180
00181
00182 print_profile( t+dt , psi , n );
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198 }
00199
00200
00201 eh_free( k );
00202 eh_free( c );
00203
00204 return 0;
00205 }
00206
00207
00208 void print_profile( double t , double *psi , int n )
00209 {
00210 int i;
00211 fprintf( stdout , "%f ", t );
00212 for ( i=0 ; i<n ; i++ )
00213 fprintf( stdout , ", %f ", psi[i] );
00214 fprintf( stdout , "\n" );
00215 }
00216