86 #define VERBOSE_M "-verbose"
87 #define CREATE_GRID "-creates_the_grid"
88 #define WRITE_GRID "-writes_the_grid"
90 #define MESH_M "-only_mesh"
91 #define WPATH "-wpath"
102 #define INTEGER_NULL -99
103 #define D_INIT -999.0
105 #define NO_OPTION "missing_option"
106 #define ARITHMETIC_MEAN0 "--arithmetic-mean0"
107 #define MISSING_FILE join_strings(wpath,NO_OPTION)
108 #define PROGRAM "boussinesq"
110 #define FILE_LINES "-lines-resume"
111 #define FILE_POLYGONS "-polygons-resume"
112 #define FILE_CONNECTIONS "-connections-resume"
113 #define RESULTS_FILES "-results-rasters"
115 #define FILE_DATA "data="
117 #define RFACTOR param->max_error
153 int main(
int argc,
char *argv[]) {
164 if (!flag)
t_error(
"flag was not allocated!!");
169 double time_init,time_end;
170 long n_cm_layers,n_fm_layers,i,j;
219 if (elevation_bottom_fine==NULL) printf(
"Error: map corresponding to %s is missing or does not have an acceptable format \n",filenames->element[
I_MORPHO_ELEVATION_FINE]+1);
222 if (elevation_bottom_coarse==NULL) printf(
"Error: map corresponding to %s is missing or does not have an acceptable format \n",filenames->element[
I_MORPHO_ELEVATION_COARSE]+1);
225 if (elevation_terrain_fine==NULL) {
227 for (i=elevation_terrain_fine->
nl;i<=elevation_terrain_fine->nh;i++) {
228 elevation_terrain_fine->element[i]=elevation_bottom_fine->element[i]+10000.0;
230 printf(
"Error: map corresponding to %s is missing or does not have an acceptable format (tha map is automally calculated!) \n",filenames->element[
I_MORPHO_ELEVATION_TERRAINSURFACE_FINE]+1);
233 for (i=elevation_terrain_fine->
nl;i<=elevation_terrain_fine->nh;i++) {
234 elevation_terrain_fine->element[i]=fmax(elevation_terrain_fine->element[i],elevation_terrain_fine->element[i]);
240 for(i=elevation_bottom_bottom->
nl;i<=elevation_bottom_bottom->nh;i++) {
289 if (water_surface_elevation==NULL) printf(
"Error: map corresponding to %s is missing or does not have an acceptable format \n",filenames->element[
I_INITCOND_WATERSURFACE_ELEVATION]+1);
292 if (water_surface_elevation==NULL) printf(
"Error: map corresponding to %s is missing or does not have an acceptable format \n",filenames->element[
I_POROSITY_FINE]+1);
295 if ((water_depth==NULL) && (water_surface_elevation==NULL)) printf(
"Error: map corresponding to %s is missing or does not have an acceptable format \n",filenames->element[
I_INITCOND_WATERDEPTH]+1);
296 if ((water_depth!=NULL) && (water_surface_elevation==NULL)) {
299 for (i=water_surface_elevation->
nl;i<=water_surface_elevation->nh;i++) {
300 water_surface_elevation->element[i]=elevation_bottom_bottom->element[i]+water_depth->element[i];
305 if (outlet_coefficient_v_fine==NULL) {
306 printf(
"Warning: map corresponding to %s is missing or does not have an acceptable format, there is no outlets \n",filenames->element[
I_OUTLET_COEFFICIENT_FINE]+1);
307 outlet_coefficient=NULL;
313 if (outlet_coefficient_surf_v_fine==NULL) {
314 printf(
"Warning: map corresponding to %s is missing or does not have an acceptable format, there is no outlets \n",filenames->element[
I_OUTLET_COEFFICIENT_SURF_FINE]+1);
315 outlet_coefficient_surf=NULL;
323 if (runoff_coefficient_v_coarse==NULL) {
324 printf(
"Warning: map corresponding to %s is missing or does not have an acceptable format, coefficients are assumed to be zero \n",filenames->element[
I_RUNOFF_COEFFICIENT_COARSE]+1);
327 for (i=runoff_coefficient->
nl;i<=runoff_coefficient->nh;i++) {
328 runoff_coefficient->element[i]=0;
340 if (surface_water_velocity==NULL) {
342 for(j=surface_water_velocity->
nl;j<=surface_water_velocity->nh;j++) {
343 surface_water_velocity->element[j]=0.0;
348 for(j=F1_wet_vert_area->
nl;j<=F1_wet_vert_area->nh;j++) {
349 F1_wet_vert_area->element[j]=0.0;
375 if (outlet_coefficient_v_fine!=NULL)
free_doublevector(outlet_coefficient_v_fine);
378 if (outlet_coefficient_surf_v_fine!=NULL)
free_doublevector(outlet_coefficient_surf_v_fine);
382 if (runoff_coefficient_v_coarse!=NULL)
free_doublevector(runoff_coefficient_v_coarse);
390 printf(
"End of simulation, execution time %lf seconds \n",(time_end-time_init)/CLOCKS_PER_SEC);
413 int it_end=it_start+1;
416 int imaxerror=idt_print+1;
417 int ixtemp_adm=imaxerror+1;
418 int ideta=ixtemp_adm+1;
419 int i_nondirichlet=ideta+1;
420 int i_exp_dirichlet=i_nondirichlet+1;
421 int i_exp_outlet=i_exp_dirichlet+1;
422 int i_exp_outlet_surf=i_exp_outlet+1;
423 int i_exp_runoff=i_exp_outlet_surf+1;
424 int i_gravity=i_exp_runoff+1;
425 int iscalars=i_gravity;
432 if (scalars->
nh!=iscalars) {
433 printf (
"Warning in read_boussinesq_data_ft: Unexpected number of parameters %d instead of %ld \n ",iscalars,scalars->
nh);
437 if (!param)
t_error(
"(in read_boussinesq_data_ft) param was not allocated");