Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
GPIAG-Software
IFOS3D
Commits
4049eecd
Commit
4049eecd
authored
Jun 20, 2016
by
Tilman Steinweg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed old .inp file reading
parent
f337698d
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
5 additions
and
842 deletions
+5
-842
par/in_and_out/ifos3d.inp
par/in_and_out/ifos3d.inp
+0
-193
par/in_and_out/ifos3d_toy.inp
par/in_and_out/ifos3d_toy.inp
+0
-193
src/Makefile
src/Makefile
+0
-3
src/fd.h
src/fd.h
+0
-2
src/ifos3d.c
src/ifos3d.c
+1
-1
src/part_model.c
src/part_model.c
+2
-1
src/read_par.c
src/read_par.c
+0
-448
src/snapmerge.c
src/snapmerge.c
+2
-1
No files found.
par/in_and_out/ifos3d.inp
deleted
100644 → 0
View file @
f337698d
#-----------------------------------------------------------------
# PARAMETER FILE FOR IFOS3D
#-----------------------------------------------------------------
#
# Note that y denotes the vertical direction !
#
#-----------------------------------------------------------------------------------
#------------------------ MODELING PARAMETERS --------------------------------------
#-----------------------------------------------------------------------------------
#
#-------------- Domain Decomposition -----------------------------
number_of_processors_in_x-direction_(NPROCX) = 2
number_of_processors_in_y-direction_(NPROCY) = 2
number_of_processors_in_z-direction_(NPROCZ) = 2
#
#-------------------- 3-D Grid -----------------------------------
number_of_gridpoints_in_x-direction_(NX) = 160
number_of_gridpoints_in_y-direction_(NY) = 184
number_of_gridpoints_in_z-direction_(NZ) = 160
distance_between_gridpoints(in_m)_in_x-direction_(DX) = 0.8
distance_between_gridpoints(in_m)_in_y-direction_(DY) = 0.8
distance_between_gridpoints(in_m)_in_z-direction_(DZ) = 0.8
#
# Caution: first gridpoint is not at {0.0,0.0,0.0} but at {dx,dy,dz}!
#
#------------------- Order of FD Operator -----------------------
order_of_spatial_fd_operators_(FDORDER) = 4
# possible values are 2, 4, 6, 8, 10, 12
fd_coefficients_(Taylor=1;Holberg=2)_(FDCOEFF) = 2
#
#-------------------Time Stepping -------------------------------
time_of_wave_propagation_(in_sec)_(TIME) = 0.06
timestep_(in_seconds)_(DT) = 5.0e-5
#
#--------------------Source---------------------------------------
# Shape_of_source-signal:
(ricker=1;fumue=2;from_SIGNAL_FILE=3;SIN**3=4;deltapulse=5)_(SOURCE_SHAPE) = 4
point_source_(explosive=1;force_in_x=2;in_z=3;in_y=4;custom=5)_(SOURCE_TYPE) = 4
# If SOURCE_TYPE <5 the following two lines are ignored
force_angle_between_x_y_(in_degree)_(ALPHA) = 45.0
force_angle_between_x_z_(in_degree)_(BETA) = 45.0
# Plane wave (PW) excitation,if PLANE_WAVE_DEPTH>0, SRCREC is treated as 0
depth_of_PW_excitation_(no<=0)_(in_meter)_(PLANE_WAVE_DEPTH) = 0.0
dip_of_PW_from_vertical_(in_degrees)_(PHI) =0.0
duration_of_source-signal_PW_(in_seconds)_(TS) = 0.0033
# External signal input instead of SOURCE_SHAPE
SIGNAL_FILE = ?
read_source_positions_from_SOURCE_FILE_(yes=1)_(SRCREC) = 1
SOURCE_FILE = ./sources/sources_toy.dat
run_multiple_shots_defined_in_SOURCE_FILE_(yes=1)_(RUN_MULTIPLE_SHOTS) = 1
#--------------------- Model (Input) -------------------------------------
read_model_from_MFILE(yes=1)(READMOD) = 0
MFILE = model/toy
#
#---------------------Q-approximation-----------------------------
Number_of_relaxation_mechanisms_(L) = 0
# (L=0: elastic, FWI only tested for L=0)
L_Relaxation_frequencies_(FL) = 1000.0
Tau_value_for_entire_model_(TAU) = 0.000001
#
#----------------------Free Surface-------------------------------
free_surface_(yes=1)(FREE_SURF) = 0
#
#--------------------Absorbing Boundary---------------------------
# exponential damping applied
type_of_boundary_condition_(ABS_TYPE)_(PML=1/ABS=2) = 1
width_of_absorbing_frame_(in_grid_points)_(No<=0)_(FW) = 10
percentage_of_amplitude_decay_at_outer_edge_(DAMPING) = 8.0
# parameter for PML:
Dominant_frequency_(in_Hz)_(FPML) = 200.0
P_wave_velocity_near_the_grid_boundary(in_m/s)_(VPPML) = 6200.0
# apply_periodic_boundary_condition_at_edges_(BOUNDARY):
(no=0)_(left/right/front/back=1) = 0
#
#----------------------Snapshots----------------------------------
output_of_snapshots_(SNAP)(yes>0) = 0
# output of particle velocities: SNAP=1
# output of pressure field: SNAP=2
# output of curl and divergence energy: SNAP=3
# output of both particle velocities and energy : SNAP=4
first_snapshot_(in_sec)_(TSNAP1) = 0.01
last_snapshot_(in_sec)_(TSNAP2) = 0.24
increment_(in_sec)_(TSNAPINC) = 0.0075
# Note that y denotes the vertical direction !
increment_x-direction_(IDX) = 1
increment_y-direction_(IDY) = 1
increment_z-direction_(IDZ) = 1
data-format_(SNAP_FORMAT)(ASCII(2);BINARY(3)) = 4
basic_filename_(SNAP_FILE) = ./snap/back
#output will look like SNAP_FILE.bin.z.000
#if SNAP = 1,2 the following line is ignored
(SNAP_PLANE) = 1
#output of snapshots as energy wihout sign SNAP_PLANE=1
#energy with sign true for x-y-plane SNAP_PLANE=2
#energy with sign true for x-z-plane SNAP_PLANE=3
#energy with sign true for z-y-plane SNAP_PLANE=4
#
#----------------------Receiver-----------------------------------
output_of_seismograms_(SEISMO) = 1
# SEISMO=0: no seismograms
# SEISMO=1: particle-velocities
# SEISMO=2: pressure (hydrophones)
# SEISMO=3: curl and div
# SEISMO=4: everything
# Warning: "curl" is not really curl in 3D
read_receiver_positions_(READREC) = 2
# receiver line READREC=0
# from_file READREC=1
# rec array READREC=2
REC_FILE = ./receiver/receiver.dat
reference_point_for_receiver_coordinate_system_(REFREC) = 0.0 , 0.0 , 0.0
# if READREC=1 the following receiver options are ignored
# Note that y denotes the vertical direction !
#
# --------------------Receiver line -------------------------------
position_of_first_receiver_(in_m)_(XREC1,YREC1,ZREC1) = 90.0 , 90.0 , 90.0
position_of_last_receiver_(in_m)_(XREC2,YREC2,ZREC2) = 90.0 , 90.0 , 90.0
distance_between_two_adjacent_receivers_(in_gridpoints)_(NGEOPH) = 1
# (Caution: receivers outside the grid may cause surprising results!)
#
#-------------------- Receiver array -------------------------------
# parameters for horizontal plane of receivers
number_of_planes_(no<=0)_(REC_ARRAY) = 1
depth_of_first_(upper)_plane_(in_m)_(REC_ARRAY_DEPTH) = 24.0
vertical_distance_between_planes_(in_m)_(REC_ARRAY_DIST) = 30.0
distance_between_receivers_in_x-direction_(in_gridpoints)_(DRX) = 10
distance_between_receivers_in_y-direction_(in_gridpoints)_(DRZ) = 10
#
#-------------------- Seismogram Output-----------------------------
samplingrate_and_timelag_(in_timesteps!)_(NDT,NDTSHIFT) = 1 , 0
# write every (ndt)th sample, leaving ndtshift samples at the beginning out
# default: ndt=1 and ndtshift=0. (ndt=0 is set to ndt=1, ndt<0 are set to -ndt.)
#
data-format_(SEIS_FORMAT[6]) = 1
# 0: SEG-Y (ASCII-text/native 4-byte-floats (IEEE on PC)/little endian on PC)
# 1: SU (native 4-byte-floats (IEEE on PC)/little endian on PC)
# 2: TEXTUAL (native ASCII)
# 3: BINARY (IEEE-4-byte-floats on PC/little endian on PC)
# 4: SEG-Y (ASCII-text/native 4-byte-floats (IEEE on PC)/little endian on PC)
# 5: SEG-Y (ASCII-text/IBM-4-byte-floats on PC/big endian on PC)
#
basic_filename_(SEIS_FILE) = ./su/cal_toy
#
#------------------------ Method --------------------------------
#
method_(METHOD) = 0
# 0: only forward simulation
# 1: conjugate_gradient_FWI
#
#-----------------------------------------------------------------------------------
#------------------------ INVERSION PARAMETERS --------------------------------------
#-----------------------------------------------------------------------------------
#
#-------------------------In- and Output Files--------------------------------------
gradient_filename_(GRAD_FILE) = ./grad/toy_grad
model_output_filename_(MOD_OUT_FILE) = ./model/toy
observed_data_fileneame_(SEIS_OBS_FILE) = ./su_obs/obs_toy
external_or_internal_observed_data_(EXTOBS) = 0
inversion_parameter_file_(INV_FILE) = ./in_and_out/workflow_toy.dat
hessian_file_(HESS_FILE) = ./hess/toy_hess
#
#-------------------------General---------------------------------------------------
minimum/maximum_iteration_number_(>0)_(ITMIN,ITMAX) = 1 , 80
filtering_(yes=1/no=0)_(FILT) = 1
maximum_number_frequencies_per_iteration_(NFMAX) = 5
number_of_timestep_per_period_used_for_inversion_(TAST) = 100
average_model_parameter_(VP0,VS0,RHO0) = 6200.0, 3600.0, 2800.0
# velocities in m/s, density in kg/m³
parameter_class_weighting_factors_for_vp/vs/rho_(WEIGHT) = 1.0, 1.0, 0.0
# choose from 1.0 (full update) to 0.0 (no update)
#
#------------------------Steplength estimation----------------------------------------
number_of_shots_used_for_steplength_estimation_(NSHOTS_STEP) = 4
initial_test_steplength_(TESTSTEP) = 0.02
#
#------------------------Gradient preconditioning-------------------------------------
Type_of_preconditioning_(DAMPTYPE) = 2
# 0: no damping
# 1: Circular taper around receivers
# 2: Cicular taper around sources and receivers
# 3: Tapering of source and receiver planes
#
#------------------------Hessian ----------------------------------------
Apply_Hessian_(yes=1/no=0)_(HESS) = 0
Read_Hessian_from_file_(READ_HESS) = 0
Part_of_receivers_used_for_Hessian_(REC_HESS) = 1
#(Each REC_HESS Receiver is used to calculate the Hessian, not yet implemented)
Water_level_Hessian_for_vp/vs/rho_(WATER_HESS) = 0.0192, 0.0192, 1.0e-14
#
#------------------------L-BFGS ----------------------------------------
Apply_L_BFGS_(LBFGS) = 0
Number_of_inverted_parameters_(NUMPAR) = 2
Number_iterations_used_for_LBFGS_(BFGSNUM) = 5
\ No newline at end of file
par/in_and_out/ifos3d_toy.inp
deleted
100644 → 0
View file @
f337698d
#-----------------------------------------------------------------
# PARAMETER FILE FOR IFOS3D
#-----------------------------------------------------------------
#
# Note that y denotes the vertical direction !
#
#-----------------------------------------------------------------------------------
#------------------------ MODELING PARAMETERS --------------------------------------
#-----------------------------------------------------------------------------------
#
#-------------- Domain Decomposition -----------------------------
number_of_processors_in_x-direction_(NPROCX) = 2
number_of_processors_in_y-direction_(NPROCY) = 2
number_of_processors_in_z-direction_(NPROCZ) = 2
#
#-------------------- 3-D Grid -----------------------------------
number_of_gridpoints_in_x-direction_(NX) = 160
number_of_gridpoints_in_y-direction_(NY) = 184
number_of_gridpoints_in_z-direction_(NZ) = 160
distance_between_gridpoints(in_m)_in_x-direction_(DX) = 0.8
distance_between_gridpoints(in_m)_in_y-direction_(DY) = 0.8
distance_between_gridpoints(in_m)_in_z-direction_(DZ) = 0.8
#
# Caution: first gridpoint is not at {0.0,0.0,0.0} but at {dx,dy,dz}!
#
#------------------- Order of FD Operator -----------------------
order_of_spatial_fd_operators_(FDORDER) = 4
# possible values are 2, 4, 6, 8, 10, 12
fd_coefficients_(Taylor=1;Holberg=2)_(FDCOEFF) = 2
#
#-------------------Time Stepping -------------------------------
time_of_wave_propagation_(in_sec)_(TIME) = 0.06
timestep_(in_seconds)_(DT) = 5.0e-5
#
#--------------------Source---------------------------------------
# Shape_of_source-signal:
(ricker=1;fumue=2;from_SIGNAL_FILE=3;SIN**3=4;deltapulse=5)_(SOURCE_SHAPE) = 4
point_source_(explosive=1;force_in_x=2;in_z=3;in_y=4;custom=5)_(SOURCE_TYPE) = 4
# If SOURCE_TYPE <5 the following two lines are ignored
force_angle_between_x_y_(in_degree)_(ALPHA) = 45.0
force_angle_between_x_z_(in_degree)_(BETA) = 45.0
# Plane wave (PW) excitation,if PLANE_WAVE_DEPTH>0, SRCREC is treated as 0
depth_of_PW_excitation_(no<=0)_(in_meter)_(PLANE_WAVE_DEPTH) = 0.0
dip_of_PW_from_vertical_(in_degrees)_(PHI) =0.0
duration_of_source-signal_PW_(in_seconds)_(TS) = 0.0033
# External signal input instead of SOURCE_SHAPE
SIGNAL_FILE = ?
read_source_positions_from_SOURCE_FILE_(yes=1)_(SRCREC) = 1
SOURCE_FILE = ./sources/sources_toy.dat
run_multiple_shots_defined_in_SOURCE_FILE_(yes=1)_(RUN_MULTIPLE_SHOTS) = 1
#--------------------- Model (Input) -------------------------------------
read_model_from_MFILE(yes=1)(READMOD) = 0
MFILE = model/toy
#
#---------------------Q-approximation-----------------------------
Number_of_relaxation_mechanisms_(L) = 0
# (L=0: elastic, FWI only tested for L=0)
L_Relaxation_frequencies_(FL) = 1000.0
Tau_value_for_entire_model_(TAU) = 0.000001
#
#----------------------Free Surface-------------------------------
free_surface_(yes=1)(FREE_SURF) = 0
#
#--------------------Absorbing Boundary---------------------------
# exponential damping applied
type_of_boundary_condition_(ABS_TYPE)_(PML=1/ABS=2) = 1
width_of_absorbing_frame_(in_grid_points)_(No<=0)_(FW) = 10
percentage_of_amplitude_decay_at_outer_edge_(DAMPING) = 8.0
# parameter for PML:
Dominant_frequency_(in_Hz)_(FPML) = 200.0
P_wave_velocity_near_the_grid_boundary(in_m/s)_(VPPML) = 6200.0
# apply_periodic_boundary_condition_at_edges_(BOUNDARY):
(no=0)_(left/right/front/back=1) = 0
#
#----------------------Snapshots----------------------------------
output_of_snapshots_(SNAP)(yes>0) = 0
# output of particle velocities: SNAP=1
# output of pressure field: SNAP=2
# output of curl and divergence energy: SNAP=3
# output of both particle velocities and energy : SNAP=4
first_snapshot_(in_sec)_(TSNAP1) = 0.01
last_snapshot_(in_sec)_(TSNAP2) = 0.24
increment_(in_sec)_(TSNAPINC) = 0.0075
# Note that y denotes the vertical direction !
increment_x-direction_(IDX) = 1
increment_y-direction_(IDY) = 1
increment_z-direction_(IDZ) = 1
data-format_(SNAP_FORMAT)(ASCII(2);BINARY(3)) = 4
basic_filename_(SNAP_FILE) = ./snap/back
#output will look like SNAP_FILE.bin.z.000
#if SNAP = 1,2 the following line is ignored
(SNAP_PLANE) = 1
#output of snapshots as energy wihout sign SNAP_PLANE=1
#energy with sign true for x-y-plane SNAP_PLANE=2
#energy with sign true for x-z-plane SNAP_PLANE=3
#energy with sign true for z-x-plane SNAP_PLANE=4
#
#----------------------Receiver-----------------------------------
output_of_seismograms_(SEISMO) = 1
# SEISMO=0: no seismograms
# SEISMO=1: particle-velocities
# SEISMO=2: pressure (hydrophones)
# SEISMO=3: curl and div
# SEISMO=4: everything
# Warning: "curl" is not really curl in 3D
read_receiver_positions_(READREC) = 2
# receiver line READREC=0
# from_file READREC=1
# rec array READREC=2
REC_FILE = ./receiver/receiver.dat
reference_point_for_receiver_coordinate_system_(REFREC) = 0.0 , 0.0 , 0.0
# if READREC=1 the following receiver options are ignored
# Note that y denotes the vertical direction !
#
# --------------------Receiver line -------------------------------
position_of_first_receiver_(in_m)_(XREC1,YREC1,ZREC1) = 90.0 , 90.0 , 90.0
position_of_last_receiver_(in_m)_(XREC2,YREC2,ZREC2) = 90.0 , 90.0 , 90.0
distance_between_two_adjacent_receivers_(in_gridpoints)_(NGEOPH) = 1
# (Caution: receivers outside the grid may cause surprising results!)
#
#-------------------- Receiver array -------------------------------
# parameters for horizontal plane of receivers
number_of_planes_(no<=0)_(REC_ARRAY) = 1
depth_of_first_(upper)_plane_(in_m)_(REC_ARRAY_DEPTH) = 24.0
vertical_distance_between_planes_(in_m)_(REC_ARRAY_DIST) = 30.0
distance_between_receivers_in_x-direction_(in_gridpoints)_(DRX) = 10
distance_between_receivers_in_y-direction_(in_gridpoints)_(DRZ) = 10
#
#-------------------- Seismogram Output-----------------------------
samplingrate_and_timelag_(in_timesteps!)_(NDT,NDTSHIFT) = 1 , 0
# write every (ndt)th sample, leaving ndtshift samples at the beginning out
# default: ndt=1 and ndtshift=0. (ndt=0 is set to ndt=1, ndt<0 are set to -ndt.)
#
data-format_(SEIS_FORMAT[6]) = 1
# 0: SEG-Y (ASCII-text/native 4-byte-floats (IEEE on PC)/little endian on PC)
# 1: SU (native 4-byte-floats (IEEE on PC)/little endian on PC)
# 2: TEXTUAL (native ASCII)
# 3: BINARY (IEEE-4-byte-floats on PC/little endian on PC)
# 4: SEG-Y (ASCII-text/native 4-byte-floats (IEEE on PC)/little endian on PC)
# 5: SEG-Y (ASCII-text/IBM-4-byte-floats on PC/big endian on PC)
#
basic_filename_(SEIS_FILE) = ./su_obs/obs_toy
#
#------------------------ Method --------------------------------
#
method_(METHOD) = 0
# 0: only forward simulation
# 1: conjugate_gradient_FWI
#
#-----------------------------------------------------------------------------------
#------------------------ INVERSION PARAMETERS --------------------------------------
#-----------------------------------------------------------------------------------
#
#-------------------------In- and Output Files--------------------------------------
gradient_filename_(GRAD_FILE) = ./grad/toy_grad
model_output_filename_(MOD_OUT_FILE) = ./model/toy
observed_data_fileneame_(SEIS_OBS_FILE) = ./su_obs/obs_toy
external_or_internal_observed_data_(EXTOBS) = 0
inversion_parameter_file_(INV_FILE) = ./in_and_out/workflow_toy.dat
hessian_file_(HESS_FILE) = ./hess/toy_hess
#
#-------------------------General---------------------------------------------------
minimum/maximum_iteration_number_(>0)_(ITMIN,ITMAX) = 1 , 60
filtering_(yes=1/no=0)_(FILT) = 0
maximum_number_frequencies_per_iteration_(NFMAX) = 5
number_of_timestep_per_period_used_for_inversion_(TAST) = 100
average_model_parameter_(VP0,VS0,RHO0) = 6200.0, 3600.0, 2800.0
# velocities in m/s, density in kg/m³
parameter_class_weighting_factors_for_vp/vs/rho_(WEIGHT) = 1.0, 1.0, 0.0
# choose from 1.0 (full update) to 0.0 (no update)
#
#------------------------Steplength estimation----------------------------------------
number_of_shots_used_for_steplength_estimation_(NSHOTS_STEP) = 4
initial_test_steplength_(TESTSTEP) = 0.02
#
#------------------------Gradient preconditioning-------------------------------------
Type_of_preconditioning_(DAMPTYPE) = 2
# 0: no damping
# 1: Circular taper around receivers
# 2: Circular taper around sources and receivers
# 3: Tapering of source and receiver planes
#
#------------------------Hessian ----------------------------------------
Apply_Hessian_(yes=1/no=0)_(HESS) = 0
Read_Hessian_from_file_(READ_HESS) = 0
Part_of_receivers_used_for_Hessian_(REC_HESS) = 1
#(Each REC_HESS Receiver is used to calculate the Hessian, not yet implemented)
Water_level_Hessian_for_vp/vs/rho_(WATER_HESS) = 0.0192, 0.0192, 1.0e-14
#
#------------------------L-BFGS ----------------------------------------
Apply_L_BFGS_(LBFGS) = 0
Number_of_inverted_parameters_(NUMPAR) = 2
Number_iterations_used_for_LBFGS_(BFGSNUM) = 5
src/Makefile
View file @
4049eecd
...
...
@@ -56,7 +56,6 @@ SNAPMERGE_SCR = \
snapmerge.c
\
merge.c
\
json_parser.c
\
read_par.c
\
read_par_json.c
\
readdsk.c
\
writedsk.c
\
...
...
@@ -64,7 +63,6 @@ SNAPMERGE_SCR = \
PARTMODEL_SCR
=
\
part_model.c
\
read_par.c
\
read_par_json.c
\
util.c
...
...
@@ -82,7 +80,6 @@ IFOS_UTIL = \
output_source_signal.c
\
rd_sour.c
\
readdsk.c
\
read_par.c
\
json_parser.c
\
read_par_json.c
\
exchange_par.c
\
...
...
src/fd.h
View file @
4049eecd
...
...
@@ -181,8 +181,6 @@ float *** bufferfro_to_bac, float *** bufferbac_to_fro, MPI_Request * req_send,
float
readdsk
(
FILE
*
fp_in
,
int
format
);
int
read_par
(
FILE
*
fp
);
void
read_par_json
(
FILE
*
fp
,
char
*
fileinp
);
void
readmod_acoustic
(
float
***
rho
,
float
***
pi
,
int
ishot
);
...
...
src/ifos3d.c
View file @
4049eecd
...
...
@@ -134,7 +134,7 @@ int main(int argc, char **argv){
fclose
(
FP
);
}
else
{
//read "old" input file *.inp, might not work in future
read_par
(
FP
);
err
(
" Old Input files (.inp) are no longer supported.
\n
Please use .json input files instead.
\n\n
"
);
}
}
...
...
src/part_model.c
View file @
4049eecd
...
...
@@ -57,7 +57,8 @@ fileinp = argv[1];
}
else
{
//read "old" input file *.inp, might not work in future
read_par
(
FP
);
err
(
" Old Input files (.inp) are no longer supported.
\n
Please use .json input files instead.
\n\n
"
);
}
...
...
src/read_par.c
deleted
100644 → 0
View file @
f337698d
/*------------------------------------------------------------------------
* Copyright (C) 2015 For the list of authors, see file AUTHORS.
*
* This file is part of IFOS3D.
*
* 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.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with IFOS3D. See file COPYING and/or
* <http://www.gnu.org/licenses/gpl-2.0.html>.
--------------------------------------------------------------------------*/
/*---------------------------------------------------------------
* Reading FD-Parameters from input-file
----------------------------------------------------------------*/
#include "fd.h"
int
read_par
(
FILE
*
fp_in
){
/* declaration of extern variables */
extern
int
NX
,
NY
,
NZ
,
SOURCE_SHAPE
,
SOURCE_TYPE
,
SNAP
,
SNAP_FORMAT
,
SNAP_PLANE
;
extern
int
DRX
,
DRZ
,
L
,
SRCREC
,
FDORDER
,
FW
,
FDCOEFF
;
extern
float
DX
,
DY
,
DZ
,
TIME
,
DT
,
TS
,
*
FL
,
TAU
,
PLANE_WAVE_DEPTH
,
PHI
;
extern
float
XREC1
,
XREC2
,
YREC1
,
YREC2
,
ZREC1
,
ZREC2
,
ALPHA
,
BETA
;
extern
float
REC_ARRAY_DEPTH
,
REC_ARRAY_DIST
;
extern
int
SEISMO
,
NDT
,
NDTSHIFT
,
NGEOPH
,
SEIS_FORMAT
[
6
],
FREE_SURF
,
READMOD
,
MOD_FORMAT
,
READREC
,
RUN_MULTIPLE_SHOTS
;
extern
int
BOUNDARY
,
REC_ARRAY
,
LOG
,
IDX
,
IDY
,
IDZ
,
ABS_TYPE
;
extern
float
TSNAP1
,
TSNAP2
,
TSNAPINC
,
REFREC
[
4
],
DAMPING
,
FPML
,
VPPML
;
extern
char
MFILE
[
STRING_SIZE
],
SIGNAL_FILE
[
STRING_SIZE
];
extern
char
SNAP_FILE
[
STRING_SIZE
],
SOURCE_FILE
[
STRING_SIZE
],
REC_FILE
[
STRING_SIZE
];
extern
char
SEIS_FILE
[
STRING_SIZE
],
GRAD_FILE
[
STRING_SIZE
],
SEIS_OBS_FILE
[
STRING_SIZE
],
INV_FILE
[
STRING_SIZE
];
extern
int
NPROCX
,
NPROCY
,
NPROCZ
;
extern
int
ASCIIEBCDIC
,
LITTLEBIG
,
IEEEIBM
;
extern
float
FC
,
AMP
,
REFSRC
[
3
],
SRC_DT
,
SRCTSHIFT
;
extern
int
SRC_MF
,
SIGNAL_FORMAT
,
SRCOUT_PAR
[
6
],
FSRC
,
JSRC
,
LSRC
;
extern
char
SRCOUT_FILE
[
STRING_SIZE
];
extern
char
MOD_OUT_FILE
[
STRING_SIZE
],
HESS_FILE
[
STRING_SIZE
];
extern
int
METHOD
;
extern
int
ITMIN
,
ITMAX
,
FILT
,
NFMAX
,
TAST
,
NSHOTS_STEP
,
DAMPTYPE
,
HESS
,
READ_HESS
,
REC_HESS
,
EXTOBS
,
LBFGS
;
/*extern float F_INV;*/
extern
float
TESTSTEP
,
WATER_HESS
[
3
],
WEIGHT
[
3
],
VP0
,
VS0
,
RHO0
;
extern
int
BFGSNUM
,
NUMPAR
;
extern
int
VERBOSE
;
/* definition of local variables */
char
s
[
256
],
cline
[
256
]
=
""
;
int
lineno
=
0
,
l
,
nvarin
=
0
;
//Default Value for Verbose Mode
VERBOSE
=
1
;
if
(
fp_in
==
NULL
)
err
(
" Could not open input parameter file (ifos3d.inp)! "
);
while
(
fgets
(
cline
,
255
,
fp_in
)){
/* leaves via break */
/* If there are more than 255 characters in one line, this does not work. */
if
(
cline
[
0
]
!=
'#'
){
/* no comment line */
lineno
++
;
/* fprintf(stderr,"Reading Linenumber %i\n",lineno); */
switch
(
lineno
){
case
1
:
sscanf
(
cline
,
"%s =%i"
,
s
,
&
NPROCX
);
break
;
case
2
:
sscanf
(
cline
,
"%s =%i"
,
s
,
&
NPROCY
);
break
;
case
3
:
sscanf
(
cline
,
"%s =%i"
,
s
,
&
NPROCZ
);
break
;
case
4
:
sscanf
(
cline
,
"%s =%i"
,
s
,
&
NX
);
break
;
case
5
:
sscanf
(
cline
,
"%s =%i"
,
s
,
&
NY
);
break
;
case
6
:
sscanf
(
cline
,
"%s =%i"
,
s
,
&
NZ
);
break
;
case
7
:
sscanf
(
cline
,
"%s =%f"
,
s
,
&
DX
);
break
;
case
8
:
sscanf
(
cline
,
"%s =%f"
,
s
,
&
DY
);
break
;
case
9
:
sscanf
(
cline
,
"%s =%f"
,
s
,
&
DZ
);
break
;
case
10
:
sscanf
(
cline
,
"%s =%i"
,
s
,
&
FDORDER
);
break
;
case
11
:
sscanf
(
cline
,
"%s =%i"
,
s
,
&
FDCOEFF
);
break
;
case
12
:
sscanf
(
cline
,
"%s =%f"
,
s
,
&
TIME
);
break
;
case
13
:
sscanf
(
cline
,
"%s =%f"
,
s
,
&
DT
);
break
;
case
14
:
nvarin
=
sscanf
(
cline
,
"%s =%i , %f , %f"
,
s
,
&
SOURCE_SHAPE
,
&
FC
,
&
AMP
);
switch
(
nvarin
){
case
0
:
case
1
:
SOURCE_SHAPE
=
0
;
/* fprintf(stderr," Caution: SOURCE_SHAPE set to %d.\n",SOURCE_SHAPE); */
case
2
:
FC
=
0
.
0
;
/* fprintf(stderr," FC set to %d.\n",FC); */
case
3
:
AMP
=
1
.
0
;
/* fprintf(stderr," AMP set to %d.\n",AMP); */
/* case 4: break;
default: fprintf(stderr,"This line of read_par.c should never be reached! [1]\n"); */
}
break
;
case
15
:
sscanf
(
cline
,
"%s =%i"
,
s
,
&
SOURCE_TYPE
);
break
;
case
16
:
sscanf
(
cline
,
"%s =%f"
,
s
,
&
ALPHA
);
break
;
case
17
:
sscanf
(
cline
,
"%s =%f"
,
s
,
&
BETA
);
break
;
case
18
:
sscanf
(
cline
,
"%s =%f"
,
s
,
&
PLANE_WAVE_DEPTH
);
break
;
case
19
:
sscanf
(
cline
,
"%s =%f"
,
s
,
&
PHI
);
break
;
case
20
:
/* TS has to remain for the plane wave excitation*/
nvarin
=
sscanf
(
cline
,
"%s =%f , %f"
,
s
,
&
TS
,
&
SRC_DT
);
switch
(
nvarin
){
case
0
:
case
1
:
TS
=
0
;
/* to be determined from input data */
case
2
:
SRC_DT
=
DT
;
}
break
;
case
21
:
nvarin
=
sscanf
(
cline
,
"%s =%s , %i "
,
s
,
SIGNAL_FILE
,
&
SIGNAL_FORMAT
);
switch
(
nvarin
){
case
0
:
case
1
:
strcpy
(
SIGNAL_FILE
,
"
\0
"
);
case
2
:
SIGNAL_FORMAT
=
0
;
/* case 8: break;
default: fprintf(stderr,"This line of read_par.c should never be reached! [2]\n");*/
}
break
;
case
22
:
nvarin
=
sscanf
(
cline
,
"%s =%i , %i , %f , %f , %f"
,
s
,
&
SRCREC
,
&
SRC_MF
,
&
REFSRC
[
0
],
&
REFSRC
[
1
],
&
REFSRC
[
2
]);
switch
(
nvarin
){
case
0
:
case
1
:
SRCREC
=
0
;
/* default: do not read source positions from file */
case
2
:
SRC_MF
=
0
;
/* source positions in meter */
case
3
:
REFSRC
[
0
]
=
0
.
0
;
/* Reference x-coordinate */
case
4
:
REFSRC
[
1
]
=
0
.
0
;
/* Reference y-coordinate (vertical!)*/
case
5
:
REFSRC
[
2
]
=
0
.
0
;
/* Reference z-coordinate */
}
break
;
case
23
:
nvarin
=
sscanf
(
cline
,
"%s =%s , %s , %i , %i , %i , %i , %i , %i"
,
s
,
SOURCE_FILE
,
SRCOUT_FILE
,
&
SRCOUT_PAR
[
0
],
&
SRCOUT_PAR
[
1
],
&
SRCOUT_PAR
[
2
],
&
SRCOUT_PAR
[
3
],
&
SRCOUT_PAR
[
4
],
&
SRCOUT_PAR
[
5
]);
switch
(
nvarin
){
case
0
:
case
1
:
strcpy
(
SOURCE_FILE
,
"
\0
"
);
case
2
:
strcpy
(
SRCOUT_FILE
,
"
\0
"
);
case
3
:
SRCOUT_PAR
[
0
]
=
0
;
case
4
:
SRCOUT_PAR
[
1
]
=
0
;
case
5
:
SRCOUT_PAR
[
2
]
=
0
;
case
6
:
SRCOUT_PAR
[
3
]
=
0
;
case
7
:
SRCOUT_PAR
[
4
]
=
0
;
case
8
:
SRCOUT_PAR
[
5
]
=
0
;
}
break
;
case
24
:
nvarin
=
sscanf
(
cline
,
"%s =%i , %f , %i , %i , %i"
,
s
,
&
RUN_MULTIPLE_SHOTS
,
&
SRCTSHIFT
,
&
FSRC
,
&
JSRC
,
&
LSRC
);
switch
(
nvarin
){
case
0
:
case
1
:
RUN_MULTIPLE_SHOTS
=
1
;
case
2
:
SRCTSHIFT
=
0
.
0
;
case
3
:
FSRC
=
0
;
case
4
:
JSRC
=
1
;
case
5
:
LSRC
=
2147483647
;
/* max int */
}
break
;
case
25
: