你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 04:56:51 +08:00
Added check at beginning of simulation to ensure sources and receivers are not stepped outside of domain (with srcstep and rxstep commands).
这个提交包含在:
@@ -349,6 +349,24 @@ def run_model(args, modelrun, numbermodelruns, inputfile, usernamespace):
|
||||
# Prepare any snapshot files
|
||||
for snapshot in G.snapshots:
|
||||
snapshot.prepare_vtk_imagedata(modelrun, numbermodelruns, G)
|
||||
|
||||
# Adjust position of sources and receivers if required
|
||||
if G.srcstepx > 0 or G.srcstepy > 0 or G.srcstepz > 0:
|
||||
for source in itertools.chain(G.hertziandipoles, G.magneticdipoles, G.voltagesources, G.transmissionlines):
|
||||
if modelrun == 1:
|
||||
if source.xcoord + G.srcstepx * (numbermodelruns - 1) > G.nx or source.ycoord + G.srcstepy * (numbermodelruns - 1) > G.ny or source.zcoord + G.srcstepz * (numbermodelruns - 1) > G.nz:
|
||||
raise GeneralError('Source(s) will be stepped to a position outside the domain.')
|
||||
source.xcoord += (modelrun - 1) * G.srcstepx
|
||||
source.ycoord += (modelrun - 1) * G.srcstepy
|
||||
source.zcoord += (modelrun - 1) * G.srcstepz
|
||||
if G.rxstepx > 0 or G.rxstepy > 0 or G.rxstepz > 0:
|
||||
for receiver in G.rxs:
|
||||
if modelrun == 1:
|
||||
if receiver.xcoord + G.rxstepx * (numbermodelruns - 1) > G.nx or receiver.ycoord + G.rxstepy * (numbermodelruns - 1) > G.ny or receiver.zcoord + G.rxstepz * (numbermodelruns - 1) > G.nz:
|
||||
raise GeneralError('Receiver(s) will be stepped to a position outside the domain.')
|
||||
receiver.xcoord += (modelrun - 1) * G.rxstepx
|
||||
receiver.ycoord += (modelrun - 1) * G.rxstepy
|
||||
receiver.zcoord += (modelrun - 1) * G.rxstepz
|
||||
|
||||
# Prepare output file
|
||||
inputfileparts = os.path.splitext(inputfile)
|
||||
@@ -360,18 +378,6 @@ def run_model(args, modelrun, numbermodelruns, inputfile, usernamespace):
|
||||
sys.stdout.flush()
|
||||
f = prepare_hdf5(outputfile, G)
|
||||
|
||||
# Adjust position of sources and receivers if required
|
||||
if G.srcstepx > 0 or G.srcstepy > 0 or G.srcstepz > 0:
|
||||
for source in itertools.chain(G.hertziandipoles, G.magneticdipoles, G.voltagesources, G.transmissionlines):
|
||||
source.xcoord += (modelrun - 1) * G.srcstepx
|
||||
source.ycoord += (modelrun - 1) * G.srcstepy
|
||||
source.zcoord += (modelrun - 1) * G.srcstepz
|
||||
if G.rxstepx > 0 or G.rxstepy > 0 or G.rxstepz > 0:
|
||||
for receiver in G.rxs:
|
||||
receiver.xcoord += (modelrun - 1) * G.rxstepx
|
||||
receiver.ycoord += (modelrun - 1) * G.rxstepy
|
||||
receiver.zcoord += (modelrun - 1) * G.rxstepz
|
||||
|
||||
##################################
|
||||
# Main FDTD calculation loop #
|
||||
##################################
|
||||
|
在新工单中引用
屏蔽一个用户