diff --git a/gprMax/cmds_multiuse.py b/gprMax/cmds_multiuse.py index 9fb768cc..c6dfa146 100644 --- a/gprMax/cmds_multiuse.py +++ b/gprMax/cmds_multiuse.py @@ -390,7 +390,7 @@ class HertzianDipole(UserObjectMulti): # Check if there is a waveformID in the waveforms list - if not any(x.ID == waveform_id for x in grid.waveforms): + if all(x.ID == waveform_id for x in grid.waveforms): logger.exception(f'{self.params_str()} there is no waveform ' + f'with the identifier {waveform_id}.') raise ValueError @@ -526,7 +526,7 @@ class MagneticDipole(UserObjectMulti): # Check if there is a waveformID in the waveforms list - if not any(x.ID == waveform_id for x in grid.waveforms): + if all(x.ID == waveform_id for x in grid.waveforms): logger.exception(f'{self.params_str()} there is no waveform ' + f'with the identifier {waveform_id}.') raise ValueError diff --git a/gprMax/config.py b/gprMax/config.py index 162b06c8..cd2025fc 100644 --- a/gprMax/config.py +++ b/gprMax/config.py @@ -72,7 +72,7 @@ class ModelConfig: # N.B. This will happen if the requested snapshots are too large to # fit on the memory of the GPU. If True this will slow # performance significantly. - if sim_config.general['solver'] == 'cuda' or sim_config.general['solver'] == 'opencl': + if sim_config.general['solver'] in ['cuda', 'opencl']: if sim_config.general['solver'] == 'cuda': devs = sim_config.args.gpu elif sim_config.general['solver'] == 'opencl': diff --git a/gprMax/contexts.py b/gprMax/contexts.py index fbde3698..bc3004f8 100644 --- a/gprMax/contexts.py +++ b/gprMax/contexts.py @@ -53,7 +53,6 @@ class Context: results: dict that can contain useful results/data from simulation. """ - results = {} self.tsimstart = timer() self.print_logo_copyright() print_host_info(config.sim_config.hostinfo) @@ -88,7 +87,7 @@ class Context: self.tsimend = timer() self.print_sim_time_taken() - return results + return {} def print_logo_copyright(self): """Prints gprMax logo, version, and copyright/licencing information.""" diff --git a/gprMax/gprMax.py b/gprMax/gprMax.py index 91776ca8..6454becf 100644 --- a/gprMax/gprMax.py +++ b/gprMax/gprMax.py @@ -214,10 +214,9 @@ def run_main(args): # MPI running with (OpenMP/CUDA/OpenCL) if config.sim_config.args.mpi: context = MPIContext() - results = context.run() # Standard running (OpenMP/CUDA/OpenCL) else: context = Context() - results = context.run() + results = context.run() return results \ No newline at end of file diff --git a/gprMax/grid.py b/gprMax/grid.py index a4960727..b118019e 100644 --- a/gprMax/grid.py +++ b/gprMax/grid.py @@ -414,7 +414,7 @@ def dispersion_analysis(G): # Find maximum significant frequency if G.waveforms: for waveform in G.waveforms: - if waveform.type == 'sine' or waveform.type == 'contsine': + if waveform.type in ['sine', 'contsine']: results['maxfreq'].append(4 * waveform.freq) elif waveform.type == 'impulse': diff --git a/gprMax/hash_cmds_file.py b/gprMax/hash_cmds_file.py index 845b21d5..fc99385f 100644 --- a/gprMax/hash_cmds_file.py +++ b/gprMax/hash_cmds_file.py @@ -278,12 +278,11 @@ def check_cmd_names(processedlines, checkessential=True): lindex += 1 - if checkessential: - if (countessentialcmds < len(essentialcmds)): - logger.exception('Your input file is missing essential commands ' + - 'required to run a model. Essential commands are: ' + - ', '.join(essentialcmds)) - raise SyntaxError + if checkessential and countessentialcmds < len(essentialcmds): + logger.exception('Your input file is missing essential commands ' + + 'required to run a model. Essential commands are: ' + + ', '.join(essentialcmds)) + raise SyntaxError return singlecmds, multiplecmds, geometry diff --git a/gprMax/updates.py b/gprMax/updates.py index 8c05f560..5f258852 100644 --- a/gprMax/updates.py +++ b/gprMax/updates.py @@ -1056,7 +1056,6 @@ class OpenCLUpdates: self.grid.Hx_dev, self.grid.Hy_dev, self.grid.Hz_dev) - event.wait() # If there are any dispersive materials do 1st part of dispersive update # (it is split into two parts as it requires present and updated electric field values). @@ -1076,7 +1075,8 @@ class OpenCLUpdates: self.grid.Hx_dev, self.grid.Hy_dev, self.grid.Hz_dev) - event.wait() + + event.wait() def update_electric_pml(self): """Updates electric field components with the PML correction.""" @@ -1158,7 +1158,6 @@ class OpenCLUpdates: # if iteration == self.grid.iterations - 1: # return self.drv.mem_get_info()[1] - self.drv.mem_get_info()[0] logger.debug('Look at memory estimate for pyopencl') - pass def calculate_solve_time(self): """Calculates solving time for model."""