Skip to content

Commit 7217d3d

Browse files
authored
FEAT: exact closed-form solution for the Lamb problem of the first kind (#117)
1 parent 37da1c6 commit 7217d3d

File tree

12 files changed

+1538
-6
lines changed

12 files changed

+1538
-6
lines changed

docs/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ help:
1313
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
1414

1515
clean:
16-
rm $(BUILDDIR)/* -rf
17-
rm doxygen_h/* -rf
16+
rm $(BUILDDIR)/ -rf
17+
rm doxygen_h/ -rf
1818

1919
.PHONY: help Makefile clean
2020

pygrt/C_extension/include/grt.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@
4141
X(static_strain) \
4242
X(static_stress) \
4343
/* other */ \
44-
X(ker2asc) \
45-
X(sac2asc) \
44+
X(ker2asc) \
45+
X(sac2asc) \
4646
X(travt) \
47+
X(lamb1) \
4748
// ------------------------------------------------------
4849

4950
/** 子模块的函数指针类型 */

pygrt/C_extension/include/grt/common/checkerror.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <sys/stat.h>
1414
#include <dirent.h>
1515
#include <errno.h>
16+
#include <stdlib.h>
1617

1718
#include "grt/common/colorstr.h"
1819

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/**
2+
* @file elliptic.h
3+
* @author Zhu Dengda ([email protected])
4+
* @date 2025-11
5+
*
6+
* 使用渐近解和 Carlson 算法计算三类完全椭圆积分,参考:
7+
*
8+
* 1. Abramowitz, Milton, and Irene A. Stegun. 1964. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. Vol. 55. US Government printing office.
9+
* 2. Carlson, B. C. 1995. “Numerical Computation of Real or Complex Elliptic Integrals.” Numerical Algorithms 10 (1): 13–26. https://doi.org/10.1007/BF02198293.
10+
* 3. 张海明, 冯禧 著. 2024. 地震学中的 Lamb 问题(下). 科学出版社
11+
*/
12+
13+
#pragma once
14+
15+
#include "grt/common/const.h"
16+
17+
/**
18+
* 使用 Abramowitz and Stegun (1964, P591-592) 提供的渐近表达式计算第一类完全椭圆积分, \f$ m \in (0,1) \f$
19+
* \f[
20+
* K(m) = \int_0^{\pi/2} \dfrac{1}{\sqrt{1 - m \sin^2\theta}}\ d\theta
21+
* \f]
22+
*
23+
* @param[in] m 参数 m
24+
* @return 积分值
25+
*
26+
*/
27+
MYREAL grt_ellipticK(const MYREAL m);
28+
29+
30+
/**
31+
* 使用 Abramowitz and Stegun (1964, P591-592) 提供的渐近表达式计算第二类完全椭圆积分, \f$ m \in (0,1) \f$
32+
* \f[
33+
* E(m) = \int_0^{\pi/2} \sqrt{1 - m \sin^2\theta}\ d\theta
34+
* \f]
35+
*
36+
* @param[in] m 参数 m
37+
* @return 积分值
38+
*
39+
*/
40+
MYREAL grt_ellipticE(const MYREAL m);
41+
42+
43+
/**
44+
* 使用 Carlson (1995) 算法计算第三类完全椭圆积分, \f$ m \in (0,1) \f$
45+
* \f[
46+
* {\it \Pi}(m) = \int_0^{\pi/2} \dfrac{1}{(1-nx^2)\sqrt{1-x^2}\sqrt{1 - m \sin^2\theta}}\ d\theta
47+
* \f]
48+
*
49+
* @param[in] n 参数 n
50+
* @param[in] m 参数 m
51+
* @return 积分值
52+
*
53+
*/
54+
MYCOMPLEX grt_ellipticPi(const MYCOMPLEX n, const MYREAL m);
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* @file lamb1.h
3+
* @author Zhu Dengda ([email protected])
4+
* @date 2025-11
5+
*
6+
* 使用广义闭合解求解第一类 Lamb 问题,参考:
7+
*
8+
* 张海明, 冯禧 著. 2024. 地震学中的 Lamb 问题(下). 科学出版社
9+
*/
10+
11+
#pragma once
12+
13+
#include "grt/common/const.h"
14+
#include "grt/lamb/lamb_util.h"
15+
16+
17+
/**
18+
* 使用广义闭合解求解第一类 Lamb 问题
19+
*
20+
* @param[in] alpha P 波速度
21+
* @param[in] beta S 波速度
22+
* @param[in] ts 归一化时间序列
23+
* @param[in] nt 时间序列点数
24+
* @param[in] azimuth 方位角,单位度
25+
* @param[out] u 记录结果的指针,如果为NULL则输出到标准输出
26+
*
27+
*/
28+
void grt_solve_lamb1(
29+
const MYREAL alpha, const MYREAL beta, const MYREAL *ts, const int nt, const MYREAL azimuth, MYREAL (*u)[3][3]);
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/**
2+
* @file lamb_util.h
3+
* @author Zhu Dengda ([email protected])
4+
* @date 2025-11
5+
*
6+
* 一些使用广义闭合解求解 Lamb 问题过程中可能用到的辅助函数
7+
*/
8+
9+
#pragma once
10+
11+
#include "grt/common/const.h"
12+
13+
/**
14+
* 求解一元三次形式的 Rayleigh 方程的根, \f$ x^3 + ax^2 + bx + c = 0 \f$
15+
*
16+
* @param[in] a 系数 a
17+
* @param[in] b 系数 b
18+
* @param[in] c 系数 c
19+
* @param[out] y3 三个根,其中 y3[2] 为正根
20+
*/
21+
void grt_roots3(const MYREAL a, const MYREAL b, const MYREAL c, MYCOMPLEX y3[3]);
22+
23+
/**
24+
* 做如下多项式求值, \f$ \sum_{m=0}^n C_{2m+o} y^m \f$
25+
*
26+
* @param[in] C 数组 C
27+
* @param[in] n 最高幂次 n
28+
* @param[in] y 自变量 y
29+
* @param[in] o 偏移量
30+
*
31+
* @return 多项式结果
32+
*
33+
*/
34+
MYCOMPLEX grt_evalpoly2(const MYCOMPLEX *C, const int n, const MYCOMPLEX y, const int offset);
35+
36+
37+
/**
38+
* 根据 Vs/Vp 比值,计算泊松比, \f$ \nu = \dfrac{1}{2} \dfrac{1 - 2k^2}{1 - k^2}, k=\dfrac{V_S}{V_P} \f$
39+
*
40+
* @param[in] k Vs/Vp
41+
* @return 泊松比
42+
*/
43+
44+
MYREAL grt_possion_ratio(const MYREAL k);

0 commit comments

Comments
 (0)