Skip to content

Commit

Permalink
make it works!
Browse files Browse the repository at this point in the history
  • Loading branch information
Haipeng-ustc committed Dec 28, 2022
1 parent 04c0115 commit bb5730d
Show file tree
Hide file tree
Showing 54 changed files with 3,328 additions and 1,693 deletions.
Binary file modified bin/fd2dmpi
Binary file not shown.
2 changes: 1 addition & 1 deletion build/lib/toolbox-dev/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def prepare_configfile(self, simu_type, simu_tag, save_snap):
else:
msg = "simu_type must be 'forward', 'adjoint' or 'gradient' \n"
err = 'Unknown simulation type: {}'.format(simu_type)
raise ValueError(msg + err)
raise ValueError(msg + '\n' + err)

fp.write('COORD_FILE=%s\n' % (self.config.path + 'config/geometry.config'))
fp.write('SOURCE_FILE=%s\n' % (self.config.path + 'config/wavelet/src'))
Expand Down
2 changes: 1 addition & 1 deletion build/lib/toolbox-dev/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ def source_wavelet(amp0, nt, dt, f0, source_type):
else:
msg = 'Support source types: Rikcer, Guassian, Ramp. \n'
err = 'Unknown source type: {}'.format(source_type)
raise ValueError(msg + err)
raise ValueError(msg + '\n' + err)

return wavelet
Binary file modified solver/.mod/datatype.mod
Binary file not shown.
Binary file modified solver/.mod/fdcore.mod
Binary file not shown.
Binary file added solver/.mod/fdsolver.mod
Binary file not shown.
Binary file modified solver/.mod/io.mod
Binary file not shown.
Binary file modified solver/.mod/pml.mod
Binary file not shown.
Binary file removed solver/.mod/solver.mod
Binary file not shown.
Binary file modified solver/.mod/source.mod
Binary file not shown.
Binary file modified solver/.obj/datatype.o
Binary file not shown.
Binary file modified solver/.obj/fd2dmpi.o
Binary file not shown.
Binary file modified solver/.obj/fdcore.o
Binary file not shown.
Binary file added solver/.obj/fdsolver.o
Binary file not shown.
Binary file modified solver/.obj/io.o
Binary file not shown.
Binary file removed solver/.obj/solver.o
Binary file not shown.
Binary file modified solver/.obj/source.o
Binary file not shown.
9 changes: 2 additions & 7 deletions solver/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ OBJS = $(DIR_OBJ)/global.o \
$(DIR_OBJ)/pml.o \
$(DIR_OBJ)/source.o \
$(DIR_OBJ)/fdcore.o \
$(DIR_OBJ)/solver.o
$(DIR_OBJ)/fdsolver.o

all: dir fd2dmpi

Expand All @@ -39,13 +39,8 @@ fd2dmpi: $(OBJS) $(DIR_OBJ)/fd2dmpi.o
$(FCC) -o $@ $^ $(LDFLAGS)
mv $@ ../$(DIR_EXE)

bin2su.x: $(OBJS) $(DIR_OBJ)/bin2su.o
$(FCC) -o $@ $^ $(LDFLAGS)
mv $@ ../$(DIR_EXE)

$(DIR_OBJ)/%.o: %.f90
$(FCC) -o $@ $< $(F90FLAGS)

clean:
rm -f $(DIR_EXE)/* $(DIR_OBJ)/*.o $(DIR_MOD)/*.mod;

rm -f $(DIR_EXE)/* $(DIR_OBJ)/*.o $(DIR_MOD)/*.mod;
70 changes: 0 additions & 70 deletions solver/bin2su.f90

This file was deleted.

3 changes: 1 addition & 2 deletions solver/fd2dmpi.f90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
!
program fd2dmpi

use solver
use fdsolver
use parser

implicit none
Expand Down Expand Up @@ -47,4 +47,3 @@ program fd2dmpi
endif

end program fd2dmpi

7 changes: 3 additions & 4 deletions solver/solver.f90 → solver/fdsolver.f90
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


! module for 2D applications including forward and adjoint modeling
module solver
module fdsolver

use fdcore
use datatype
Expand Down Expand Up @@ -349,7 +349,7 @@ subroutine gradient_computing(parfile)

! Read adjoint source: ./config/wavelet/src1_adj.bin, src2_adj.bin, ...
call filename(str, par%sourcefile, is, '_adj.bin')
call read_binfile(str, s_adj, par%nt, coord%ngmax)
call read_binfile(str, s_adj, par%nt, coord%ng(is))

! Read boundary, p_end, u_end, w_end
call filename(str, par%data_out, is, '/boundary.bin')
Expand Down Expand Up @@ -411,5 +411,4 @@ subroutine gradient_computing(parfile)

end subroutine gradient_computing

end module solver

end module fdsolver
309 changes: 309 additions & 0 deletions test-dev/.ipynb_checkpoints/01_fwi-checkpoint.ipynb

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions test-dev/.ipynb_checkpoints/iterate_CG-checkpoint.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
**********************************************************************
NONLINEAR CONJUGATE GRADIENT ALGORITHM
**********************************************************************
Convergence criterion : 1.00e-06
Niter_max : 20
Initial cost is : 6.12e-09
Initial norm_grad is : 5.90e+03
**********************************************************************
Niter fk ||gk|| fk/f0 alpha nls ngrad
0 6.12e-09 5.90e+03 1.00e+00 1.00e+00 0 0
1 1.80e-09 8.70e+03 2.94e-01 5.00e-01 1 2
Loading

0 comments on commit bb5730d

Please sign in to comment.