这个提交包含在:
jasminium
2019-08-27 13:44:34 +01:00
父节点 8fe477aa1b
当前提交 eb94f4ed94

查看文件

@@ -17,19 +17,9 @@
# along with gprMax. If not, see <http://www.gnu.org/licenses/>.
from ..grid import FDTDGrid
from ..materials import Material
from scipy.constants import mu_0
from scipy.constants import epsilon_0
from scipy.constants import c
import numpy as np
from colorama import init
from colorama import Fore
from colorama import Style
init()
class SubGridBase(FDTDGrid):
@@ -64,6 +54,7 @@ class SubGridBase(FDTDGrid):
# Number of sub cells to extend the sub grid beyond the IS boundary
d_to_pml = self.s_is_os_sep + self.pml_separation
# index of the is
self.n_boundary_cells = d_to_pml + self.pmlthickness['x0']
self.n_boundary_cells_x = d_to_pml + self.pmlthickness['x0']
self.n_boundary_cells_y = d_to_pml + self.pmlthickness['y0']
@@ -72,17 +63,17 @@ class SubGridBase(FDTDGrid):
self.interpolation = kwargs['interpolation']
def calculate_dt(self):
"""Calculate dt at the CFL limit."""
self.dt = (1 / (c * np.sqrt(
(1 / self.dx) * (1 / self.dx) +
(1 / self.dy) * (1 / self.dy) +
(1 / self.dz) * (1 / self.dz))))
(1 / self.dx) * (1 / self.dx) +
(1 / self.dy) * (1 / self.dy) +
(1 / self.dz) * (1 / self.dz))))
def main_grid_index_to_subgrid_index(self, i, j, k):
"""Calculate local subgrid index from global main grid index."""
i_s = self.n_boundary_cells_x + (i - self.i0) * self.ratio
j_s = self.n_boundary_cells_y + (j - self.j0) * self.ratio
k_s = self.n_boundary_cells_z + (k - self.k0) * self.ratio
return (i_s, j_s, k_s)
def initialise_geometry_arrays(self):