Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/deploys.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build and Deploy Docs

on:
push:
branches: [devel]

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Install doc tools
run: |
sudo apt install -y doxygen
pip install sphinx myst-parser sphinx_rtd_theme

- name: Build libaries
run: |
sudo apt install cmake build-essential gfortran liblapack-dev liblapacke-dev
wget https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz
tar -xvf eigen-3.4.0.tar.gz
pip install pybind11-global
mkdir -p build
cd build
cmake .. -DCXX=g++ -DFC=gfortran -DEIGEN_INC=./eigen-3.4.0/ -DBUILD_LIBS=ON -DPython3_EXECUTABLE=`which python`
make -j4
make install
cd ..


- name: Build Doxygen C++ API Docs
run: doxygen misc/doxygen/doxygen.cfg

- name: Build Python docs (Sphinx)
run: |
sphinx-apidoc -o misc/source/python ./specd

- name: Build master docs (Sphinx)
run: |
pip install numpy scipy
sphinx-build -b html misc/source docs

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
5 changes: 3 additions & 2 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{
"configurations": [
{
"name": "MACOS",
"name": "LINUX",
"includePath": [
"${workspaceFolder}/**",
"~/software/eigen-3.4.0",
"/opt/homebrew/Cellar/open-mpi/5.0.7/include",
"/Users/nqdu/software/miniconda3/include/python3.11",
"/Users/nqdu/software/miniconda3/lib/python3.11/site-packages/pybind11/include"
],
"compilerPath": "/usr/bin/g++",
"cStandard": "gnu17",
"cppStandard": "gnu++14",
"cppStandard": "gnu++17",
"intelliSenseMode": "linux-gcc-x64"
}
],
Expand Down
8 changes: 5 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
"name": "(lldb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/bin/surfvti_ac",
"args": ["model.txt","0.01","0.5","100"],
"program": "${workspaceFolder}/bin/surfrayl",
"args": ["model.txt","0.01","1","1"],
"cwd": "${workspaceFolder}/example/rayleigh",
"stopAtEntry": false,
"cwd": "${workspaceFolder}/example/ac",
// "program": "${workspaceFolder}/a.out",
// "cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb"
Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,5 @@
"eigenvalues": "cpp"
},
//"C_Cpp.errorSquiggles": "disabled"
"fortran.linter.includePaths": ["/opt/homebrew/Cellar/open-mpi/5.0.7/include"]
}
50 changes: 26 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CMakeLists.txt

cmake_minimum_required(VERSION 3.13.0)
cmake_minimum_required(VERSION 3.25.0)

################## compiler options ##################
# compiler
Expand All @@ -13,8 +13,8 @@ set(CMAKE_CXX_FLAGS ${CXXFLAGS})
################## dependencies ##################
# preferred installation prefix of dependencies
set(EIGEN_INC ${EIGEN_INC})
set(USE_LAPACK ${USE_LAPACK})
set(BUILD_PYLIB ${BUILD_PYLIB})

option(BUILD_LIBS "BUILD_LIBS" OFF)


# set default values
Expand All @@ -24,59 +24,61 @@ set(${var} ${val})
endif()
endmacro()
setDefault(EIGEN_INC "~/software/eigen-3.4.0")
setDefault(USE_LAPACK FALSE)
setDefault(BUILD_PYLIB FALSE)

# project
project(SWDTTI LANGUAGES CXX Fortran)

# build type
set(CMAKE_BUILD_TYPE RELEASE)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_Fortran_MODULE_DIRECTORY ${PROJECT_SOURCE_DIR}/build/obj)

################# cmake setup #################
set(CMAKE_CXX_FLAGS "-g")
set(CMAKE_CXX_FLAGS "-g -Wall")
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -march=native -ffast-math")
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -march=native")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -march=native -ffixed-line-length-none")
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
#set(CMAKE_CXX_FLAGS_RELEASE "-O0 -D_GLIBCXX_DEBUG")
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Intel")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -xHost -DEIGEN_STRONG_INLINE=inline")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -xHost -extend-source")
else ()
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -march=native -ffixed-line-length-none")
#set(CMAKE_CXX_FLAGS_RELEASE "-O0 -D_GLIBCXX_DEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -march=native")
endif()

set(CMAKE_VERBOSE_MAKEFILE off)
set(CMAKE_VERBOSE_MAKEFILE on)

################# find packages #################
# path of *.cmake files
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/include/cmake)
#set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/include/cmake)

# eigen
include_directories(${EIGEN_INC})

# lapack
if(${USE_LAPACK})
find_package(LAPACK)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DEIGEN_USE_LAPACKE")
endif()
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
find_package(LAPACK REQUIRED)
find_package(LAPACKE REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DEIGEN_USE_LAPACKE")

################# include paths #################
include_directories(${PROJECT_SOURCE_DIR}/src)
include_directories(${PROJECT_SOURCE_DIR}/include)
#include_directories(${PROJECT_SOURCE_DIR}/include)

# subs
add_subdirectory(${PROJECT_SOURCE_DIR}/src/shared)
add_subdirectory(${PROJECT_SOURCE_DIR}/src/mesh)
add_subdirectory(${PROJECT_SOURCE_DIR}/src/vti)
add_subdirectory(${PROJECT_SOURCE_DIR}/src/tti)
add_subdirectory(${PROJECT_SOURCE_DIR}/src/multiphysics)
# add_subdirectory(${PROJECT_SOURCE_DIR}/src/tti)
# add_subdirectory(${PROJECT_SOURCE_DIR}/src/multiphysics)

# check build pylib
if(${BUILD_PYLIB})
#find_package(pybind11 REQUIRED)
find_package(Python COMPONENTS Interpreter Development)
# check build libraries
if(BUILD_LIBS)
find_package(Python3 COMPONENTS Interpreter Development)
find_package(pybind11 CONFIG)
add_subdirectory(src/cps330)
add_subdirectory(src/libswd)
Expand Down
41 changes: 4 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,6 @@
# SPECSWD
**SpecSWD** utilizes spectral element method and quadratic eigenvalue solver to compute surface wave dispersion, eigen function and sensitivity kernels for **general layered models**.
# SpecSWD
**SpecSWD** is a software to compute surface wave dispersions and do sensitivity analysis for 1-D fully anisotropic, wealy anelastic media. It utilizes spectral element method and quadratic eigenvalue solver to handle multiphysics (elastic-acoustic coupling), strong anisotropy and discontinuities inside the study region.

It can handle dispersion values for several type of complex media, such as VTI, TTI(Tilted Transversely Isotropic), acoustic-VTI coupling, and at any frequency, and any mode. And it can support both 1-D layered
model (1-D model with discontinuities) and gradient model (continous variation in both fluid and elastic domain).

## Requirements and Installation
1. **Compilers:** C++/Fortran compilers which support c++14 (tested on `GCC >=7.5`), `cmake >= 3.12`

2. packages:
* [Eigen](https://eigen.tuxfamily.org/index.php?title=Main_Page) >= 3.4.0
* [MKL/LAPACK](https://www.netlib.org/lapack/lapacke.html), optional.
* [doxygen](https://www.doxygen.nl/) for api document generation, optional.

3. Install:
```bash
mkdir -p build; cd build;
cmake .. -DCXX=g++ -DFC=gfortran -DEIGEN_INC=/path/to/eigen/ -DUSE_LAPACK=FALSE
make -j4; make install
```
If you want to use `LAPACKE/MKL`, you can set `-DUSE_LAPACK=TRUE`. This program also provides python libraries (`.so`) and you can install them by adding ```-DBUILD_PYLIB=TRUE -DPYTHON_EXECUTABLE=`which python` ```

4. install API docs
```bash
cd doxygen
doxygen config.cfg
```

# Gallery
### Benchmark: SWDTTI with CPS330
![image](example//rayleigh/phase.jpg)
### HTI model: Phase velocity vs. Azimuthal angle
![image](example/tti/group-direc.jpg)

### Fluid-Elastic Coupling phase and group velocity
![image](example/ac/phase.jpg)
![image](example/ac/group.jpg)
### Acoustic
**SpecSWD** also provides high-level sensitivity analysis framework (adjoint methods) for any user-defined quantities.

For installation, user manual, please refer to [docs](https://nqdu.github.io/SpecSWD/).
Binary file added __pycache__/setup.cpython-311.pyc
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions bak/src.bak/solver.bak/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
file(GLOB SOURCE "*.cpp" )
list(FILTER SOURCE EXCLUDE REGEX "main*.cpp")

add_library(libsolver ${SOURCE})


add_executable(surflove ${PROJECT_SOURCE_DIR}/src/solver/main_love.cpp)
target_link_libraries(surflove libsolver shared ${LAPACK_LIBRARIES})
Loading