From 095213539bf55ec1a9e6f7f93ae6c012139dbd80 Mon Sep 17 00:00:00 2001 From: Craig Warren Date: Thu, 7 Apr 2016 15:40:49 +0100 Subject: [PATCH] Updated dispersion check function to return the spatial resolution of the minimum wavelength in the model. --- gprMax/grid.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/gprMax/grid.py b/gprMax/grid.py index 6a82f712..365b2d08 100644 --- a/gprMax/grid.py +++ b/gprMax/grid.py @@ -99,9 +99,12 @@ def dispersion_check(G): G (class): Grid class instance - holds essential parameters describing the model. Returns: - (boolean): Potential numerical dispersion + resolution (float): Potential numerical dispersion """ + # Minimum number of spatial steps to resolve smallest wavelength + resolvedsteps = 10 + # Find maximum frequency maxfreqs = [] for waveform in G.waveforms: @@ -137,25 +140,21 @@ def dispersion_check(G): # Find minimum wavelength ers = [material.er for material in G.materials] - miner = max(ers) + maxer = max(ers) # Minimum velocity - minvelocity = c / np.sqrt(miner) - - # Minimum number of spatial steps to resolve smallest wavelength - resolution = 10 + minvelocity = c / np.sqrt(maxer) # Minimum wavelength minwavelength = minvelocity / maxfreq - # Test for numerical dispersion - if max((G.dx, G.dy, G.dz)) > (minwavelength / resolution): - return True - else: - return False + # Resolution of minimum wavelength + resolution = minwavelength / resolvedsteps else: - return False + resolution = 0 + + return resolution def get_other_directions(direction):