Skip to content

Commit

Permalink
Allow different norms for different regularization terms
Browse files Browse the repository at this point in the history
Add an option for enabling wavelet compression
  • Loading branch information
zhong-yy committed Jul 8, 2024
1 parent bd9d3ee commit 02ee4a1
Show file tree
Hide file tree
Showing 30 changed files with 44,555 additions and 19,895 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ MISC/

# Examples/

*(Copy)/

__pycache__/

todo.md
Expand Down
26 changes: 20 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
# $ cmake --versionh
cmake_minimum_required(VERSION 3.10)

include("Config.cmake")

# set the project name
project(GraAda3D)
set (CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR})

set(CMAKE_EXPORT_COMPILE_COMMANDS 1)

Expand All @@ -13,8 +16,16 @@ find_package(OpenMP REQUIRED)
message("${CMAKE_CXX_COMPILER_ID}")
message("Compiler command: $ENV{CXX}")
message("Openmp flag ${OpenMP_CXX_FLAGS}")
if (DEFINED ENV{USE_NETCDF})
message("USE_NETCDF=$ENV{USE_NETCDF}; The netcdf library will be included.")
message("Installation location: ${CMAKE_INSTALL_PREFIX}/bin")
# if (DEFINED ENV{USE_NETCDF})
# message("USE_NETCDF=$ENV{USE_NETCDF}; The netcdf library will be included.")
# endif()
if (${USE_NETCDF})
message("USE_NETCDF=${USE_NETCDF}; The netcdf library will be included.")
endif()

if (${USE_MKL})
message("USE_MKL=${USE_MKL}; $ENV{MKLROOT}; MKL will be used.")
endif()

# specify the C++ standard
Expand Down Expand Up @@ -49,7 +60,7 @@ target_include_directories(Forward_obj
3rd_party_lib/Linterp
3rd_party_lib/Timer
#if netcdf library is used
$<$<BOOL:$ENV{USE_NETCDF}>:
$<$<BOOL:${USE_NETCDF}>:
3rd_party_lib/netcdf/netcdf-cxx4-4.3.1
3rd_party_lib/netcdf/netcdf-c-4.7.4
>
Expand All @@ -58,7 +69,7 @@ target_include_directories(Forward_obj
target_link_libraries(Forward_obj
PUBLIC
OpenMP::OpenMP_CXX
$<$<BOOL:$ENV{USE_NETCDF}>:netcdf_c++4>
$<$<BOOL:${USE_NETCDF}>:netcdf_c++4>
gsl
gslcblas
)
Expand All @@ -71,7 +82,7 @@ target_compile_options(Forward_obj
target_compile_definitions(Forward_obj
PUBLIC
$<$<CXX_COMPILER_ID:Intel>:USE_MKL>
$<$<BOOL:$ENV{USE_NETCDF}>:USE_NETCDF>
$<$<BOOL:${USE_NETCDF}>:USE_NETCDF>
)
# inversion code
add_library(Inversion_obj OBJECT
Expand Down Expand Up @@ -101,7 +112,7 @@ target_include_directories(GraAda3D

target_link_options(GraAda3D
PRIVATE
$<$<BOOL:$ENV{USE_MKL}>:-L$ENV{MKLROOT}/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -ldl>
$<$<BOOL:${USE_MKL}>:-L$ENV{MKLROOT}/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -ldl>
)
target_link_libraries(GraAda3D
PRIVATE
Expand Down Expand Up @@ -137,3 +148,6 @@ target_link_libraries(test_wavelet_forward2
Forward_obj
Inversion_obj
)

install(TARGETS GraAda3D Synthetic_data1
)
11 changes: 11 additions & 0 deletions Config.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Specify the c++ compiler. The default one is icpx (oneAPI).
#set(ENV{CXX} g++)
set(ENV{CXX} icpx)

# Specify whether netcdf library will be used. The value should be TRUE or FALSE
set(USE_NETCDF TRUE)

# Specify whether mkl library will be used. THe value should be TRUE or FALSE
set(USE_MKL TRUE)

#set (CMAKE_INSTALL_PREFIX "prefix_path")
Binary file modified Examples/Inv_with_ref/Inversion_Slices_interp.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/Inv_with_ref/Inversion_Slices_ref.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 6 additions & 4 deletions Examples/Inv_with_ref/Iteration_misfit_GN
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Iteranation numbernumber of tried regulartion parameters misfit
1 13 2.10951623091422e+02
2 14 1.38049713955007e+01
3 19 1.88364493695179e+00
4 22 9.96146687305019e-01
1 7 4.96770664856933e+01
2 25 2.57953806237836e+00
3 23 1.51965228386200e+00
4 25 1.08017199681304e+00
5 26 1.01538415689089e+00
6 24 9.78459168260070e-01
14 changes: 11 additions & 3 deletions Examples/Inv_with_ref/config_inversion
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
#configuration of inversion parameters.
#Comments that start with a character # will not be read by the program

# How the sensitivity matrix is store, and how the conjugate gradient method is implemented
# 0: store a full sensitivity matrix, and use the lscg implementation of Eigen 3 library (not recommended) (lscg: least square conjugate gradient method)
# 1: store a full sensitivity matrix, and use my own implementation of the lscg method
# 2: use the wavelet transform to compress the sensitivity matrix, and use my own implementation of the lscg method
1
# If the above option is 2 (using wavelet transform), the following relative threshold should be defined
# A larger threshold results in larger compression ratio, and larger approximation error as well
0.005

#Weights of different regularization terms, last term a_crg is the weight of cross-gradient constraint, which makes sense only
#if the cross-gradient constraint is used
Expand All @@ -11,13 +19,13 @@
#--"p": means Lp norm will be used
#--"epsilon2" :a small value is used to avoid singularity
#For L1-norm inversion (p=1), the inversion result is more focusing with smaller epsilon2, while larger value of epsilon2 produce smoother inversion results.
2 0
2 2 2 2 2 1e-6

#Depth weighting exponent. Generally, it's 2 for g, 3 for ggt
2

#Maximal regularization parameter (lambda) used, number of lambda used for trial
1e4 30 0.5
1e4 30 0.6

#Target misfit
1
Expand All @@ -27,7 +35,7 @@
0.02

#Tolerance value and Maximal number of iterations for LSCG solver (least-square conjugate gradient)
1e-4 100
1e-6 100

#Maximal number of iterations for gauss-newton
8
Expand Down
Loading

0 comments on commit 02ee4a1

Please sign in to comment.