@@ -21,9 +21,8 @@ typedef struct {
2121 /** 模型参数 */
2222 struct {
2323 bool active ;
24- MYREAL alpha ; ///< P 波速度
25- MYREAL beta ; ///< S 波速度
26- } M ;
24+ MYREAL nu ; ///< 泊松比
25+ } P ;
2726
2827 /** 归一化时间序列 */
2928 struct {
@@ -62,11 +61,11 @@ printf("\n"
6261"\n\n"
6362"Usage:\n"
6463"----------------------------------------------------------------\n"
65- " grt lamb1 -M<Vp>/<Vs > -T<t1>/<t2>/<dt> -A<azimuth>\n"
64+ " grt lamb1 -P<nu > -T<t1>/<t2>/<dt> -A<azimuth>\n"
6665"\n\n"
6766"Options:\n"
6867"----------------------------------------------------------------\n"
69- " -M<Vp>/<Vs> Vp and Vs of the halfspace.\n"
68+ " -P<nu> Possion ratio of the halfspace, (0, 0.5) .\n"
7069"\n"
7170" -T<t1>/<t2>/<dt>\n"
7271" Dimensionless time.\n"
@@ -80,7 +79,7 @@ printf("\n"
8079"\n\n"
8180"Examples:\n"
8281"----------------------------------------------------------------\n"
83- " grt lamb1 -M8.0/4.62 -T0/2/1e-3 -A30\n"
82+ " grt lamb1 -P0.25 -T0/2/1e-3 -A30\n"
8483"\n\n\n"
8584);
8685}
@@ -91,21 +90,16 @@ static void getopt_from_command(GRT_MODULE_CTRL *Ctrl, int argc, char **argv){
9190 char * command = Ctrl -> name ;
9291 int opt ;
9392
94- while ((opt = getopt (argc , argv , ":M :T:A:h" )) != -1 ) {
93+ while ((opt = getopt (argc , argv , ":P :T:A:h" )) != -1 ) {
9594 switch (opt ) {
96- // 模型参数, -Malpha/beta/rho
97- case 'M ' :
98- Ctrl -> M .active = true;
99- if (2 != sscanf (optarg , "%lf/%lf " , & Ctrl -> M . alpha , & Ctrl -> M . beta )){
100- GRTBadOptionError (command , M , "" );
95+ // 模型参数, -P<nu>
96+ case 'P ' :
97+ Ctrl -> P .active = true;
98+ if (1 != sscanf (optarg , "%lf" , & Ctrl -> P . nu )){
99+ GRTBadOptionError (command , P , "" );
101100 }
102- if (Ctrl -> M .alpha <= 0.0 || Ctrl -> M .beta <= 0.0 ){
103- GRTBadOptionError (command , M , "only support positive values." );
104- }
105- // 检查泊松比范围
106- MYREAL nu = grt_possion_ratio (Ctrl -> M .beta /Ctrl -> M .alpha );
107- if (nu >= 0.5 || nu <= 0.0 ){
108- GRTBadOptionError (command , M , "possion ratio (%lf) is out of bound." , nu );
101+ if (Ctrl -> P .nu <= 0.0 || Ctrl -> P .nu >= 0.5 ){
102+ GRTBadOptionError (command , P , "possion ratio (%lf) is out of bound." , Ctrl -> P .nu );
109103 }
110104 break ;
111105
@@ -152,7 +146,7 @@ static void getopt_from_command(GRT_MODULE_CTRL *Ctrl, int argc, char **argv){
152146
153147 // 检查必须设置的参数是否有设置
154148 GRTCheckOptionSet (command , argc > 1 );
155- GRTCheckOptionActive (command , Ctrl , M );
149+ GRTCheckOptionActive (command , Ctrl , P );
156150 GRTCheckOptionActive (command , Ctrl , T );
157151 GRTCheckOptionActive (command , Ctrl , A );
158152}
@@ -170,7 +164,7 @@ int lamb1_main(int argc, char **argv){
170164 getopt_from_command (Ctrl , argc , argv );
171165
172166 // 求解,输出到标准输出
173- grt_solve_lamb1 (Ctrl -> M . alpha , Ctrl -> M . beta , Ctrl -> T .ts , Ctrl -> T .nt , Ctrl -> A .azimuth , NULL );
167+ grt_solve_lamb1 (Ctrl -> P . nu , Ctrl -> T .ts , Ctrl -> T .nt , Ctrl -> A .azimuth , NULL );
174168
175169 free_Ctrl (Ctrl );
176170 return EXIT_SUCCESS ;
0 commit comments