Skip to content

Commit ed1682d

Browse files
authored
FIX: add some warning about source in liquid (#48)
* FIX: raise error if source located on liquid interface * FIX: only compute GF of explosion if source located in liquid
1 parent 2f6b841 commit ed1682d

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

pygrt/C_extension/src/common/model.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,12 +398,23 @@ PYMODEL1D * read_pymod_from_file(const char *command, const char *modelpath, dou
398398
pymod->deprcv = deprcv;
399399

400400
// 检查,接收点不能位于液-液、固-液界面
401-
if(isrc < nlay-1 && pymod->Thk[ircv] == 0.0 && pymod->Vb[ircv]*pymod->Vb[ircv+1] == 0.0){
401+
if(ircv < nlay-1 && pymod->Thk[ircv] == 0.0 && pymod->Vb[ircv]*pymod->Vb[ircv+1] == 0.0){
402402
fprintf(stderr,
403403
"[%s] " BOLD_RED "The receiver is located on the interface where there is liquid on one side. "
404404
"Due to the discontinuity of the tangential displacement on this interface, "
405-
"to reduce ambiguity, it is recommended that you add a small offset to the receiver depth, "
406-
"thereby explicitly placing the receiver within a specific layer. \n"
405+
"to reduce ambiguity, you should add a small offset to the receiver depth, "
406+
"thereby explicitly placing it within a specific layer. \n"
407+
DEFAULT_RESTORE, command);
408+
return NULL;
409+
}
410+
411+
// 检查 --> 源点不能位于液-液、固-液界面
412+
if(isrc < nlay-1 && pymod->Thk[isrc] == 0.0 && pymod->Vb[isrc]*pymod->Vb[isrc+1] == 0.0){
413+
fprintf(stderr,
414+
"[%s] " BOLD_RED "The source is located on the interface where there is liquid on one side. "
415+
"Due to the discontinuity of the tangential displacement on this interface, "
416+
"to reduce ambiguity, you should add a small offset to the source depth, "
417+
"thereby explicitly placing it within a specific layer. \n"
407418
DEFAULT_RESTORE, command);
408419
return NULL;
409420
}

pygrt/C_extension/src/dynamic/grt_main.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -995,6 +995,12 @@ int main(int argc, char **argv) {
995995
exit(EXIT_FAILURE);
996996
}
997997

998+
// 当震源位于液体层中时,仅允许计算爆炸源对应的格林函数
999+
// 程序结束前会输出对应警告
1000+
if(pymod->Vb[pymod->isrc]==0.0){
1001+
doHF = doVF = doDC = false;
1002+
}
1003+
9981004
// 最大最小速度
9991005
get_pymod_vmin_vmax(pymod, &vmin, &vmax);
10001006

@@ -1204,6 +1210,14 @@ int main(int argc, char **argv) {
12041210

12051211
free(s_output_subdir);
12061212
}
1213+
1214+
// 输出警告:当震源位于液体层中时,仅允许计算爆炸源对应的格林函数
1215+
if(pymod->Vb[pymod->isrc]==0.0){
1216+
fprintf(stderr, "[%s] " BOLD_YELLOW
1217+
"The source is located in the liquid layer, "
1218+
"therefore only the Green's Funtions for the Explosion source will be computed.\n"
1219+
DEFAULT_RESTORE, command);
1220+
}
12071221

12081222

12091223
// 释放内存

0 commit comments

Comments
 (0)