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
a1db73fb
Commit
a1db73fb
authored
Mar 30, 2016
by
Florian Wittkamp
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/JOINT_log' into feature/JOINT_norm_L2
parents
4eb40177
e42d275d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
16 deletions
+48
-16
src/IFOS2D.c
src/IFOS2D.c
+48
-16
No files found.
src/IFOS2D.c
View file @
a1db73fb
...
...
@@ -53,7 +53,7 @@ int main(int argc, char **argv){
int
sum_killed_traces
=
0
,
sum_killed_traces_testshots
=
0
,
killed_traces
=
0
,
killed_traces_testshots
=
0
;
int
*
ptr_killed_traces
=&
killed_traces
,
*
ptr_killed_traces_testshots
=&
killed_traces_testshots
;
float
energy
,
energy_sum
,
energy_all_shots
,
energy_sum_all_shots
;
float
energy
,
energy_sum
,
energy_all_shots
,
energy_sum_all_shots
=
0
.
0
;
float
energy_SH
,
energy_sum_SH
,
energy_all_shots_SH
,
energy_sum_all_shots_SH
;
float
L2_SH
,
L2sum_SH
,
L2_all_shots_SH
,
L2sum_all_shots_SH
;
...
...
@@ -160,6 +160,9 @@ int main(int argc, char **argv){
FILE
*
fprec
,
*
FPL2
;
FILE
*
FPL2_JOINT
;
char
L2_joint_log
[
STRING_SIZE
];
/* General parameters */
int
nt_out
;
...
...
@@ -1068,27 +1071,41 @@ int main(int argc, char **argv){
C_rho
=
rho_avg
*
rho_avg
;
}
/* Seperate PSV and SH logging in case of a joint inversion */
if
(
WAVETYPE
==
3
){
sprintf
(
L2_joint_log
,
"%s_JOINT"
,
MISFIT_LOG_FILE
);
}
/* Open Log File for L2 norm */
if
(
FORWARD_ONLY
!=
1
){
if
(
MYID
==
0
){
if
(
iter
==
1
){
FPL2
=
fopen
(
MISFIT_LOG_FILE
,
"w"
);
/* Write header for misfit log file */
if
(
GRAD_METHOD
==
1
&&
VERBOSE
)
{
if
(
TIME_FILT
==
0
){
fprintf
(
FPL2
,
"opteps_vp
\t
epst1[1]
\t
epst1[2]
\t
epst1[3]
\t
L2t[1]
\t
L2t[2]
\t
L2t[3]
\t
L2t[4]
\n
"
);}
else
{
fprintf
(
FPL2
,
"opteps_vp
\t
epst1[1]
\t
epst1[2]
\t
epst1[3]
\t
L2t[1]
\t
L2t[2]
\t
L2t[3]
\t
L2t[4]
\t
F_LOW_PASS
\n
"
);
}
if
(
!
FORWARD_ONLY
&&
MYID
==
0
){
if
(
iter
==
1
){
FPL2
=
fopen
(
MISFIT_LOG_FILE
,
"w"
);
/* Write header for misfit log file */
if
(
GRAD_METHOD
==
1
&&
VERBOSE
)
{
if
(
TIME_FILT
==
0
){
fprintf
(
FPL2
,
"opteps_vp
\t
epst1[1]
\t
epst1[2]
\t
epst1[3]
\t
L2t[1]
\t
L2t[2]
\t
L2t[3]
\t
L2t[4]
\n
"
);}
else
{
fprintf
(
FPL2
,
"opteps_vp
\t
epst1[1]
\t
epst1[2]
\t
epst1[3]
\t
L2t[1]
\t
L2t[2]
\t
L2t[3]
\t
L2t[4]
\t
F_LOW_PASS
\n
"
);
}
}
if
(
iter
>
1
){
FPL2
=
fopen
(
MISFIT_LOG_FILE
,
"a"
);}
if
(
WAVETYPE
==
3
)
FPL2_JOINT
=
fopen
(
L2_joint_log
,
"w"
);
}
else
{
FPL2
=
fopen
(
MISFIT_LOG_FILE
,
"a"
);
if
(
WAVETYPE
==
3
)
FPL2_JOINT
=
fopen
(
L2_joint_log
,
"a"
);
}
}
/* initialization of L2 calculation */
L2
=
0
.
0
;
Lcount
=
0
;
energy
=
0
.
0
;
L2_all_shots
=
0
.
0
;
energy_all_shots
=
0
.
0
;
...
...
@@ -2796,7 +2813,7 @@ int main(int argc, char **argv){
energy_sum_all_shots
=
0
.
0
;
MPI_Allreduce
(
&
energy_all_shots
,
&
energy_sum_all_shots
,
1
,
MPI_FLOAT
,
MPI_SUM
,
MPI_COMM_WORLD
);
if
(
MYID
==
0
&&
(
WAVETYPE
==
3
))
printf
(
"
\n\n
PSV: L2=%f"
,
L2sum_all_shots
/
energy_sum_all_shots
);
if
(
MYID
==
0
&&
(
WAVETYPE
==
3
))
printf
(
"
\n\n
PSV: L2=%f"
,
L2sum_all_shots
/
energy_sum_all_shots
);
}
if
(
WAVETYPE
==
2
||
WAVETYPE
==
3
){
L2sum_SH
=
0
.
0
;
...
...
@@ -2808,8 +2825,9 @@ int main(int argc, char **argv){
energy_sum_all_shots_SH
=
0
.
0
;
MPI_Allreduce
(
&
energy_all_shots_SH
,
&
energy_sum_all_shots_SH
,
1
,
MPI_FLOAT
,
MPI_SUM
,
MPI_COMM_WORLD
);
if
(
MYID
==
0
&&
(
WAVETYPE
==
3
))
printf
(
"
\n
SH: L2=%f"
,
L2sum_all_shots_SH
/
energy_sum_all_shots_SH
);
if
(
MYID
==
0
&&
(
WAVETYPE
==
3
))
printf
(
"
\n
SH: L2=%f"
,
L2sum_all_shots_SH
/
energy_sum_all_shots_SH
);
}
sum_killed_traces
=
0
;
MPI_Allreduce
(
&
killed_traces
,
&
sum_killed_traces
,
1
,
MPI_INT
,
MPI_SUM
,
MPI_COMM_WORLD
);
sum_killed_traces_testshots
=
0
;
...
...
@@ -3107,6 +3125,10 @@ int main(int argc, char **argv){
if
(
MYID
==
0
)
fprintf
(
FPL2
,
"%e
\t
%d
\t
%d
\t
%f
\t
0
\t
%d
\t
%e
\t
%e
\t
%f
\n
"
,
0
.
0
,
iter
,
wolfe_sum_FWI
,
0
.
0
,
countstep
-
1
,
L2_SL_old
,
L2_SL_old
,
F_LOW_PASS
);
}
if
(
WAVETYPE
==
3
&&
MYID
==
0
){
fprintf
(
FPL2_JOINT
,
"%d
\t
%f
\t
%f
\n
"
,
iter
,
L2sum_all_shots
/
energy_sum_all_shots
,
L2sum_all_shots_SH
/
energy_sum_all_shots_SH
);
}
/* No update is done here, however model fils are written to disk for easy post processing */
alpha_SL
=
0
.
0
;
calc_mat_change_test
(
waveconv_up
,
waveconv_rho_up
,
waveconv_u_up
,
prhonp1
,
prho
,
ppinp1
,
ppi
,
punp1
,
pu
,
iter
,
1
,
FORWARD_ONLY
,
alpha_SL
,
0
,
nfstart
,
Vs0
,
Vp0
,
Rho0
,
wavetype_start
,
s_LBFGS
,
N_LBFGS
,
LBFGS_NPAR
,
Vs_avg
,
Vp_avg
,
rho_avg
,
LBFGS_iter_start
);
...
...
@@ -3148,6 +3170,10 @@ int main(int argc, char **argv){
if
(
MYID
==
0
)
fprintf
(
FPL2
,
"%e
\t
%d
\t
%d
\t
%f
\t
0
\t
%d
\t
%e
\t
%e
\t
%f
\n
"
,
alpha_SL
,
iter
,
wolfe_sum_FWI
,
diff
,
countstep
-
1
,
L2_SL_old
,
L2_SL_new
,
F_LOW_PASS
);
}
if
(
WAVETYPE
==
3
&&
MYID
==
0
){
fprintf
(
FPL2_JOINT
,
"%d
\t
%f
\t
%f
\n
"
,
iter
,
L2sum_all_shots
/
energy_sum_all_shots
,
L2sum_all_shots_SH
/
energy_sum_all_shots_SH
);
}
/* initiate variables for next iteration */
if
(
use_wolfe_failsafe
==
1
)
{
L2_hist
[
iter
]
=
L2_SL_new
;
...
...
@@ -3786,6 +3812,9 @@ int main(int argc, char **argv){
fprintf
(
FPL2
,
"%e
\t
%e
\t
%e
\t
%e
\t
%e
\t
%e
\t
%e
\t
%e
\n
"
,
opteps_vp
,
epst1
[
1
],
epst1
[
2
],
epst1
[
3
],
L2t
[
1
],
L2t
[
2
],
L2t
[
3
],
L2t
[
4
]);}
else
{
fprintf
(
FPL2
,
"%e
\t
%e
\t
%e
\t
%e
\t
%e
\t
%e
\t
%e
\t
%e
\t
%f
\n
"
,
opteps_vp
,
epst1
[
1
],
epst1
[
2
],
epst1
[
3
],
L2t
[
1
],
L2t
[
2
],
L2t
[
3
],
L2t
[
4
],
F_LOW_PASS
);}
if
(
WAVETYPE
==
3
&&
MYID
==
0
){
fprintf
(
FPL2_JOINT
,
"%d
\t
%f
\t
%f
\n
"
,
iter
,
L2sum_all_shots
/
energy_sum_all_shots
,
L2sum_all_shots_SH
/
energy_sum_all_shots_SH
);
}
}
/* saving history of final L2*/
...
...
@@ -3820,6 +3849,9 @@ int main(int argc, char **argv){
if
(
MYID
==
0
){
fclose
(
FPL2
);
}
if
(
WAVETYPE
==
3
&&
MYID
==
0
)
{
fclose
(
FPL2_JOINT
);
}
}
if
(
iter
==
nfstart
){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment