Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
IFOS2D
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
4
Issues
4
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Environments
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
GPIAG-Software
IFOS2D
Commits
a98a59f2
Commit
a98a59f2
authored
Oct 05, 2015
by
laura.gassner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bugs in snapmerge.c and exchange_par.c, and made a few other minor adjustments.
parent
e3375c7d
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
495 additions
and
487 deletions
+495
-487
genmod/toy_example_ac_start.c
genmod/toy_example_ac_start.c
+121
-55
par/in_and_out/DENISE_FW_all_parameters.json
par/in_and_out/DENISE_FW_all_parameters.json
+4
-20
par/in_and_out/DENISE_INV_all_parameters.json
par/in_and_out/DENISE_INV_all_parameters.json
+4
-25
par/in_and_out/toy_example/toy_example_ac_INV.json
par/in_and_out/toy_example/toy_example_ac_INV.json
+16
-5
par/model_true/flnodes.toy_example_ac.start
par/model_true/flnodes.toy_example_ac.start
+8
-7
par/run_toy_example_ac.sh
par/run_toy_example_ac.sh
+4
-2
src/calc_res.c
src/calc_res.c
+67
-79
src/denise.c
src/denise.c
+75
-111
src/exchange_par.c
src/exchange_par.c
+4
-4
src/inseis.c
src/inseis.c
+1
-4
src/splitrec.c
src/splitrec.c
+2
-3
src/stf.c
src/stf.c
+66
-53
src/time_window.c
src/time_window.c
+69
-86
src/timedomain_filt.c
src/timedomain_filt.c
+36
-21
src/update_v_acoustic_PML.c
src/update_v_acoustic_PML.c
+12
-8
src/write_par.c
src/write_par.c
+6
-4
No files found.
genmod/toy_example_ac_start.c
View file @
a98a59f2
...
...
@@ -22,34 +22,40 @@
*/
#include "fd.h"
#include "../src/fd.h"
void
model_acoustic
(
float
**
rho
,
float
**
pi
){
/*--------------------------------------------------------------------------*/
/* extern variables */
extern
int
NX
,
NY
,
NXG
,
NYG
,
POS
[
3
],
MYID
;
extern
int
NX
,
NY
,
NXG
,
NYG
,
POS
[
3
],
MYID
,
FDORDER
;
extern
float
DH
,
DT
;
extern
char
MFILE
[
STRING_SIZE
];
extern
char
INV_MODELFILE
[
STRING_SIZE
];
extern
char
MFILE
[
STRING_SIZE
];
extern
char
INV_MODELFILE
[
STRING_SIZE
];
extern
char
TAPER_FILE_NAME
[
STRING_SIZE
],
TAPER_FILE_NAME_RHO
[
STRING_SIZE
];
/* local variables */
float
piv
,
vp
,
rhov
;
int
i
,
j
,
ii
,
jj
,
l
;
/* local variables */
float
piv
,
vp
,
rhov
,
taperv
,
**
taper
;
int
i
,
j
,
ii
,
jj
,
l
,
nd
;
char
modfile
[
STRING_SIZE
];
FILE
*
flfile
;
int
nodes
;
char
cline
[
256
];
float
*
fldepth
,
*
flrho
,
*
flvp
;
float
*
fldepth
,
*
flrho
,
*
flvp
,
*
fltaper
;
nd
=
FDORDER
/
2
+
1
;
/*read FL nodes from File*/
nodes
=
4
;
nodes
=
5
;
fldepth
=
vector
(
1
,
nodes
);
flrho
=
vector
(
1
,
nodes
);
flvp
=
vector
(
1
,
nodes
);
flvp
=
vector
(
1
,
nodes
);
fltaper
=
vector
(
1
,
nodes
);
taper
=
matrix
(
-
nd
+
1
,
NY
+
nd
,
-
nd
+
1
,
NX
+
nd
);
flfile
=
fopen
(
"model_true/flnodes.toy_example_ac.start"
,
"r"
);
if
(
flfile
==
NULL
)
err
(
" FL-file could not be opened !"
);
...
...
@@ -57,7 +63,7 @@ void model_acoustic(float **rho, float **pi){
for
(
l
=
1
;
l
<=
nodes
;
l
++
){
fgets
(
cline
,
255
,
flfile
);
if
(
cline
[
0
]
!=
'#'
){
sscanf
(
cline
,
"%f%f%f
"
,
&
fldepth
[
l
],
&
flrho
[
l
],
&
flvp
[
l
]);
sscanf
(
cline
,
"%f%f%f
%f"
,
&
fldepth
[
l
],
&
flrho
[
l
],
&
flvp
[
l
],
&
fltaper
[
l
]);
}
else
l
=
l
-
1
;
...
...
@@ -82,21 +88,21 @@ void model_acoustic(float **rho, float **pi){
printf
(
"depth: %f m: double node
\n
"
,
fldepth
[
l
]);}}
else
{
for
(
j
=
(
int
)(
fldepth
[
l
]
/
DH
)
+
1
;
j
<=
(
int
)(
fldepth
[
l
+
1
]
/
DH
);
j
++
){
vp
=
0
.
0
;
vp
=
(
DH
*
(
j
-
1
)
-
fldepth
[
l
])
*
(
flvp
[
l
+
1
]
-
flvp
[
l
])
/
(
fldepth
[
l
+
1
]
-
fldepth
[
l
])
+
flvp
[
l
];
vp
=
vp
*
1000
.
0
;
piv
=
vp
;
/* only the PE which belongs to the current global gridpoint
is saving model parameters in his local arrays */
is saving model parameters in his local arrays */
if
((
POS
[
1
]
==
((
i
-
1
)
/
NX
))
&&
(
POS
[
2
]
==
((
j
-
1
)
/
NY
))){
(
POS
[
2
]
==
((
j
-
1
)
/
NY
))){
ii
=
i
-
POS
[
1
]
*
NX
;
jj
=
j
-
POS
[
2
]
*
NY
;
pi
[
jj
][
ii
]
=
piv
;
}
}
...
...
@@ -122,9 +128,53 @@ void model_acoustic(float **rho, float **pi){
}
}
/* loop over global grid - taper */
for
(
i
=
1
;
i
<=
NXG
;
i
++
){
for
(
l
=
1
;
l
<
nodes
;
l
++
){
if
(
fldepth
[
l
]
==
fldepth
[
l
+
1
]){
if
((
i
==
1
)
&&
(
MYID
==
0
)){
printf
(
"depth: %f m: double node
\n
"
,
fldepth
[
l
]);}}
else
{
for
(
j
=
(
int
)(
fldepth
[
l
]
/
DH
)
+
1
;
j
<=
(
int
)(
fldepth
[
l
+
1
]
/
DH
);
j
++
){
taperv
=
0
.
0
;
taperv
=
(
DH
*
(
j
-
1
)
-
fldepth
[
l
])
*
(
fltaper
[
l
+
1
]
-
fltaper
[
l
])
/
(
fldepth
[
l
+
1
]
-
fldepth
[
l
])
+
fltaper
[
l
];
/* only the PE which belongs to the current global gridpoint
is saving model parameters in his local arrays */
if
((
POS
[
1
]
==
((
i
-
1
)
/
NX
))
&&
(
POS
[
2
]
==
((
j
-
1
)
/
NY
))){
ii
=
i
-
POS
[
1
]
*
NX
;
jj
=
j
-
POS
[
2
]
*
NY
;
taper
[
jj
][
ii
]
=
taperv
;
}
}
}
}
for
(
j
=
(
int
)(
fldepth
[
nodes
]
/
DH
)
+
1
;
j
<=
NYG
;
j
++
){
taperv
=
0
.
0
;
taperv
=
fltaper
[
nodes
];
/* only the PE which belongs to the current global gridpoint
is saving model parameters in his local arrays */
if
((
POS
[
1
]
==
((
i
-
1
)
/
NX
))
&&
(
POS
[
2
]
==
((
j
-
1
)
/
NY
))){
ii
=
i
-
POS
[
1
]
*
NX
;
jj
=
j
-
POS
[
2
]
*
NY
;
taper
[
jj
][
ii
]
=
taperv
;
}
}
}
free_vector
(
fldepth
,
1
,
nodes
);
free_vector
(
flrho
,
1
,
nodes
);
free_vector
(
flvp
,
1
,
nodes
);
free_vector
(
fltaper
,
1
,
nodes
);
/**************************************************/
...
...
@@ -160,56 +210,54 @@ void model_acoustic(float **rho, float **pi){
}
/* loop over global grid */
for
(
i
=
1
;
i
<=
NXG
;
i
++
){
for
(
l
=
1
;
l
<
nodes
;
l
++
){
if
(
fldepth
[
l
]
==
fldepth
[
l
+
1
]){
if
((
i
==
1
)
&&
(
MYID
==
0
)){
printf
(
"depth: %f m: double node
\n
"
,
fldepth
[
l
]);
}}
else
{
for
(
j
=
(
int
)(
fldepth
[
l
]
/
DH
)
+
1
;
j
<=
(
int
)(
fldepth
[
l
+
1
]
/
DH
);
j
++
)
{
rhov
=
0
.
0
;
rhov
=
(
DH
*
(
j
-
1
)
-
fldepth
[
l
])
*
(
flrho
[
l
+
1
]
-
flrho
[
l
])
/
(
fldepth
[
l
+
1
]
-
fldepth
[
l
])
+
flrho
[
l
];
rhov
=
rhov
*
1000
.
0
;
/* only the PE which belongs to the current global gridpoint
is saving model parameters in his local arrays */
if
((
POS
[
1
]
==
((
i
-
1
)
/
NX
))
&&
(
POS
[
2
]
==
((
j
-
1
)
/
NY
))){
for
(
i
=
1
;
i
<=
NXG
;
i
++
){
for
(
l
=
1
;
l
<
nodes
;
l
++
){
if
(
fldepth
[
l
]
==
fldepth
[
l
+
1
]){
if
((
i
==
1
)
&&
(
MYID
==
0
)){
printf
(
"depth: %f m: double node
\n
"
,
fldepth
[
l
]);
}
}
else
{
for
(
j
=
(
int
)(
fldepth
[
l
]
/
DH
)
+
1
;
j
<=
(
int
)(
fldepth
[
l
+
1
]
/
DH
);
j
++
){
rhov
=
0
.
0
;
rhov
=
(
DH
*
(
j
-
1
)
-
fldepth
[
l
])
*
(
flrho
[
l
+
1
]
-
flrho
[
l
])
/
(
fldepth
[
l
+
1
]
-
fldepth
[
l
])
+
flrho
[
l
]
;
rhov
=
rhov
*
1000
.
0
;
/* only the PE which belongs to the current global gridpoint
is saving model parameters in his local arrays */
if
((
POS
[
1
]
==
((
i
-
1
)
/
NX
))
&&
(
POS
[
2
]
==
((
j
-
1
)
/
NY
))){
ii
=
i
-
POS
[
1
]
*
NX
;
jj
=
j
-
POS
[
2
]
*
NY
;
rho
[
jj
][
ii
]
=
rhov
;
// pi[jj][ii]=piv;
}
}
}
}
}
for
(
j
=
(
int
)(
fldepth
[
nodes
]
/
DH
)
+
1
;
j
<=
NYG
;
j
++
){
for
(
j
=
(
int
)(
fldepth
[
nodes
]
/
DH
)
+
1
;
j
<=
NYG
;
j
++
){
rhov
=
0
.
0
;
rhov
=
flrho
[
nodes
]
*
1000
.
0
;
/* only the PE which belongs to the current global gridpoint
is saving model parameters in his local arrays */
if
((
POS
[
1
]
==
((
i
-
1
)
/
NX
))
&&
(
POS
[
2
]
==
((
j
-
1
)
/
NY
))){
ii
=
i
-
POS
[
1
]
*
NX
;
jj
=
j
-
POS
[
2
]
*
NY
;
rhov
=
0
.
0
;
rhov
=
flrho
[
nodes
]
*
1000
.
0
;
/* only the PE which belongs to the current global gridpoint
is saving model parameters in his local arrays */
if
((
POS
[
1
]
==
((
i
-
1
)
/
NX
))
&&
(
POS
[
2
]
==
((
j
-
1
)
/
NY
))){
ii
=
i
-
POS
[
1
]
*
NX
;
jj
=
j
-
POS
[
2
]
*
NY
;
rho
[
jj
][
ii
]
=
rhov
;
}
rho
[
jj
][
ii
]
=
rhov
;
}
}
}
free_vector
(
fldepth
,
1
,
nodes
);
free_vector
(
flrho
,
1
,
nodes
);
free_vector
(
flvp
,
1
,
nodes
);
sprintf
(
modfile
,
"%s_rho_it0.bin"
,
INV_MODELFILE
);
writemod
(
modfile
,
rho
,
3
);
...
...
@@ -218,7 +266,7 @@ void model_acoustic(float **rho, float **pi){
MPI_Barrier
(
MPI_COMM_WORLD
);
sprintf
(
modfile
,
"%s_rho_it0.bin.%i%i"
,
INV_MODELFILE
,
POS
[
1
],
POS
[
2
]);
remove
(
modfile
);
sprintf
(
modfile
,
"%s_vp_it0.bin"
,
INV_MODELFILE
);
writemod
(
modfile
,
pi
,
3
);
MPI_Barrier
(
MPI_COMM_WORLD
);
...
...
@@ -226,5 +274,23 @@ void model_acoustic(float **rho, float **pi){
MPI_Barrier
(
MPI_COMM_WORLD
);
sprintf
(
modfile
,
"%s_vp_it0.bin.%i%i"
,
INV_MODELFILE
,
POS
[
1
],
POS
[
2
]);
remove
(
modfile
);
sprintf
(
modfile
,
"%s"
,
TAPER_FILE_NAME
);
writemod
(
modfile
,
taper
,
3
);
MPI_Barrier
(
MPI_COMM_WORLD
);
if
(
MYID
==
0
)
mergemod
(
modfile
,
3
);
MPI_Barrier
(
MPI_COMM_WORLD
);
sprintf
(
modfile
,
"%s.%i%i"
,
TAPER_FILE_NAME
,
POS
[
1
],
POS
[
2
]);
remove
(
modfile
);
sprintf
(
modfile
,
"%s"
,
TAPER_FILE_NAME_RHO
);
writemod
(
modfile
,
taper
,
3
);
MPI_Barrier
(
MPI_COMM_WORLD
);
if
(
MYID
==
0
)
mergemod
(
modfile
,
3
);
MPI_Barrier
(
MPI_COMM_WORLD
);
sprintf
(
modfile
,
"%s.%i%i"
,
TAPER_FILE_NAME_RHO
,
POS
[
1
],
POS
[
2
]);
remove
(
modfile
);
free_matrix
(
taper
,
-
nd
+
1
,
NY
+
nd
,
-
nd
+
1
,
NX
+
nd
);
}
par/in_and_out/DENISE_FW_all_parameters.json
View file @
a98a59f2
...
...
@@ -32,15 +32,11 @@
"QUELLTYP"
:
"3"
,
"QUELLTYP values (point_source): explosive=1;force_in_x=2;force_in_y=3;rotated_force=4"
:
"comment"
,
"SRCREC"
:
"1"
,
"SRCREC values : read source positions from SOURCE_FILE=1, PLANE_WAVE=2"
:
"comment"
,
"SOURCE_FILE"
:
"./source/sources.dat"
,
"RUN_MULTIPLE_SHOTS"
:
"1"
,
"PLANE_WAVE_DEPTH"
:
"0.0"
,
"PHI"
:
"0.0"
,
"TS"
:
"0.032"
,
"Acoustic Computation"
:
"comment"
,
"ACOUSTIC"
:
"1"
,
"Model"
:
"comment"
,
"READMOD"
:
"0"
,
...
...
@@ -91,23 +87,11 @@
"IDY"
:
"1"
,
"SNAP_FORMAT"
:
"3"
,
"SNAP_FILE"
:
"./snap/waveform_forward"
,
"Receiver array"
:
"comment"
,
"REC_ARRAY"
:
"0"
,
"REC_ARRAY_DEPTH"
:
"70.0"
,
"REC_ARRAY_DIST"
:
"40.0"
,
"DRX"
:
"4"
,
"Monitoring the simulation"
:
"comment"
,
"LOG_FILE"
:
"log/2layer.log"
,
"LOG"
:
"1"
,
"Checkpoints"
:
"comment"
,
"CHECKPTREAD"
:
"0"
,
"CHECKPTWRITE"
:
"0"
,
"CHECKPTFILE"
:
"tmp/checkpoint_fdveps"
,
"General inversion parameters"
:
"comment"
,
"INVMAT1"
:
"1"
,
...
...
par/in_and_out/DENISE_INV_all_parameters.json
View file @
a98a59f2
...
...
@@ -32,15 +32,11 @@
"QUELLTYP"
:
"3"
,
"QUELLTYP values (point_source): explosive=1;force_in_x=2;force_in_y=3;rotated_force=4"
:
"comment"
,
"SRCREC"
:
"1"
,
"SRCREC values : read source positions from SOURCE_FILE=1, PLANE_WAVE=2"
:
"comment"
,
"SOURCE_FILE"
:
"./source/sources.dat"
,
"RUN_MULTIPLE_SHOTS"
:
"1"
,
"PLANE_WAVE_DEPTH"
:
"0.0"
,
"PHI"
:
"0.0"
,
"TS"
:
"0.032"
,
"Acoustic Computation"
:
"comment"
,
"ACOUSTIC"
:
"1"
,
"Model"
:
"comment"
,
"READMOD"
:
"0"
,
...
...
@@ -91,30 +87,17 @@
"IDY"
:
"1"
,
"SNAP_FORMAT"
:
"3"
,
"SNAP_FILE"
:
"./snap/waveform_forward"
,
"Receiver array"
:
"comment"
,
"REC_ARRAY"
:
"0"
,
"REC_ARRAY_DEPTH"
:
"70.0"
,
"REC_ARRAY_DIST"
:
"40.0"
,
"DRX"
:
"4"
,
"Monitoring the simulation"
:
"comment"
,
"LOG_FILE"
:
"log/2layer.log"
,
"LOG"
:
"1"
,
"Checkpoints"
:
"comment"
,
"CHECKPTREAD"
:
"0"
,
"CHECKPTWRITE"
:
"0"
,
"CHECKPTFILE"
:
"tmp/checkpoint_fdveps"
,
"General inversion parameters"
:
"comment"
,
"ITERMAX"
:
"10"
,
"DATA_DIR"
:
"su/measured_data/DENISE_real"
,
"INVMAT1"
:
"1"
,
"INVMAT"
:
"0"
,
"INVTYPE"
:
"2"
,
"QUELLTYPB"
:
"1"
,
"MISFIT_LOG_FILE"
:
"L2_LOG.dat"
,
"VELOCITY"
:
"0"
,
...
...
@@ -173,10 +156,6 @@
"Minimum number of iteration per frequency"
:
"comment"
,
"MIN_ITER"
:
"0"
,
"Cosine taper"
:
"comment"
,
"TAPER"
:
"0"
,
"TAPERLENGTH"
:
"10"
,
"Definition of gradient taper geometry"
:
"comment"
,
"SWS_TAPER_GRAD_VERT"
:
"0"
,
"SWS_TAPER_GRAD_HOR"
:
"0"
,
...
...
par/in_and_out/toy_example/toy_example_ac_INV.json
View file @
a98a59f2
...
...
@@ -76,7 +76,7 @@
"TAU"
:
"0.0966"
,
"General inversion parameters"
:
"comment"
,
"ITERMAX"
:
"1"
,
"ITERMAX"
:
"1
00
"
,
"DATA_DIR"
:
"su/measured_data/toy_example_ac"
,
"INVMAT1"
:
"1"
,
"INVMAT"
:
"0"
,
...
...
@@ -124,10 +124,9 @@
"SRTRADIUS"
:
"3.0"
,
"FILTSIZE"
:
"1"
,
"SWS_TAPER_FILE"
:
"1"
,
"TAPER_FILE_NAME"
:
"taper.bin"
,
"TAPER_FILE_NAME_U"
:
"taper_u.bin"
,
"TAPER_FILE_NAME_RHO"
:
"taper_rho.bin"
,
"TAPER_FILE_NAME"
:
"taper/taper.bin"
,
"TAPER_FILE_NAME_U"
:
"taper/taper_u.bin"
,
"TAPER_FILE_NAME_RHO"
:
"taper/taper_rho.bin"
,
"Upper and lower limits for model parameters"
:
"comment"
,
"VPUPPERLIM"
:
"5000"
,
...
...
@@ -156,4 +155,16 @@
"FC_END"
:
"70.0"
,
"FC_INCR"
:
"10.0"
,
"ORDER"
:
"4"
,
"ZERO_PHASE"
:
"1"
,
"Trace killing"
:
"comment"
,
"TRKILL"
:
"0"
,
"TRKILL_FILE"
:
"./trace_kill/trace_kill.dat"
,
"Time windowing and damping"
:
"comment"
,
"TIMEWIN"
:
"0"
,
"PICKS_FILE"
:
"./picked_times/PickedTimes"
,
"TWLENGTH_PLUS"
:
"4.0"
,
"TWLENGTH_MINUS"
:
"0.01"
,
"GAMMA"
:
"100000"
,
}
par/model_true/flnodes.toy_example_ac.start
View file @
a98a59f2
#FLNODE
#converted by MOCOX V1.2 from final.mod.gremlin
# 0.0000 1 0 6371.0000
# depth rho vp
# in m in g/cm^3 in km/s
#4
0.0000 1.0200 1.4800
500.0000 1.0200 1.4800
500.0000 2.0010 1.5000
2000.0000 2.0010 2.5000
# depth rho vp taper
# in m in g/cm^3 in km/s
#5
0.0000 1.0200 1.4800 0
500.0000 1.0200 1.4800 0
500.0000 2.0010 1.5000 0
550.0000 2.0010 1.5000 1
2000.0000 2.0010 2.5000 1
par/run_toy_example_ac.sh
View file @
a98a59f2
...
...
@@ -40,5 +40,7 @@ mpirun -np 4 nice -19 ../bin/denise in_and_out/toy_example/toy_example_ac_INV.js
make clean
# rm jacobian/toy_example/*.old.*.*
# rm model/toy_example/*.bin.*.*
rm
jacobian/toy_example/
*
toy_example
*
.
*
.
*
.
*
rm
model/
*
.bin.
*
.
*
rm
model/toy_example/
*
.bin.
*
.
*
rm
taper/
*
.bin.
*
.
*
\ No newline at end of file
src/calc_res.c
View file @
a98a59f2
...
...
@@ -38,13 +38,15 @@ float intseis_s, intseis_sd;
float
*
picked_times
=
NULL
;
float
**
intseis_section
=
NULL
,
**
intseis_sectiondata
=
NULL
;
float
**
intseis_sectiondata_envelope
=
NULL
,
**
intseis_section_envelope
=
NULL
,
**
intseis_section_hilbert
=
NULL
,
**
dummy_1
=
NULL
,
**
dummy_2
=
NULL
;
if
(
LNORM
==
8
){
intseis_section_envelope
=
matrix
(
1
,
ntr
,
1
,
ns
);
intseis_sectiondata_envelope
=
matrix
(
1
,
ntr
,
1
,
ns
);
intseis_section_hilbert
=
matrix
(
1
,
ntr
,
1
,
ns
);
dummy_1
=
matrix
(
1
,
ntr
,
1
,
ns
);
dummy_1
=
matrix
(
1
,
ntr
,
1
,
ns
);
dummy_2
=
matrix
(
1
,
ntr
,
1
,
ns
);
}
}
intseis_section
=
matrix
(
1
,
ntr
,
1
,
ns
);
/* declaration of variables for integration */
intseis_sectiondata
=
matrix
(
1
,
ntr
,
1
,
ns
);
if
(
TIMEWIN
)
picked_times
=
vector
(
1
,
ntr
);
/* declaration of variables for TIMEWIN */
...
...
@@ -53,13 +55,12 @@ if(TIMEWIN) picked_times = vector(1,ntr); /* declaration of variables for TIMEWI
umax
=
ntr
*
ns
;
zero
(
&
sectiondiff
[
1
][
1
],
umax
);
/* TRACE KILLING */
int
**
kill_tmp
,
*
kill_vector
;
/* declaration of variables for trace killing */
char
trace_kill_file
[
STRING_SIZE
];
FILE
*
ftracekill
;
if
(
TRKILL
==
1
){
/* sectiondiff will be set to zero */
umax
=
ntr
*
ns
;
zero
(
&
sectiondiff
[
1
][
1
],
umax
);
...
...
@@ -76,9 +77,9 @@ if(TRKILL==1){
fscanf
(
ftracekill
,
"%d"
,
&
kill_tmp
[
i
][
j
]);
}
}
fclose
(
ftracekill
);
h
=
1
;
for
(
i
=
1
;
i
<=
ntr
;
i
++
){
kill_vector
[
h
]
=
kill_tmp
[
recpos_loc
[
3
][
i
]][
ishot
];
...
...
@@ -86,16 +87,13 @@ if(TRKILL==1){
}
}
/* end if(TRKILL)*/
RMS
=
0
.
0
;
Lcount
=
1
;
/* Integration of measured and synthetic data */
for
(
i
=
1
;
i
<=
ntr
;
i
++
){
intseis_s
=
0
;
intseis_sd
=
0
;
if
(
VELOCITY
==
0
){
/* only integtration if displacement seismograms are inverted */
for
(
j
=
1
;
j
<=
ns
;
j
++
){
intseis_s
+=
section
[
i
][
j
];
...
...
@@ -113,25 +111,22 @@ for(i=1;i<=ntr;i++){
/* TIME WINDOWING */
if
(
TIMEWIN
==
1
){
time_window
(
intseis_section
,
picked_times
,
iter
,
ntr_glob
,
recpos_loc
,
ntr
,
ns
,
ishot
);
time_window
(
intseis_sectiondata
,
picked_times
,
iter
,
ntr_glob
,
recpos_loc
,
ntr
,
ns
,
ishot
);
time_window
(
intseis_section
,
picked_times
,
iter
,
ntr_glob
,
recpos_loc
,
ntr
,
ns
,
ishot
);
time_window
(
intseis_sectiondata
,
picked_times
,
iter
,
ntr_glob
,
recpos_loc
,
ntr
,
ns
,
ishot
);
}
/* NORMALIZE TRACES */
if
(
NORMALIZE
==
1
){
normalize_data
(
intseis_section
,
ntr
,
ns
);
normalize_data
(
intseis_sectiondata
,
ntr
,
ns
);
normalize_data
(
intseis_section
,
ntr
,
ns
);
normalize_data
(
intseis_sectiondata
,
ntr
,
ns
);
}
/* calculate RMS */
/*for(i=1;i<=ntr;i++){
for(j=1;j<=ns;j++){*/
/*RMS += (sectionpdata[i][j]-sectionvx[i][j]) * (sectionpdata[i][j]-sectionvx[i][j]);*/
/*RMS += (sectionpdata[i][j]) * (sectionpdata[i][j]);*/
/* Lcount++;
/* Lcount++;
}
} */
...
...
@@ -139,10 +134,8 @@ normalize_data(intseis_sectiondata,ntr,ns);
RMS
=
1
.
0
;
/* calculate weighted data residuals and reverse time direction */
/* calculate kind of "energy" */
/* calculate envelope and hilbert transform for LNORM==8 */
if
(
LNORM
==
8
){
calc_envelope
(
intseis_sectiondata
,
intseis_sectiondata_envelope
,
ns
,
ntr
);
...
...
@@ -157,13 +150,12 @@ if (LNORM==8){
}
/* end of calculate envelope and hilbert transform for LNORM==8 */
for
(
i
=
1
;
i
<=
ntr
;
i
++
){
for
(
i
=
1
;
i
<=
ntr
;
i
++
){
if
((
TRKILL
==
1
)
&&
(
kill_vector
[
i
]
==
1
))
continue
;
if
((
TRKILL
==
1
)
&&
(
kill_vector
[
i
]
==
1
))
continue
;
if
((
LNORM
==
5
)
||
(
LNORM
==
7
)){
abs_sectiondata
=
0
.
0
;
abs_sectiondata
=
0
.
0
;
abs_section
=
0
.
0
;
sectiondata_mult_section
=
0
.
0
;
...
...
@@ -175,85 +167,78 @@ for(i=1;i<=ntr;i++){
abs_sectiondata
=
sqrt
(
abs_sectiondata
);
abs_section
=
sqrt
(
abs_section
);
}
/* calculate residual seismograms and norm */
if
((
TRKILL
==
1
)
&&
(
kill_vector
[
i
]
==
1
))
continue
;
if
((
TRKILL
==
1
)
&&
(
kill_vector
[
i
]
==
1
))
continue
;
/*reverse time direction */
invtime
=
ns
;
for
(
j
=
1
;
j
<=
ns
;
j
++
){
/*printf("%d \t %d \t %e \t %e \n",i,j,sectionpdata[i][j],sectionp[i][j]);*/
/* calculate L1 residuals */
if
(
LNORM
==
1
){
/*printf("%d \t %d \t %e \t %e \n",i,j,sectionpdata[i][j],sectionp[i][j]);*/
/* calculate L1 residuals */
if
(
LNORM
==
1
){
if
(((
sectiondata
[
i
][
j
]
-
section
[
i
][
j
])
/
RMS
)
>
0
){
signL1
=
1
.
0
;}
if
(((
sectiondata
[
i
][
j
]
-
section
[
i
][
j
])
/
RMS
)
<
0
){
signL1
=-
1
.
0
;}
if
(((
sectiondata
[
i
][
j
]
-
section
[
i
][
j
])
/
RMS
)
==
0
){
signL1
=
0
.
0
;}
sectiondiff
[
i
][
invtime
]
=
signL1
/
RMS
;
}
/* calculate L2 residuals */
if
(
LNORM
==
2
){
}
/* calculate L2 residuals */
if
(
LNORM
==
2
){
sectiondiff
[
i
][
invtime
]
=
intseis_section
[
i
][
j
]
-
intseis_sectiondata
[
i
][
j
];
}
/* calculate Cauchy residuals */
/* NOT UP TO DATE */
if
(
LNORM
==
3
){
}
/* calculate Cauchy residuals */
/* NOT UP TO DATE */
if
(
LNORM
==
3
){
sectiondiff
[
i
][
invtime
]
=
((
sectiondata
[
i
][
j
]
-
section
[
i
][
j
])
/
RMS
)
/
(
1
+
(((
sectiondata
[
i
][
j
]
-
section
[
i
][
j
])
/
RMS
)
*
((
sectiondata
[
i
][
j
]
-
section
[
i
][
j
])
/
RMS
)))
/
RMS
;
}
/* calculate sech residuals */
/* NOT UP TO DATE */
if
(
LNORM
==
4
){
}
/* calculate sech residuals */
/* NOT UP TO DATE */
if
(
LNORM
==
4
){
sectiondiff
[
i
][
invtime
]
=
(
tanh
((
sectiondata
[
i
][
j
]
-
section
[
i
][
j
])
/
RMS
))
/
RMS
;
}
/* calculate LNORM 5 or LNORM 7 residuals */
if
((
LNORM
==
5
)
||
(
LNORM
==
7
)){
}
/* calculate LNORM 5 or LNORM 7 residuals */
if
((
LNORM
==
5
)
||
(
LNORM
==
7
)){
sectio