你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 15:10:13 +08:00
Update add_grass user object for parallel build
这个提交包含在:
@@ -99,9 +99,9 @@ class AddGrass(RotatableMixin, GeometryUserObject):
|
|||||||
raise ValueError(f"{self.__str__()} cannot find FractalBox {fractal_box_id}")
|
raise ValueError(f"{self.__str__()} cannot find FractalBox {fractal_box_id}")
|
||||||
|
|
||||||
uip = self._create_uip(grid)
|
uip = self._create_uip(grid)
|
||||||
_, p1, p2 = uip.check_box_points(p1, p2, self.__str__())
|
discretised_p1, discretised_p2 = uip.check_output_object_bounds(p1, p2, self.__str__())
|
||||||
xs, ys, zs = p1
|
xs, ys, zs = discretised_p1
|
||||||
xf, yf, zf = p2
|
xf, yf, zf = discretised_p2
|
||||||
|
|
||||||
if frac_dim < 0:
|
if frac_dim < 0:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
@@ -113,17 +113,10 @@ class AddGrass(RotatableMixin, GeometryUserObject):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Check for valid orientations
|
# Check for valid orientations
|
||||||
if xs == xf:
|
if np.count_nonzero(discretised_p1 == discretised_p2) != 1:
|
||||||
if ys == yf or zs == zf:
|
|
||||||
raise ValueError(f"{self.__str__()} dimensions are not specified correctly")
|
raise ValueError(f"{self.__str__()} dimensions are not specified correctly")
|
||||||
if xs not in [volume.xs, volume.xf]:
|
|
||||||
raise ValueError(
|
if xs == xf:
|
||||||
f"{self.__str__()} must specify external surfaces on a fractal box"
|
|
||||||
)
|
|
||||||
fractalrange = (
|
|
||||||
round_value(limits[0] / grid.dx),
|
|
||||||
round_value(limits[1] / grid.dx),
|
|
||||||
)
|
|
||||||
# xminus surface
|
# xminus surface
|
||||||
if xs == volume.xs:
|
if xs == volume.xs:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
@@ -131,25 +124,17 @@ class AddGrass(RotatableMixin, GeometryUserObject):
|
|||||||
)
|
)
|
||||||
# xplus surface
|
# xplus surface
|
||||||
elif xf == volume.xf:
|
elif xf == volume.xf:
|
||||||
if fractalrange[1] > grid.nx:
|
lower_bound = uip.discretise_point((limits[0], 0, 0))
|
||||||
raise ValueError(
|
upper_bound = uip.discretise_point((limits[1], p2[1], p2[2]))
|
||||||
f"{self.__str__()} cannot apply grass to "
|
uip.point_within_bounds(upper_bound, self.__str__())
|
||||||
"fractal box as it would exceed the domain "
|
fractalrange = (lower_bound[0], upper_bound[0])
|
||||||
"size in the x direction"
|
|
||||||
)
|
|
||||||
requestedsurface = "xplus"
|
requestedsurface = "xplus"
|
||||||
|
else:
|
||||||
elif ys == yf:
|
|
||||||
if zs == zf:
|
|
||||||
raise ValueError(f"{self.__str__()} dimensions are not specified correctly")
|
|
||||||
if ys not in [volume.ys, volume.yf]:
|
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"{self.__str__()} must specify external surfaces on a fractal box"
|
f"{self.__str__()} must specify external surfaces on a fractal box"
|
||||||
)
|
)
|
||||||
fractalrange = (
|
|
||||||
round_value(limits[0] / grid.dy),
|
elif ys == yf:
|
||||||
round_value(limits[1] / grid.dy),
|
|
||||||
)
|
|
||||||
# yminus surface
|
# yminus surface
|
||||||
if ys == volume.ys:
|
if ys == volume.ys:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
@@ -157,23 +142,17 @@ class AddGrass(RotatableMixin, GeometryUserObject):
|
|||||||
)
|
)
|
||||||
# yplus surface
|
# yplus surface
|
||||||
elif yf == volume.yf:
|
elif yf == volume.yf:
|
||||||
if fractalrange[1] > grid.ny:
|
lower_bound = uip.discretise_point((0, limits[0], 0))
|
||||||
raise ValueError(
|
upper_bound = uip.discretise_point((p2[0], limits[1], p2[2]))
|
||||||
f"{self.__str__()} cannot apply grass to "
|
uip.point_within_bounds(upper_bound, self.__str__())
|
||||||
"fractal box as it would exceed the domain "
|
fractalrange = (lower_bound[1], upper_bound[1])
|
||||||
"size in the y direction"
|
|
||||||
)
|
|
||||||
requestedsurface = "yplus"
|
requestedsurface = "yplus"
|
||||||
|
else:
|
||||||
elif zs == zf:
|
|
||||||
if zs not in [volume.zs, volume.zf]:
|
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"{self.__str__()} must specify external surfaces on a fractal box"
|
f"{self.__str__()} must specify external surfaces on a fractal box"
|
||||||
)
|
)
|
||||||
fractalrange = (
|
|
||||||
round_value(limits[0] / grid.dz),
|
elif zs == zf:
|
||||||
round_value(limits[1] / grid.dz),
|
|
||||||
)
|
|
||||||
# zminus surface
|
# zminus surface
|
||||||
if zs == volume.zs:
|
if zs == volume.zs:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
@@ -181,14 +160,15 @@ class AddGrass(RotatableMixin, GeometryUserObject):
|
|||||||
)
|
)
|
||||||
# zplus surface
|
# zplus surface
|
||||||
elif zf == volume.zf:
|
elif zf == volume.zf:
|
||||||
if fractalrange[1] > grid.nz:
|
lower_bound = uip.discretise_point((0, 0, limits[0]))
|
||||||
raise ValueError(
|
upper_bound = uip.discretise_point((p2[0], p2[1], limits[1]))
|
||||||
f"{self.__str__()} cannot apply grass to "
|
uip.point_within_bounds(upper_bound, self.__str__())
|
||||||
"fractal box as it would exceed the domain "
|
fractalrange = (lower_bound[2], upper_bound[2])
|
||||||
"size in the z direction"
|
|
||||||
)
|
|
||||||
requestedsurface = "zplus"
|
requestedsurface = "zplus"
|
||||||
|
else:
|
||||||
|
raise ValueError(
|
||||||
|
f"{self.__str__()} must specify external surfaces on a fractal box"
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"{self.__str__()} dimensions are not specified correctly")
|
raise ValueError(f"{self.__str__()} dimensions are not specified correctly")
|
||||||
|
|
||||||
@@ -258,10 +238,13 @@ class AddGrass(RotatableMixin, GeometryUserObject):
|
|||||||
|
|
||||||
volume.fractalsurfaces.append(surface)
|
volume.fractalsurfaces.append(surface)
|
||||||
|
|
||||||
|
p3 = uip.round_to_grid_static_point(p1)
|
||||||
|
p4 = uip.round_to_grid_static_point(p2)
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
f"{self.grid_name(grid)}{n_blades} blades of grass on surface from "
|
f"{self.grid_name(grid)}{n_blades} blades of grass on surface from "
|
||||||
f"{xs * grid.dx:g}m, {ys * grid.dy:g}m, {zs * grid.dz:g}m, "
|
f"{p3[0]:g}m, {p3[1]:g}m, {p3[2]:g}m, "
|
||||||
f"to {xf * grid.dx:g}m, {yf * grid.dy:g}m, {zf * grid.dz:g}m "
|
f"to {p4[0]:g}m, {p4[1]:g}m, {p4[2]:g}m "
|
||||||
f"with fractal dimension {surface.dimension:g}, fractal seeding "
|
f"with fractal dimension {surface.dimension:g}, fractal seeding "
|
||||||
f"{surface.seed}, and range {limits[0]:g}m to {limits[1]:g}m, "
|
f"{surface.seed}, and range {limits[0]:g}m to {limits[1]:g}m, "
|
||||||
f"added to {surface.operatingonID}."
|
f"added to {surface.operatingonID}."
|
||||||
|
@@ -8,6 +8,13 @@ from reframe_tests.tests.standard_tests import GprMaxGeometryTest, GprMaxRegress
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@rfm.simple_test
|
||||||
|
class TestAddGrass(GprMaxGeometryTest):
|
||||||
|
tags = {"test", "serial", "geometery", "fractal", "surface", "grass"}
|
||||||
|
sourcesdir = "src/geometry_tests/add_grass_geometry"
|
||||||
|
model = parameter(["add_grass_full", "add_grass_small"])
|
||||||
|
|
||||||
|
|
||||||
@rfm.simple_test
|
@rfm.simple_test
|
||||||
class TestAddSurfaceRoughness(GprMaxGeometryTest):
|
class TestAddSurfaceRoughness(GprMaxGeometryTest):
|
||||||
tags = {"test", "serial", "geometery", "fractal", "surface", "roughness"}
|
tags = {"test", "serial", "geometery", "fractal", "surface", "roughness"}
|
||||||
@@ -29,13 +36,6 @@ class TestAddSurfaceWater(GprMaxGeometryTest):
|
|||||||
model = parameter(["add_surface_water_full", "add_surface_water_small"])
|
model = parameter(["add_surface_water_full", "add_surface_water_small"])
|
||||||
|
|
||||||
|
|
||||||
@rfm.simple_test
|
|
||||||
class TestAddGrass(GprMaxGeometryTest):
|
|
||||||
tags = {"test", "serial", "geometery", "fractal", "surface", "grass"}
|
|
||||||
sourcesdir = "src/geometry_tests/add_grass_geometry"
|
|
||||||
model = parameter(["add_grass_full", "add_grass_small"])
|
|
||||||
|
|
||||||
|
|
||||||
@rfm.simple_test
|
@rfm.simple_test
|
||||||
class TestBoxGeometryDefaultPml(GprMaxRegressionTest):
|
class TestBoxGeometryDefaultPml(GprMaxRegressionTest):
|
||||||
tags = {"test", "serial", "geometery", "box"}
|
tags = {"test", "serial", "geometery", "box"}
|
||||||
@@ -160,6 +160,13 @@ class TestTriangleGeometry(GprMaxRegressionTest):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@rfm.simple_test
|
||||||
|
class TestAddGrassMpi(TestAddGrass):
|
||||||
|
tags = {"test", "mpi", "geometery", "fractal", "surface", "grass"}
|
||||||
|
mpi_layout = parameter([[1, 2, 2], [3, 1, 3], [4, 1, 4]])
|
||||||
|
test_dependency = TestAddGrass
|
||||||
|
|
||||||
|
|
||||||
@rfm.simple_test
|
@rfm.simple_test
|
||||||
class TestAddSurfaceRoughnessMpi(MpiMixin, TestAddSurfaceRoughness):
|
class TestAddSurfaceRoughnessMpi(MpiMixin, TestAddSurfaceRoughness):
|
||||||
tags = {"test", "mpi", "geometery", "fractal", "surface", "roughness"}
|
tags = {"test", "mpi", "geometery", "fractal", "surface", "roughness"}
|
||||||
|
在新工单中引用
屏蔽一个用户