你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-08 07:24:19 +08:00
Refactor grid discretisation initialisation
这个提交包含在:
@@ -90,14 +90,14 @@ class Discretisation(UserObjectSingle):
|
|||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
self.order = 2
|
self.order = 2
|
||||||
|
|
||||||
def build(self, G, uip):
|
def build(self, model, uip):
|
||||||
try:
|
try:
|
||||||
G.dl = np.array(self.kwargs["p1"])
|
model.set_grid_discretisation(self.kwargs["p1"])
|
||||||
G.dx, G.dy, G.dz = self.kwargs["p1"]
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
logger.exception(f"{self.__str__()} discretisation requires a point")
|
logger.exception(f"{self.__str__()} discretisation requires a point")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
G = model.G
|
||||||
if G.dl[0] <= 0:
|
if G.dl[0] <= 0:
|
||||||
logger.exception(
|
logger.exception(
|
||||||
f"{self.__str__()} discretisation requires the "
|
f"{self.__str__()} discretisation requires the "
|
||||||
|
@@ -59,6 +59,7 @@ class FDTDGrid:
|
|||||||
self.dx = 0.0
|
self.dx = 0.0
|
||||||
self.dy = 0.0
|
self.dy = 0.0
|
||||||
self.dz = 0.0
|
self.dz = 0.0
|
||||||
|
self.dl: np.ndarray
|
||||||
self.dt = 0.0
|
self.dt = 0.0
|
||||||
self.dt_mod = None # Time step stability factor
|
self.dt_mod = None # Time step stability factor
|
||||||
self.iteration = 0 # Current iteration number
|
self.iteration = 0 # Current iteration number
|
||||||
|
@@ -20,6 +20,7 @@ import datetime
|
|||||||
import itertools
|
import itertools
|
||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
|
from typing import Tuple
|
||||||
|
|
||||||
import humanize
|
import humanize
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@@ -160,6 +161,10 @@ class Model:
|
|||||||
if grid.snapshots:
|
if grid.snapshots:
|
||||||
save_snapshots(grid)
|
save_snapshots(grid)
|
||||||
|
|
||||||
|
def set_grid_discretisation(self, point: Tuple[float, float, float]):
|
||||||
|
self.G.dl = np.array(point)
|
||||||
|
self.G.dx, self.G.dy, self.G.dz = point
|
||||||
|
|
||||||
def solve(self, solver):
|
def solve(self, solver):
|
||||||
"""Solve using FDTD method.
|
"""Solve using FDTD method.
|
||||||
|
|
||||||
|
在新工单中引用
屏蔽一个用户