你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-06 12:36:51 +08:00
Snapshots are now stored in a created directory with the name of the input file appended with '_snaps'
这个提交包含在:
@@ -790,7 +790,7 @@ or
|
||||
* ``f4 f5 f6`` are the upper right (x,y,z) coordinates of the volume of the snapshot in metres.
|
||||
* ``f7 f8 f9`` are the spatial discretisation of the snapshot in metres.
|
||||
* ``f10`` or ``i1`` are the time in seconds (float) or the iteration number (integer) which denote the point in time at which the snapshot will be taken.
|
||||
* ``file1`` is the filename of the file where the snapshot will be stored.
|
||||
* ``file1`` is the name of the file where the snapshot will be stored. Snapshot files are automatically stored in a directory with the name of the input file appended with '_snaps'. For multiple model runs each model run will have its own directory, i.e. '_snaps1', 'snaps2' etc...
|
||||
|
||||
For example to save a snapshot of the electromagnetic fields in the model at a simulated time of 3 nanoseconds use: ``#snapshot: 0 0 0 1 1 1 0.1 0.1 0.1 3e-9 snap1``
|
||||
|
||||
|
@@ -257,6 +257,7 @@ def run_model(args, modelrun, numbermodelruns, inputfile, usernamespace):
|
||||
|
||||
# Initialise an instance of the FDTDGrid class
|
||||
G = FDTDGrid()
|
||||
G.inputfilename = os.path.split(inputfile)[1]
|
||||
G.inputdirectory = usernamespace['inputdirectory']
|
||||
|
||||
# Create built-in materials
|
||||
|
@@ -27,6 +27,7 @@ class FDTDGrid:
|
||||
"""Holds attributes associated with the entire grid. A convenient way for accessing regularly used parameters."""
|
||||
|
||||
def __init__(self):
|
||||
self.inputfilename = ''
|
||||
self.inputdirectory = ''
|
||||
self.title = ''
|
||||
self.messages = True
|
||||
|
@@ -16,7 +16,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with gprMax. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
import os, sys
|
||||
import numpy as np
|
||||
from struct import pack
|
||||
|
||||
@@ -77,11 +77,15 @@ class Snapshot:
|
||||
self.vtk_ny = self.yf - self.ys
|
||||
self.vtk_nz = self.zf - self.zs
|
||||
|
||||
# Construct filename from user-supplied name and model run number
|
||||
# Create directory and construct filename from user-supplied name and model run number
|
||||
if numbermodelruns == 1:
|
||||
self.filename = G.inputdirectory + self.filename + '.vti'
|
||||
snapshotdir = os.path.join(G.inputdirectory, os.path.splitext(G.inputfilename)[0] + '_snaps')
|
||||
else:
|
||||
self.filename = G.inputdirectory + self.filename + '_' + str(modelrun) + '.vti'
|
||||
snapshotdir = os.path.join(G.inputdirectory, os.path.splitext(G.inputfilename)[0] + '_snaps' + str(modelrun))
|
||||
|
||||
if not os.path.exists(snapshotdir):
|
||||
os.mkdir(snapshotdir)
|
||||
self.filename = os.path.join(snapshotdir, self.filename + '.vti')
|
||||
|
||||
# Calculate number of cells according to requested sampling
|
||||
self.vtk_xscells = round_value(self.xs / self.dx)
|
||||
|
在新工单中引用
屏蔽一个用户