diff --git a/gprMax/grid.py b/gprMax/grid.py index a795e5ff..8de05811 100644 --- a/gprMax/grid.py +++ b/gprMax/grid.py @@ -260,6 +260,15 @@ class FDTDGrid(Grid): G.ID[1, :, :, 0] = 0 G.ID[1, :, :, 1] = 0 + + def reset_fields(self): + # Clear arrays for field components + G.initialise_field_arrays() + + # Clear arrays for fields in PML + for pml in G.pmls: + pml.initialise_field_arrays() + def dispersion_analysis(G): """ Analysis of numerical dispersion (Taflove et al, 2005, p112) - diff --git a/gprMax/model_build_run.py b/gprMax/model_build_run.py index e349c5e1..575c47d8 100644 --- a/gprMax/model_build_run.py +++ b/gprMax/model_build_run.py @@ -204,13 +204,8 @@ class ModelBuildRun: printer = Printer(model_config) inputfilestr = '\n--- Model {}/{}, input file (not re-processed, i.e. geometry fixed): {}'.format(currentmodelrun, modelend, model_config.input_file_path) printer.print(Fore.GREEN + '{} {}\n'.format(model_config.inputfilestr, '-' * (get_terminal_width() - 1 - len(model_config.inputfilestr))) + Style.RESET_ALL) + self.G.reset_fields() - # Clear arrays for field components - G.initialise_field_arrays() - - # Clear arrays for fields in PML - for pml in G.pmls: - pml.initialise_field_arrays() def build(self): """Runs a model - processes the input file; builds the Yee cells; calculates update coefficients; runs main FDTD loop.