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
1 change: 1 addition & 0 deletions pygrt/C_extension/include/grt/common/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ typedef struct {
size_t ircv; ///< 接收点所在虚拟层位, ircv>=1, ircv != isrc
bool ircvup; ///< 接收点位于浅层, ircv < isrc
bool io_depth; ///< 读取的模型首列为每层顶界面深度
bool srcrcv_isInserted; ///< 震源和台站是否已经以虚拟层的形式插入

cplx_t omgref; ///< 参考圆频率, 用于计算衰减
cplx_t omega; ///< 圆频率
Expand Down
7 changes: 6 additions & 1 deletion pygrt/C_extension/src/common/model.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ void grt_mod1d_xa_xb(GRT_MODEL1D *mod1d, const real_t k)
size_t ircv = mod1d->ircv;

for(size_t i=0; i<mod1d->n; ++i){
if( i == isrc || i == ircv ){
if( mod1d->srcrcv_isInserted && (i == isrc || i == ircv) ){
mod1d->xa[i] = mod1d->xa[i-1];
mod1d->caca[i] = mod1d->caca[i-1];
mod1d->xb[i] = mod1d->xb[i-1];
Expand Down Expand Up @@ -230,6 +230,10 @@ void grt_realloc_mod1d(GRT_MODEL1D *mod1d, size_t n){

GRT_MODEL1D * grt_read_mod1d_from_file(const char *modelpath, real_t depsrc, real_t deprcv, bool allowLiquid){
GRTCheckFileExist(modelpath);

if(depsrc * deprcv < 0.0){
GRTRaiseError("depsrc and deprcv should have the same sign.");
}

FILE *fp = GRTCheckOpenFile(modelpath, "r");

Expand Down Expand Up @@ -390,6 +394,7 @@ GRT_MODEL1D * grt_read_mod1d_from_file(const char *modelpath, real_t depsrc, rea
mod1d->n = nlay;
mod1d->depsrc = depsrc;
mod1d->deprcv = deprcv;
mod1d->srcrcv_isInserted = (depsrc >= 0.0 && deprcv >= 0.0)? true : false;

// 记录每层是否为液体层
for(size_t i = 0; i < mod1d->n; ++i){
Expand Down
1 change: 1 addition & 0 deletions pygrt/c_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class c_GRT_MODEL1D(Structure):
('ircv', c_size_t),
('ircvup', c_bool),
('io_depth', c_bool),
('srcrcv_isInserted', c_bool),

('omgref', CPLX),
('omega', CPLX),
Expand Down