From 84b0c714c32153e4246566cb2d90cb0c95fd8072 Mon Sep 17 00:00:00 2001 From: Craig Warren Date: Mon, 14 Dec 2015 10:17:58 +0000 Subject: [PATCH] Cleaned up some code formatting. --- gprMax/geometry_views.py | 1 + gprMax/materials.py | 3 +++ gprMax/pml.py | 7 ++++++- gprMax/receivers.py | 1 + gprMax/snapshots.py | 1 + 5 files changed, 12 insertions(+), 1 deletion(-) diff --git a/gprMax/geometry_views.py b/gprMax/geometry_views.py index 51d0954d..c90367b6 100644 --- a/gprMax/geometry_views.py +++ b/gprMax/geometry_views.py @@ -39,6 +39,7 @@ class GeometryView: filename (str): Filename to save to. type (str): Either 'n' for a per cell geometry view, or 'f' for a per cell edge geometry view. """ + self.xs = xs self.ys = ys self.zs = zs diff --git a/gprMax/materials.py b/gprMax/materials.py index 27bec31c..5552fb5d 100644 --- a/gprMax/materials.py +++ b/gprMax/materials.py @@ -49,6 +49,7 @@ class Material(): ID (str): Name of the material. G (class): Grid class instance - holds essential parameters describing the model. """ + self.numID = numID self.ID = ID self.type = 'standard' @@ -73,6 +74,7 @@ class Material(): Args: G (class): Grid class instance - holds essential parameters describing the model. """ + HA = (m0*self.mr / G.dt) + 0.5*self.sm HB = (m0*self.mr / G.dt) - 0.5*self.sm self.DA = HB / HA @@ -155,6 +157,7 @@ class PeplinskiSoil(): sandpartdensity (float): Density of the sand particles in the soil (g/cm3). watervolfraction (float): Two numbers that specify a range for the volumetric water fraction of the soil. """ + self.ID = ID self.S = sandfraction self.C = clayfraction diff --git a/gprMax/pml.py b/gprMax/pml.py index f7e36d26..f0cbbf15 100644 --- a/gprMax/pml.py +++ b/gprMax/pml.py @@ -40,6 +40,7 @@ class CFS(): sigmamin (float): Minimum value for sigma parameter. sigmamax (float): Maximum value for sigma parameter. """ + self.alphascaling = alphascaling self.alphamin = alphamin self.alphamax = alphamax @@ -59,6 +60,7 @@ class CFS(): mr (float): Average permeability of underlying material. G (class): Grid class instance - holds essential parameters describing the model. """ + # Get general direction from first letter of PML direction if direction[0] == 'x': d = G.dx @@ -84,6 +86,7 @@ class CFS(): Evalues (float): numpy array holding scaling value for electric PML update. Hvalues (float): numpy array holding scaling value for magnetic PML update. """ + tmp = max * ((np.linspace(0, (len(Evalues) - 1) + 0.5, num=2*len(Evalues))) / (len(Evalues) - 1)) ** order Evalues = tmp[0:-1:2] Hvalues = tmp[1::2] @@ -103,6 +106,7 @@ class CFS(): Evalues (float): numpy array holding scaling value for electric PML update. Hvalues (float): numpy array holding scaling value for magnetic PML update. """ + if scaling == 'constant': Evalues += max Hvalues += max @@ -126,6 +130,7 @@ class PML(): xs, xf, ys, yf, zs, zf (float): Extent of the PML volume. cfs (list): CFS class instances associated with the PML. """ + self.direction = direction self.xs = xs self.xf = xf @@ -270,7 +275,7 @@ def build_pml(G): def calculate_initial_pml_params(G): """ This function calculates the initial parameters and coefficients for PML including setting scaling (based on underlying material er and mr from solid array). - """ + """ for pml in G.pmls: sumer = 0 diff --git a/gprMax/receivers.py b/gprMax/receivers.py index 0b303fb8..970cd6f1 100644 --- a/gprMax/receivers.py +++ b/gprMax/receivers.py @@ -28,6 +28,7 @@ class Rx: positiony (float): y-coordinate of location in model. positionz (float): z-coordinate of location in model. """ + self.ID = None self.outputs = [] self.positionx = positionx diff --git a/gprMax/snapshots.py b/gprMax/snapshots.py index f6ead258..eae73dde 100644 --- a/gprMax/snapshots.py +++ b/gprMax/snapshots.py @@ -49,6 +49,7 @@ class Snapshot: time (int): Iteration number to take the snapshot on. filename (str): Filename to save to. """ + self.xs = xs self.ys = ys self.zs = zs