你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-08 07:24:19 +08:00
Trying to resolve all the merge conflicts.
这个提交包含在:
@@ -111,7 +111,7 @@ class AddGrass(UserObjectGeometry):
|
||||
if ys == yf or zs == zf:
|
||||
logger.exception(f"{self.__str__()} dimensions are not specified correctly")
|
||||
raise ValueError
|
||||
if xs != volume.xs and xs != volume.xf:
|
||||
if xs not in [volume.xs and volume.xf]:
|
||||
logger.exception(f"{self.__str__()} must specify external surfaces on a fractal box")
|
||||
raise ValueError
|
||||
fractalrange = (round_value(limits[0] / grid.dx), round_value(limits[1] / grid.dx))
|
||||
@@ -133,10 +133,10 @@ class AddGrass(UserObjectGeometry):
|
||||
requestedsurface = "xplus"
|
||||
|
||||
elif ys == yf:
|
||||
if xs == xf or zs == zf:
|
||||
if zs == zf:
|
||||
logger.exception(f"{self.__str__()} dimensions are not specified correctly")
|
||||
raise ValueError
|
||||
if ys != volume.ys and ys != volume.yf:
|
||||
if ys not in [volume.ys and volume.yf]:
|
||||
logger.exception(f"{self.__str__()} must specify external surfaces on a fractal box")
|
||||
raise ValueError
|
||||
fractalrange = (round_value(limits[0] / grid.dy), round_value(limits[1] / grid.dy))
|
||||
@@ -158,10 +158,7 @@ class AddGrass(UserObjectGeometry):
|
||||
requestedsurface = "yplus"
|
||||
|
||||
elif zs == zf:
|
||||
if xs == xf or ys == yf:
|
||||
logger.exception(f"{self.__str__()} dimensions are not specified correctly")
|
||||
raise ValueError
|
||||
if zs != volume.zs and zs != volume.zf:
|
||||
if zs not in [volume.zs and volume.zf]:
|
||||
logger.exception(f"{self.__str__()} must specify external surfaces on a fractal box")
|
||||
raise ValueError
|
||||
fractalrange = (round_value(limits[0] / grid.dz), round_value(limits[1] / grid.dz))
|
||||
@@ -238,7 +235,7 @@ class AddGrass(UserObjectGeometry):
|
||||
surface.grass.append(g)
|
||||
|
||||
# Check to see if grass has been already defined as a material
|
||||
if not any(x.ID == "grass" for x in grid.materials):
|
||||
if all(x.ID == "grass" for x in grid.materials):
|
||||
create_grass(grid)
|
||||
|
||||
# Check if time step for model is suitable for using grass
|
||||
|
@@ -123,7 +123,7 @@ class AddSurfaceRoughness(UserObjectGeometry):
|
||||
if ys == yf or zs == zf:
|
||||
logger.exception(f"{self.__str__()} dimensions are not specified correctly")
|
||||
raise ValueError
|
||||
if xs != volume.xs and xs != volume.xf:
|
||||
if xs not in [volume.xs, volume.xf]:
|
||||
logger.exception(f"{self.__str__()} can only be used on the external " + "surfaces of a fractal box")
|
||||
raise ValueError
|
||||
fractalrange = (round_value(limits[0] / grid.dx), round_value(limits[1] / grid.dx))
|
||||
@@ -151,10 +151,10 @@ class AddSurfaceRoughness(UserObjectGeometry):
|
||||
requestedsurface = "xplus"
|
||||
|
||||
elif ys == yf:
|
||||
if xs == xf or zs == zf:
|
||||
if zs == zf:
|
||||
logger.exception(f"{self.__str__()} dimensions are not specified correctly")
|
||||
raise ValueError
|
||||
if ys != volume.ys and ys != volume.yf:
|
||||
if ys not in [volume.ys and volume.yf]:
|
||||
logger.exception(f"{self.__str__()} can only be used on the external " + "surfaces of a fractal box")
|
||||
raise ValueError
|
||||
fractalrange = (round_value(limits[0] / grid.dy), round_value(limits[1] / grid.dy))
|
||||
@@ -182,10 +182,7 @@ class AddSurfaceRoughness(UserObjectGeometry):
|
||||
requestedsurface = "yplus"
|
||||
|
||||
elif zs == zf:
|
||||
if xs == xf or ys == yf:
|
||||
logger.exception(f"{self.__str__()} dimensions are not specified correctly")
|
||||
raise ValueError
|
||||
if zs != volume.zs and zs != volume.zf:
|
||||
if zs not in [volume.zs and volume.zf]:
|
||||
logger.exception(f"{self.__str__()} can only be used on the external " + "surfaces of a fractal box")
|
||||
raise ValueError
|
||||
fractalrange = (round_value(limits[0] / grid.dz), round_value(limits[1] / grid.dz))
|
||||
|
@@ -144,14 +144,13 @@ class FractalBox(UserObjectGeometry):
|
||||
f"{self.__str__()} must be used with more than " + "one material from the mixing model."
|
||||
)
|
||||
raise ValueError
|
||||
if isinstance(mixingmodel, ListMaterial):
|
||||
if nbins > len(mixingmodel.mat):
|
||||
logger.exception(
|
||||
f"{self.__str__()} too many materials/bins "
|
||||
+ "requested compared to materials in "
|
||||
+ "mixing model."
|
||||
)
|
||||
raise ValueError
|
||||
if isinstance(mixingmodel, ListMaterial) and nbins > len(mixingmodel.mat):
|
||||
logger.exception(
|
||||
f"{self.__str__()} too many materials/bins "
|
||||
+ "requested compared to materials in "
|
||||
+ "mixing model."
|
||||
)
|
||||
raise ValueError
|
||||
# Create materials from mixing model as number of bins now known
|
||||
# from fractal_box command.
|
||||
mixingmodel.calculate_properties(nbins, grid)
|
||||
|
@@ -385,7 +385,7 @@ class HertzianDipole(UserObjectMulti):
|
||||
p2 = uip.round_to_grid_static_point(p1)
|
||||
|
||||
# Check if there is a waveformID in the waveforms list
|
||||
if not any(x.ID == waveform_id for x in grid.waveforms):
|
||||
if all(x.ID == waveform_id for x in grid.waveforms):
|
||||
logger.exception(f"{self.params_str()} there is no waveform " + f"with the identifier {waveform_id}.")
|
||||
raise ValueError
|
||||
|
||||
@@ -526,7 +526,7 @@ class MagneticDipole(UserObjectMulti):
|
||||
p2 = uip.round_to_grid_static_point(p1)
|
||||
|
||||
# Check if there is a waveformID in the waveforms list
|
||||
if not any(x.ID == waveform_id for x in grid.waveforms):
|
||||
if all(x.ID == waveform_id for x in grid.waveforms):
|
||||
logger.exception(f"{self.params_str()} there is no waveform " + f"with the identifier {waveform_id}.")
|
||||
raise ValueError
|
||||
|
||||
|
@@ -73,7 +73,7 @@ class ModelConfig:
|
||||
# N.B. This will happen if the requested snapshots are too large to
|
||||
# fit on the memory of the GPU. If True this will slow
|
||||
# performance significantly.
|
||||
if sim_config.general["solver"] == "cuda" or sim_config.general["solver"] == "opencl":
|
||||
if sim_config.general["solver"] in ["cuda", "opencl"]:
|
||||
if sim_config.general["solver"] == "cuda":
|
||||
devs = sim_config.args.gpu
|
||||
elif sim_config.general["solver"] == "opencl":
|
||||
|
@@ -51,7 +51,6 @@ class Context:
|
||||
results: dict that can contain useful results/data from simulation.
|
||||
"""
|
||||
|
||||
results = {}
|
||||
self.tsimstart = timer()
|
||||
self.print_logo_copyright()
|
||||
print_host_info(config.sim_config.hostinfo)
|
||||
@@ -86,7 +85,7 @@ class Context:
|
||||
self.tsimend = timer()
|
||||
self.print_sim_time_taken()
|
||||
|
||||
return results
|
||||
return {}
|
||||
|
||||
def print_logo_copyright(self):
|
||||
"""Prints gprMax logo, version, and copyright/licencing information."""
|
||||
|
@@ -217,10 +217,9 @@ def run_main(args):
|
||||
# MPI running with (OpenMP/CUDA/OpenCL)
|
||||
if config.sim_config.args.mpi:
|
||||
context = MPIContext()
|
||||
results = context.run()
|
||||
# Standard running (OpenMP/CUDA/OpenCL)
|
||||
else:
|
||||
context = Context()
|
||||
results = context.run()
|
||||
|
||||
results = context.run()
|
||||
return results
|
||||
|
@@ -417,7 +417,7 @@ def dispersion_analysis(G):
|
||||
# Find maximum significant frequency
|
||||
if G.waveforms:
|
||||
for waveform in G.waveforms:
|
||||
if waveform.type == "sine" or waveform.type == "contsine":
|
||||
if waveform.type in ["sine", "contsine"]:
|
||||
results["maxfreq"].append(4 * waveform.freq)
|
||||
|
||||
elif waveform.type == "impulse":
|
||||
|
@@ -322,14 +322,13 @@ def check_cmd_names(processedlines, checkessential=True):
|
||||
|
||||
lindex += 1
|
||||
|
||||
if checkessential:
|
||||
if countessentialcmds < len(essentialcmds):
|
||||
logger.exception(
|
||||
"Your input file is missing essential commands "
|
||||
+ "required to run a model. Essential commands are: "
|
||||
+ ", ".join(essentialcmds)
|
||||
)
|
||||
raise SyntaxError
|
||||
if checkessential and countessentialcmds < len(essentialcmds):
|
||||
logger.exception(
|
||||
"Your input file is missing essential commands "
|
||||
+ "required to run a model. Essential commands are: "
|
||||
+ ", ".join(essentialcmds)
|
||||
)
|
||||
raise SyntaxError
|
||||
|
||||
return singlecmds, multiplecmds, geometry
|
||||
|
||||
|
@@ -1209,7 +1209,6 @@ class OpenCLUpdates:
|
||||
self.grid.Hy_dev,
|
||||
self.grid.Hz_dev,
|
||||
)
|
||||
event.wait()
|
||||
|
||||
# If there are any dispersive materials do 1st part of dispersive update
|
||||
# (it is split into two parts as it requires present and updated electric field values).
|
||||
@@ -1231,7 +1230,8 @@ class OpenCLUpdates:
|
||||
self.grid.Hy_dev,
|
||||
self.grid.Hz_dev,
|
||||
)
|
||||
event.wait()
|
||||
|
||||
event.wait()
|
||||
|
||||
def update_electric_pml(self):
|
||||
"""Updates electric field components with the PML correction."""
|
||||
@@ -1319,7 +1319,6 @@ class OpenCLUpdates:
|
||||
# if iteration == self.grid.iterations - 1:
|
||||
# return self.drv.mem_get_info()[1] - self.drv.mem_get_info()[0]
|
||||
logger.debug("Look at memory estimate for pyopencl")
|
||||
pass
|
||||
|
||||
def calculate_solve_time(self):
|
||||
"""Calculates solving time for model."""
|
||||
|
在新工单中引用
屏蔽一个用户