Skip to content

Commit

Permalink
fix bug for MPI!
Browse files Browse the repository at this point in the history
  • Loading branch information
Haipeng Li committed Jun 16, 2022
1 parent b240f51 commit b0cf752
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 9 deletions.
Binary file modified .DS_Store
Binary file not shown.
43 changes: 34 additions & 9 deletions fd2dmpi/solver.f90
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ subroutine forward_modeling(parfile)
call get_assigned(1, coord%ns, is1, is2)

do is = is1, is2, 1

call filename(str,'./parfile/forward_source/src',is,'.bin')
call read_binfile(str, s, par%nt)

Expand Down Expand Up @@ -190,17 +191,24 @@ subroutine adjoint_modeling(parfile)

call get_assigned(1, coord%ns, is1, is2)

! Initialize
dg = 0.0
dfw = 0.0
dbk = 0.0

p_bk = 0.0
u_bk = 0.0
w_bk = 0.0

do is = is1, is2, 1

! Initialize
s = 0.0
s_adj = 0.0
boundary = 0.0
p_end = 0.0
u_end = 0.0
w_end = 0.0

dg = 0.0
dfw = 0.0
dbk = 0.0

p_bk = 0.0
u_bk = 0.0
w_bk = 0.0

! Read forward source
call filename(str,'./parfile/forward_source/src',is,'.bin')
call read_binfile(str, s, par%nt)
Expand Down Expand Up @@ -230,7 +238,24 @@ subroutine adjoint_modeling(parfile)
dfw = dfw + p_end * p_end
dbk = dbk + p_bk(iz1:iz2,ix1:ix2) * p_bk(iz1:iz2,ix1:ix2)

! ! output wavefield
! if (mod(it, 10) ==0) then
! call filename(str, par%data_out, is, '_snapshot/')
! call filename(str, str, it, '_forward.bin')
! call write_binfile(str, p_end, par%nz, par%nx)

! call filename(str, par%data_out, is, '_snapshot/')
! call filename(str, str, it, '_backward.bin')
! call write_binfile(str, p_bk(iz1:iz2,ix1:ix2), par%nz, par%nx)

! endif

enddo

! ! output gradient
! call filename(str, par%data_out, is,'_kernel_vp.bin')
! call write_binfile(str, dg, par%nz, par%nx)

enddo

!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~!
Expand Down

0 comments on commit b0cf752

Please sign in to comment.