writepar.c 21.2 KB
Newer Older
Simone Butzer's avatar
Simone Butzer committed
1 2 3 4
/*------------------------------------------------------------------------
 * Copyright (C) 2015 For the list of authors, see file AUTHORS.
 *
 * This file is part of IFOS3D.
5
 *
Simone Butzer's avatar
Simone Butzer committed
6 7 8
 * IFOS3D is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, version 2.0 of the License only.
9
 *
Simone Butzer's avatar
Simone Butzer committed
10 11 12 13
 * IFOS3D is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
14
 *
Simone Butzer's avatar
Simone Butzer committed
15
 * You should have received a copy of the GNU General Public License
16
 * along with IFOS3D. See file COPYING and/or
Simone Butzer's avatar
Simone Butzer committed
17 18 19 20
 * <http://www.gnu.org/licenses/gpl-2.0.html>.
--------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------
21
 * Writing FD-Parameters to stdout or log-file
Simone Butzer's avatar
Simone Butzer committed
22
----------------------------------------------------------------------------*/
23
#include <limits.h>
Simone Butzer's avatar
Simone Butzer committed
24 25 26
#include "fd.h"

/* printing all important parameters to FILE *fp */
27
void writepar(FILE *fp, int ns) {
Simone Butzer's avatar
Simone Butzer committed
28 29

	/* declaration of extern variables */
30
	extern int   NX, NY, NZ, NT, SOURCE_SHAPE, SOURCE_TYPE, FDORDER, RUN_MULTIPLE_SHOTS;
Simone Butzer's avatar
Simone Butzer committed
31 32 33 34 35 36 37 38 39 40 41 42 43 44
	extern int  SNAP, SNAP_FORMAT, REC_ARRAY, L, SNAP_PLANE,FW;
	extern float DX, DY, DZ, TIME, DT, TS, *FL, TAU, PLANE_WAVE_DEPTH;
	extern float XREC1, XREC2, YREC1, YREC2, ZREC1, ZREC2;
	extern float ALPHA, BETA;
	extern float REC_ARRAY_DEPTH, REC_ARRAY_DIST;
	extern int SEISMO, NDT, NDTSHIFT, NGEOPH, SEIS_FORMAT[6], FREE_SURF;
	extern int  READMOD, READREC, DRX, DRY, BOUNDARY, SRCREC, IDX, IDY, IDZ;
	extern float TSNAP1, TSNAP2, TSNAPINC, REFREC[4], DAMPING;
	extern char SNAP_FILE[STRING_SIZE], SOURCE_FILE[], SIGNAL_FILE[], REC_FILE[], SEIS_FILE[STRING_SIZE];
	extern char  MFILE[STRING_SIZE],GRAD_FILE[STRING_SIZE],INV_FILE[STRING_SIZE],SEIS_OBS_FILE[STRING_SIZE];
	extern char  MOD_OUT_FILE[STRING_SIZE],HESS_FILE[STRING_SIZE];
	extern int METHOD;
	extern int NP, NPROCX, NPROCY, NPROCZ, MYID;
	extern int ITMIN, ITMAX, FILT, NFMAX, TAST, NSHOTS_STEP, DAMPTYPE, HESS, READ_HESS, REC_HESS, LBFGS,EXTOBS;
45
	extern int NUMPAR, BFGSNUM;
46
	extern int VERBOSE;
47

48
	extern float TESTSTEP,WATER_HESS[3], WEIGHT[3], VP0, VS0, RHO0;
Simone Butzer's avatar
Simone Butzer committed
49 50
	/* definition of local variables */
	char th1[3], file_ext[8];
51
	char th2[3];
Simone Butzer's avatar
Simone Butzer committed
52 53 54 55 56
	int l;

	fprintf(fp,"\n **********************************************************");
	fprintf(fp,"\n ********* PARAMETERS AS SPECIFIED IN INPUT FILE **********");
	fprintf(fp,"\n **********************************************************\n\n");
57

Simone Butzer's avatar
Simone Butzer committed
58
	/*note that internally "y" is used for the vertical coordinate,
59
	for usability reasons, we switch the "y" and "z" coordinate
Simone Butzer's avatar
Simone Butzer committed
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
	so that "z" - as commonly used - denotes the depth (vertical direction)*/
	fprintf(fp,"\n\n **Message from write_par (printed by PE %d):\n\n",MYID);
	fprintf(fp,"------------------------- Processors ------------------------\n");
	fprintf(fp," Number of PEs in horizontal x-direction (NPROCX): %d\n",NPROCX);
	fprintf(fp," Number of PEs in horizontal y-direction (NPROCY): %d\n",NPROCZ);
	fprintf(fp," Number of PEs in vertical   z-direction (NPROCZ): %d\n",NPROCY);
	fprintf(fp," Total number of PEs in use: %d\n",NP);
	fprintf(fp,"\n");
	fprintf(fp," ----------------------- Discretization  ---------------------\n");
	fprintf(fp," Number of gridpoints in x-direction (NX): %i\n", NX);
	fprintf(fp," Number of gridpoints in y-direction (NY): %i\n", NZ);
	fprintf(fp," Number of gridpoints in z-direction (NZ): %i\n", NY);
	fprintf(fp," Grid-spacing in x-direction (DX): %e meter\n", DX);
	fprintf(fp," Grid-spacing in y-direction (DY): %e meter\n", DZ);
	fprintf(fp," Grid-spacing in z-direction (DZ): %e meter\n", DY);
	fprintf(fp," Time of wave propagation (T): %e seconds\n",TIME);
	fprintf(fp," Timestep (DT): %e seconds\n", DT);
	fprintf(fp," Number of timesteps: %i \n",NT);
	fprintf(fp,"\n");
	fprintf(fp," ------------------------- ORDER OF FD OPERATORS --------------\n");
	fprintf(fp," Order of FD operators: %i \n",FDORDER);
81 82

	if ((FDORDER<0)||(FDORDER%2!=0)||(FDORDER>12)) {
Simone Butzer's avatar
Simone Butzer committed
83
		err(" Incorrect FDORDER (must be 2, 4, 8, or 12) ! ");
84
	}
Simone Butzer's avatar
Simone Butzer committed
85 86 87 88

	fprintf(fp,"\n");
	fprintf(fp," ------------------------- SOURCE -----------------------------\n");

89
	if ((SRCREC) && (!PLANE_WAVE_DEPTH)) {
Simone Butzer's avatar
Simone Butzer committed
90
		fprintf(fp," Reading source positions, time delay, centre frequency \n");
91 92 93 94 95 96 97
		fprintf(fp," and initial amplitude from ASCII-file");
		fprintf(fp," %s\n",SOURCE_FILE);

		if (RUN_MULTIPLE_SHOTS)	{
			fprintf(fp,"\n IFOS will run (independent) simulations for each source defined in %s\n\n", SOURCE_FILE);
		}

Simone Butzer's avatar
Simone Butzer committed
98 99
	} else {
		fprintf(fp," Plane wave excitation: depth= %5.2f meter \n",PLANE_WAVE_DEPTH);
100 101
		fprintf(fp," duration of source signal: %e seconds\n",TS);
		fprintf(fp," (centre frequency is approximately %e Hz)\n",1.0/TS);
Simone Butzer's avatar
Simone Butzer committed
102 103 104
	}


105

Simone Butzer's avatar
Simone Butzer committed
106 107
	fprintf(fp," Wavelet of source:");

108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
	switch (SOURCE_SHAPE) {
		case 1 :
			fprintf(fp," Ricker\n");
			break;

		case 2 :
			fprintf(fp," Fuchs-Mueller\n");
			break;

		case 3 :
			fprintf(fp," reading from \n\t %s\n",SIGNAL_FILE);
			break;

		case 4 :
			fprintf(fp," sinus raised to the power of 3.0 \n");
			break;

		case 5 :
			fprintf(fp," spike function \n");
			break;

		case 6:
			break;

		default :
			err(" Sorry, incorrect specification of source wavelet ! ");
Simone Butzer's avatar
Simone Butzer committed
134 135 136
	}

	fprintf(fp," Default type of source:");
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163

	switch (SOURCE_TYPE) {
		case 1 :
			fprintf(fp," explosive point source (concentrated at a single gridpoint)\n");
			break;

		case 2 :
			fprintf(fp," point source with directive force in x-direction\n");
			break;

		case 3 :
			fprintf(fp," point source with directive force in y-direction\n");
			break;

		case 4 :
			fprintf(fp," point source with directive force in  z-direction\n");
			break;

		case 5 :
			fprintf(fp," point source with directive force in  custom-direction\n");
			fprintf(fp," Angle between x and y(depth) direticon (ALPHA): %f\n", ALPHA);
			fprintf(fp," Angle between x and z direticon (BETA): %f\n", BETA);
			break;

		default :
			fprintf(fp," WARNING: Default type of source ('%d') not available -> changed to explosive! ", SOURCE_TYPE);
			SOURCE_TYPE=1;
Simone Butzer's avatar
Simone Butzer committed
164
	}
165

Simone Butzer's avatar
Simone Butzer committed
166 167 168 169
	fprintf(fp,"\n");
	fprintf(fp,"\n Source file: %s \n", SOURCE_FILE);
	fprintf(fp,"\n Multiple shots: %i \n", RUN_MULTIPLE_SHOTS);

170
	if (SEISMO) {
Simone Butzer's avatar
Simone Butzer committed
171
		fprintf(fp," ------------------------- RECEIVER  ------- -------------------\n");
172 173

		switch (READREC) {
174 175 176 177 178
			case 1:
				fprintf(fp," Reading receiver positions from file \n");
				fprintf(fp,"\t%s\n\n",REC_FILE);
				fprintf(fp," reference_point_for_receiver_coordinate_system:\n");
				fprintf(fp," x=%f \ty=%f\t z=%f\n",REFREC[1], REFREC[3], REFREC[2]);
179
				fprintf(fp,"\n");
180
				break;
181

182
			case 2:
183

Simone Butzer's avatar
Simone Butzer committed
184 185 186 187
				fprintf(fp," Horitontal plane of receivers.\n");
				fprintf(fp," Number of planes: %d \n",REC_ARRAY);
				fprintf(fp," Depth of upper plane: %e m \n",REC_ARRAY_DEPTH);
				fprintf(fp," Vertical increment between planes: %e m \n",REC_ARRAY_DIST);
188 189 190
				fprintf(fp," Distance between receivers in x-direction within plane: %i Gridpoints\n", DRX);
				fprintf(fp," Distance between receivers in y-direction within plane: %i Gridpoints\n", DRY);
				fprintf(fp,"\n");
191
				break;
192

193
			case 0 :
194
				fprintf(fp," Receiver line: \n");
195
				fprintf(fp," First receiver position (XREC1,YREC1,ZREC1) = (%5.3f, %5.3f, %5.3f m\n",
196
				        XREC1,ZREC1,YREC1);
197
				fprintf(fp," Last receiver position (XREC2,YREC2,ZREC2)  = (%5.3f, %5.3f, %5.3f) m\n",
198
				        XREC2,ZREC2,YREC2);
199 200
				fprintf(fp,"\n");
				break;
201

202 203 204
			default :
				err(" invalid READREC in write_par!");
				break;
Simone Butzer's avatar
Simone Butzer committed
205 206
		}
	}
207

Simone Butzer's avatar
Simone Butzer committed
208
	fprintf(fp," ------------------------- FREE SURFACE ------------------------\n");
209 210 211 212 213 214 215 216

	if (FREE_SURF) {
		fprintf(fp," There is a free surface at the top of the model ! \n");

	} else {
		fprintf(fp," There is no free surface at the top of the model ! \n");
	}

Simone Butzer's avatar
Simone Butzer committed
217 218 219
	fprintf(fp,"\n");

	fprintf(fp," ------------------------- ABSORBING FRAME ---------------------\n");
220 221

	if (FW>0) {
Simone Butzer's avatar
Simone Butzer committed
222 223
		fprintf(fp," Width of absorbing frame is %i grid points.\n",FW);
		fprintf(fp," The percentage of amplitude decay at the edge is set to %f \n",DAMPING);
224 225

	} else {
Simone Butzer's avatar
Simone Butzer committed
226 227 228 229
		fprintf(fp," Absorbing frame not installed ! \n");
		fprintf(fp," Be aware of artificial reflections from the edges of the numerical mesh ! \n");
	}

230
	switch (BOUNDARY) {
Simone Butzer's avatar
Simone Butzer committed
231 232 233
		case 0 :
			fprintf(fp," No periodic boundary condition.\n");
			break;
234

Simone Butzer's avatar
Simone Butzer committed
235 236 237
		case 1 :
			fprintf(fp," Periodic boundary condition at left/right and front/back sides of global grid.\n");
			break;
238

Simone Butzer's avatar
Simone Butzer committed
239 240 241 242 243 244 245 246
		default :
			warning(" Wrong integer value for BOUNDARY specified in parameter file! ");
			warning(" No periodic boundary condition will be applied ");
			BOUNDARY=0;
			break;
	}


247 248

	if (READMOD) {
Simone Butzer's avatar
Simone Butzer committed
249 250 251 252 253 254 255
		fprintf(fp," ------------------------- MODEL-FILES -------------------------\n");
		fprintf(fp," Names of model-files: \n");
		fprintf(fp,"\t shear wave velocities:\n\t %s.vs\n",MFILE);
		fprintf(fp,"\t tau for shear waves:\n\t %s.ts\n",MFILE);
		fprintf(fp,"\t density:\n\t %s.rho\n",MFILE);
		fprintf(fp,"\t compressional wave velocities:\n\t %s.vp\n",MFILE);
		fprintf(fp,"\t tau for P-waves:\n\t %s.tp\n",MFILE);
256 257 258 259

		for (l=1; l<=L; l++) {
			fprintf(fp,"\t %1i. relaxation frequencies: %s.f%1i\n",l,MFILE,l);
		}
Simone Butzer's avatar
Simone Butzer committed
260 261 262 263
	}

	fprintf(fp,"\n");

264 265 266 267 268 269 270 271 272 273 274 275
	if (L) {
		fprintf(fp," ------------------------- Q-APROXIMATION --------------------\n");
		fprintf(fp," Number of relaxation mechanisms (L): %i\n",L);
		fprintf(fp," The L relaxation frequencies are at:  \n");

		for (l=1; l<=L; l++) {
			fprintf(fp,"\t%f",FL[l]);
		}

		fprintf(fp," Hz\n");
		fprintf(fp," Value for tau is : %f\n",TAU);
	}
Simone Butzer's avatar
Simone Butzer committed
276

277
	if (SNAP) {
Simone Butzer's avatar
Simone Butzer committed
278 279 280
		fprintf(fp,"\n");
		fprintf(fp," -----------------------  SNAPSHOTS  -----------------------\n");
		fprintf(fp," Snapshots of");
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301

		switch (SNAP) {
			case 1:
				fprintf(fp," particle velocity.\n");
				break;

			case 2:
				fprintf(fp," pressure field.\n");
				break;

			case 3:
				fprintf(fp," curl and divergence energy of the wavefield.\n");
				break;

			case 4:
				fprintf(fp," curl and divergence energy of the wavefield.\n");
				fprintf(fp," and particle velocity.\n");
				break;

			default:
				err(" sorry, incorrect value for SNAP ! \n");
Simone Butzer's avatar
Simone Butzer committed
302 303 304 305 306 307 308 309 310
		}

		fprintf(fp," \t first (TSNAP1)= %8.5f s\n", TSNAP1);
		fprintf(fp," \t last (TSNAP2)=%8.5f s\n",TSNAP2);
		fprintf(fp," \t increment (TSNAPINC) =%8.5f s\n\n",TSNAPINC);
		fprintf(fp," \t spacing in x-direction (IDX*DX) =%8.5f m\n",IDX*DX);
		fprintf(fp," \t spacing in y-direction (IDY*DY) =%8.5f m\n",IDZ*DZ);
		fprintf(fp," \t spacing in z-direction (IDZ*DZ) =%8.5f m\n",IDY*DY);
		fprintf(fp," \n name of output-file (SNAP_FILE):\n\t %s\n",SNAP_FILE);
311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326

		switch (SNAP_FORMAT) {
			case 1 :
				err(" SU-Format not yet available !!");
				break;

			case 2 :
				fprintf(fp," The data is written in ASCII. \n");
				break;

			case 3 :
				fprintf(fp," The data is written binary (IEEE) (4 byte per float)");
				break;

			default:
				err(" Don't know the format for the Snapshot-data ! \n");
Simone Butzer's avatar
Simone Butzer committed
327
		}
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344

		switch (SNAP_PLANE) {
			case 1 :
				fprintf(fp," \nDiv and curl output will be as Energy without sign. \n");
				break;

			case 2 :
				fprintf(fp," \nDiv and curl output will be as Energy with sign true for xz-plane. \n");
				break;

			case 3 :
				fprintf(fp," \nDiv and curl output will be as Energy with sign true for xy-plane. \n");
				break;

			case 4 :
				fprintf(fp," \nDiv and curl output will be as Energy with sign true for yz-plane. \n");
				break;
Simone Butzer's avatar
Simone Butzer committed
345 346 347 348
		}

		fprintf(fp,"\n\n");
	}
349 350

	if (SEISMO) {
Simone Butzer's avatar
Simone Butzer committed
351 352
		fprintf(fp,"\n");
		fprintf(fp," -----------------------  SEISMOGRAMS  ----------------------\n");
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377

		switch (SEIS_FORMAT[0]) {
			case 0:
				sprintf(file_ext,"sgy");
				break;

			case 1:
				sprintf(file_ext,"su");
				break;

			case 2:
				sprintf(file_ext,"txt");
				break;

			case 3:
				sprintf(file_ext,"bin");
				break;

			case 4:
				sprintf(file_ext,"sgy");
				break;

			case 5:
				sprintf(file_ext,"sgy");
				break;
Simone Butzer's avatar
Simone Butzer committed
378
		}
379 380

		if ((SEISMO==1) || (SEISMO==4)) {
Simone Butzer's avatar
Simone Butzer committed
381 382 383 384 385 386
			fprintf(fp," Seismograms of ");
			fprintf(fp," x-, y-, and z-component");
			fprintf(fp," of particle velocity.\n");
			fprintf(fp," output-files: \n ");
			fprintf(fp,"\t%s_x.%s\n\t%s_y.%s\n\t%s_z.%s\n",SEIS_FILE,file_ext,SEIS_FILE,file_ext,SEIS_FILE,file_ext);
		}
387 388

		if ((SEISMO==2) || (SEISMO==4)) {
Simone Butzer's avatar
Simone Butzer committed
389 390 391 392
			fprintf(fp," Seismograms of pressure field (hydrophones).\n");
			fprintf(fp," output-file: \n ");
			fprintf(fp,"\t%s_p.%s\n",SEIS_FILE,file_ext);
		}
393 394

		if ((SEISMO==3) || (SEISMO==4)) {
Simone Butzer's avatar
Simone Butzer committed
395 396 397
			fprintf(fp," Seismograms of curl (S-wave component) and div (P-wave component of wavefield).\n");
			fprintf(fp," output-files: \n ");
			fprintf(fp,"\t%s_rot.%s \n\t%s_div.%s\n",SEIS_FILE,file_ext,SEIS_FILE,file_ext);
398 399 400 401 402 403 404 405

		}

		if (NDT==0) {
			NDT=1;
			fprintf(fp," NDT set to %d.\n",NDT);

		} else if (NDT<0) {
Simone Butzer's avatar
Simone Butzer committed
406 407 408
			NDT=-NDT;
			fprintf(fp," Negative NDT set to its absolute value %d.\n",NDT);
		}
409 410

		if (NDTSHIFT<0) {
Simone Butzer's avatar
Simone Butzer committed
411 412 413
			NDTSHIFT=-NDTSHIFT;
			fprintf(fp," Negative NDTSHIFT set to its absolute value %d.\n",NDTSHIFT);
		}
414

Simone Butzer's avatar
Simone Butzer committed
415 416
		if (ns) {
			switch (NDT) {
417 418 419 420 421 422 423 424 425 426 427 428 429 430 431
				case 1 :
					strcpy(th1,"st");
					break;

				case 2 :
					strcpy(th1,"nd");
					break;

				case 3 :
					strcpy(th1,"rd");
					break;

				default:
					strcpy(th1,"th");
					break;
Simone Butzer's avatar
Simone Butzer committed
432
			}
433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455

			switch (NDTSHIFT+1) {
				case 1 :
					strcpy(th2,"st");
					break;

				case 2 :
					strcpy(th2,"nd");
					break;

				case 3 :
					strcpy(th2,"rd");
					break;

				default:
					strcpy(th2,"th");
					break;
			}

			fprintf(fp," Amplitudes will be written every %d%s time-step, starting at the %d%s.\n",NDT,th1,NDTSHIFT+1,th2);

		} else {
			if ((SEIS_FORMAT[0]==2)||(SEIS_FORMAT[0]==3)) {
Simone Butzer's avatar
Simone Butzer committed
456
				fprintf(fp," Warning: seismogram files will be empty! \n");
457 458

			} else if ((SEIS_FORMAT[0]==0)||(SEIS_FORMAT[0]==1)||(SEIS_FORMAT[0]==4)) {
Simone Butzer's avatar
Simone Butzer committed
459
				fprintf(fp," Warning: seismogram files will contain only headers! \n");
460
			}
Simone Butzer's avatar
Simone Butzer committed
461 462
		}

463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600
		switch (SEIS_FORMAT[0]) {
			case 0 :
			case 5 :
				fprintf(fp," Seismograms are written in SEG-Y format. \n");

				if (!SEIS_FORMAT[1]) {
					fprintf(fp," \t textual header: ASCII \n");

				} else if (SEIS_FORMAT[1]==1) {
					fprintf(fp," \t textual header: EBCDIC \n");
				}

				if (!SEIS_FORMAT[2]) {
					fprintf(fp," \t byte order: little endian \n");

				} else if (SEIS_FORMAT[2]==1) {
					fprintf(fp," \t byte order: big endian \n");
				}

				if (!SEIS_FORMAT[3]) {
					fprintf(fp," \t data type: IEEE 4-byte floats \n");

				} else if (SEIS_FORMAT[3]==1) {
					fprintf(fp," \t data type: IBM 4-byte floats \n");
				}

				if (!SEIS_FORMAT[4]) {
					fprintf(fp," \t coordinate unit: meter \n");

				} else if (SEIS_FORMAT[4]==1) {
					fprintf(fp," \t coordinate unit: feet \n");
				}

				break;

			case 1 :
				fprintf(fp," Seismograms are written in SU-format. \n");

				if (VERBOSE) {
					if (!SEIS_FORMAT[2]) {
						fprintf(fp," \t byte order: little endian \n");

					} else if (SEIS_FORMAT[2]==1) {
						fprintf(fp," \t byte order: big endian \n");
					}

					if (!SEIS_FORMAT[3]) {
						fprintf(fp," \t data type: IEEE 4-byte floats \n");

					} else if (SEIS_FORMAT[3]==1) {
						fprintf(fp," \t CAUTION: data type: IBM 4-byte floats \n");
					}

					if (!SEIS_FORMAT[4]) {
						fprintf(fp," \t coordinate unit: meter \n");

					} else if (SEIS_FORMAT[4]==1) {
						fprintf(fp," \t coordinate unit: feet \n");
					}
				}

				break;

			case 2 :
				if (!SEIS_FORMAT[1]) {
					fprintf(fp," Seismograms are written in ASCII. \n");

				} else if (!SEIS_FORMAT[1]==1) {
					fprintf(fp," Seismograms are written in EBCDIC. \n");
				}

				if (!SEIS_FORMAT[4]) {
					fprintf(fp," \t coordinate unit: meter \n");

				} else if (SEIS_FORMAT[4]==1) {
					fprintf(fp," \t coordinate unit: feet \n");
				}

				break;

			case 3 :
				fprintf(fp," Seismograms are written in binary format.");

				if (!SEIS_FORMAT[2]) {
					fprintf(fp," \t byte order: little endian \n");

				} else if (SEIS_FORMAT[2]==1) {
					fprintf(fp," \t byte order: big endian \n");
				}

				if (!SEIS_FORMAT[3]) {
					fprintf(fp," \t data type: IEEE 4-byte floats \n");

				} else if (SEIS_FORMAT[3]==1) {
					fprintf(fp," \t data type: IBM 4-byte floats \n");
				}

				if (!SEIS_FORMAT[4]) {
					fprintf(fp," \t coordinate unit: meter \n");

				} else if (SEIS_FORMAT[4]==1) {
					fprintf(fp," \t coordinate unit: feet \n");
				}

				break;

			case 6 :
				fprintf(fp," Seismograms are written in pseudo SU-format (SEG-Y with trace headers only). \n");

				if (!SEIS_FORMAT[2]) {
					fprintf(fp," \t byte order: little endian \n");

				} else if (SEIS_FORMAT[2]==1) {
					fprintf(fp," \t byte order: big endian \n");
				}

				if (!SEIS_FORMAT[3]) {
					fprintf(fp," \t data type: IEEE 4-byte floats \n");

				} else if (SEIS_FORMAT[3]==1) {
					fprintf(fp," \t CAUTION: data type: IBM 4-byte floats \n");
				}

				if (!SEIS_FORMAT[4]) {
					fprintf(fp," \t coordinate unit: meter \n");

				} else if (SEIS_FORMAT[4]==1) {
					fprintf(fp," \t coordinate unit: feet \n");
				}

				break;

			case 7 :
				fprintf(fp," Seismograms are written in SU-format (output in meter, native endian and floats). \n");
				break;

			default:
				err(" Sorry. Unknown format for seismic data! \n");
Simone Butzer's avatar
Simone Butzer committed
601
		}
602

Simone Butzer's avatar
Simone Butzer committed
603
		fprintf(fp," samplingrate of seismic data:                %e s\n",NDT*DT);
604 605 606 607 608

		if (!READREC) {
			fprintf(fp," Trace-spacing: %e m\n", NGEOPH*DX);
		}

Simone Butzer's avatar
Simone Butzer committed
609
		fprintf(fp," Number of samples per receiver:              %i \n", ns);
610 611 612 613 614 615 616 617 618

		if (!SEIS_FORMAT[5]) {
			SEIS_FORMAT[5]=USHRT_MAX;    /* default */
		}

		if (ns<=abs(SEIS_FORMAT[5])) {
			fprintf(fp," Number of samples per trace:                 %i \n", ns);

		} else if (SEIS_FORMAT[5]<0) {
Simone Butzer's avatar
Simone Butzer committed
619 620 621
			fprintf(fp," Number of samples per trace:                 %i \n", -SEIS_FORMAT[5]);
			fprintf(fp," Number of traces per receiver:               %i \n", ns / -SEIS_FORMAT[5]);
			fprintf(fp," Number of significant samples in last trace: %i \n", ns % -SEIS_FORMAT[5]);
622 623

		} else {
Simone Butzer's avatar
Simone Butzer committed
624 625
			fprintf(fp," Maximum allowed number of samples per trace: %i \n", SEIS_FORMAT[5]);
			err(" Sorry. Too many samples per receiver! \n");
626 627
		}

Simone Butzer's avatar
Simone Butzer committed
628 629
		fprintf(fp," ----------------------------------------------------------\n");
		fprintf(fp,"\n");
630

Simone Butzer's avatar
Simone Butzer committed
631
	}
632

Simone Butzer's avatar
Simone Butzer committed
633
	fprintf(fp,"\n");
634 635
	fprintf(fp,"\n Inversion method: %d",METHOD);
	if(!METHOD)fprintf(fp,"\n Forward only");
Simone Butzer's avatar
Simone Butzer committed
636
	fprintf(fp,"\n");
637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678

	if (METHOD) {
		fprintf(fp,"\n");
		fprintf(fp," ----------------------- INVERSION PARAMETER  ----------------------\n");
		fprintf(fp,"-------------------------In- and Output Files--------------------------------------\n");
		fprintf(fp," \n Gradients are written to FILE:%s\n",GRAD_FILE);
		fprintf(fp," \n Models are written to FILE:%s\n",MOD_OUT_FILE);
		/*fprintf(fp," \n Inversion Frequency:%4.2f\n",F_INV);*/
		fprintf(fp," \n Observed Seismograms:%s\n",SEIS_OBS_FILE);
		fprintf(fp,"\n External observed Seismograms: %i \n", EXTOBS);
		fprintf(fp," \n Inversion FILE:%s\n",INV_FILE);
		if (HESS) fprintf(fp," \n Hessian FILE:%s\n",HESS_FILE);

		fprintf(fp," \n-------------------------General---------------------------------------------------\n");
		fprintf(fp," \n minimum/maximum_iteration_number: %d,%d\n",ITMIN,ITMAX);
		fprintf(fp," \n filtering: %d\n",FILT);
		fprintf(fp," \n maximum_number_frequencies_per_iteration: %d\n",NFMAX);
		fprintf(fp," \n number_of_timestep_per_wavelength_used_for_inversion: %d\n",TAST);
		fprintf(fp," \n average_model_parameter VP0=%5.2f m/s, VS0=%5.2f m/s, RHO0=%5.2f kg/m^3\n",VP0, VS0, RHO0);
		fprintf(fp," \n parameter_class_weighting_factors_for_vp: %5.2f, vs: %5.2f, rho: %5.2f\n",WEIGHT[0], WEIGHT[1], WEIGHT[2]);

		fprintf(fp," \n------------------------Steplength estimation----------------------------------------\n");
		fprintf(fp,"\n number_of_shots_used_for_steplength_estimation: %d\n",NSHOTS_STEP);
		fprintf(fp,"\n initial test steplength: %f\n",TESTSTEP);

		fprintf(fp," \n------------------------Gradient preconditioning-------------------------------------\n");
		fprintf(fp," \n Type_of_preconditioning:%d\n",DAMPTYPE);
		if (HESS){
		fprintf(fp," \n------------------------Hessian preconditioning-----------------------------------------\n");		
		fprintf(fp," \n Apply_Hessian %d\n",HESS);
		fprintf(fp," Read_Hessian_from_file %d\n",READ_HESS);
		fprintf(fp," Part_of_receivers_used_for_Hessian %d",REC_HESS);
		fprintf(fp," \n Water_level_Hessian_for_vp/vs/rho %e \n",WATER_HESS[0]);
		}
		if(LBFGS) {
		fprintf(fp," \n ------------------------LBFGS-----------------------------------------\n");
		fprintf(fp," \n LBFGS: %i \n",LBFGS);
		fprintf(fp," Number_of_inverted_parameters_(NUMPAR): %i \n",NUMPAR);
		fprintf(fp," Number_iterations_used_for_LBFGS: %i \n",BFGSNUM);
		}
	}

Simone Butzer's avatar
Simone Butzer committed
679
	fprintf(fp,"\n **********************************************************");
Simone Butzer's avatar
Simone Butzer committed
680
	fprintf(fp,"\n ******* PARAMETERS READ or PROCESSED within IFOS3D ********");
Simone Butzer's avatar
Simone Butzer committed
681 682 683 684
	fprintf(fp,"\n **********************************************************\n\n");


}