diff --git a/docs/source/examples_simple_2D.rst b/docs/source/examples_simple_2D.rst index 836bf050..5bf09d91 100644 --- a/docs/source/examples_simple_2D.rst +++ b/docs/source/examples_simple_2D.rst @@ -68,12 +68,6 @@ The domain size should be enough to enclose the volume of interest, plus allow 1 #domain: 0.240 0.190 0.002 -Since this is a 2D model the PML should be switched off for the two faces of the domain in the infinite direction (in this case the z direction). This is achieved using the command: - -.. code-block:: none - - #pml_cells: 10 10 0 10 10 0 - Choose a time window -------------------- @@ -87,11 +81,7 @@ This is the minimum time required, but the pulse wavelet has a width of 1.2 ns, #time_window: 3e-9 -gprMax will calculate the time step required for the model using the CFL condition in 3D. However, since this is a 2D model the time step can be relaxed to the CFL condition in 2D. This is achieved using the command: - -.. code-block:: none - - #time_step_limit_type: 2D +gprMax will calculate the time step required for the model using the CFL condition in 2D. Create the objects ------------------ diff --git a/gprMax/grid.py b/gprMax/grid.py index bb21fb42..ed9fb8f1 100644 --- a/gprMax/grid.py +++ b/gprMax/grid.py @@ -40,7 +40,7 @@ class FDTDGrid: self.timewindow = 0 self.nthreads = 0 self.cfs = [] - self.pmlthickness = (10, 10, 10, 10, 10, 10) + self.pmlthickness = 10 self.pmls = [] self.materials = [] self.mixingmodels = [] diff --git a/gprMax/input_cmds_file.py b/gprMax/input_cmds_file.py index 531d989e..7718c2e1 100644 --- a/gprMax/input_cmds_file.py +++ b/gprMax/input_cmds_file.py @@ -116,7 +116,7 @@ def check_cmd_names(processedlines): essentialcmds = ['#domain', '#dx_dy_dz', '#time_window'] # Commands that there should only be one instance of in a model - singlecmds = dict.fromkeys(['#domain', '#dx_dy_dz', '#time_window', '#title', '#messages', '#num_threads', '#time_step_stability_factor', '#time_step_limit_type', '#pml_cells', '#excitation_file', '#src_steps', '#rx_steps', '#taguchi', '#end_taguchi'], 'None') + singlecmds = dict.fromkeys(['#domain', '#dx_dy_dz', '#time_window', '#title', '#messages', '#num_threads', '#time_step_stability_factor', '#pml_cells', '#excitation_file', '#src_steps', '#rx_steps', '#taguchi', '#end_taguchi'], 'None') # Commands that there can be multiple instances of in a model - these will be lists within the dictionary multiplecmds = {key: [] for key in ['#geometry_view', '#material', '#soil_peplinski', '#add_dispersion_debye', '#add_dispersion_lorentz', '#add_dispersion_drude', '#waveform', '#voltage_source', '#hertzian_dipole', '#magnetic_dipole', '#transmission_line', '#rx', '#rx_box', '#snapshot', '#pml_cfs']} diff --git a/gprMax/input_cmds_singleuse.py b/gprMax/input_cmds_singleuse.py index 45120a09..8a2f92ec 100644 --- a/gprMax/input_cmds_singleuse.py +++ b/gprMax/input_cmds_singleuse.py @@ -115,27 +115,19 @@ def process_singlecmds(singlecmds, multicmds, G): print('Memory (RAM) usage: ~{} required, {} available'.format(human_size(mem), human_size(psutil.virtual_memory().total))) - # Time step CFL limit - use either 2D or 3D (default) - cmd = '#time_step_limit_type' - if singlecmds[cmd] != 'None': - tmp = singlecmds[cmd].split() - if len(tmp) != 1: - raise CmdInputError(cmd + ' requires exactly one parameter') - if singlecmds[cmd].lower() == '2d': - if G.nx == 1: - G.dt = 1 / (c * np.sqrt((1 / G.dy) * (1 / G.dy) + (1 / G.dz) * (1 / G.dz))) - elif G.ny == 1: - G.dt = 1 / (c * np.sqrt((1 / G.dx) * (1 / G.dx) + (1 / G.dz) * (1 / G.dz))) - elif G.nz == 1: - G.dt = 1 / (c * np.sqrt((1 / G.dx) * (1 / G.dx) + (1 / G.dy) * (1 / G.dy))) - else: - raise CmdInputError(cmd + ' 2D CFL limit can only be used when one dimension of the domain is one cell') - elif singlecmds[cmd].lower() == '3d': - G.dt = 1 / (c * np.sqrt((1 / G.dx) * (1 / G.dx) + (1 / G.dy) * (1 / G.dy) + (1 / G.dz) * (1 / G.dz))) - else: - raise CmdInputError(cmd + ' requires input values of either 2D or 3D') + # Time step CFL limit (use either 2D or 3D) and default PML thickness + if G.nx == 1: + G.dt = 1 / (c * np.sqrt((1 / G.dy) * (1 / G.dy) + (1 / G.dz) * (1 / G.dz))) + G.pmlthickness = (0, G.pmlthickness, G.pmlthickness, 0, G.pmlthickness, G.pmlthickness) + elif G.ny == 1: + G.dt = 1 / (c * np.sqrt((1 / G.dx) * (1 / G.dx) + (1 / G.dz) * (1 / G.dz))) + G.pmlthickness = (G.pmlthickness, 0, G.pmlthickness, G.pmlthickness, 0, G.pmlthickness) + elif G.nz == 1: + G.dt = 1 / (c * np.sqrt((1 / G.dx) * (1 / G.dx) + (1 / G.dy) * (1 / G.dy))) + G.pmlthickness = (G.pmlthickness, G.pmlthickness, 0, G.pmlthickness, G.pmlthickness, 0) else: G.dt = 1 / (c * np.sqrt((1 / G.dx) * (1 / G.dx) + (1 / G.dy) * (1 / G.dy) + (1 / G.dz) * (1 / G.dz))) + G.pmlthickness = (G.pmlthickness, G.pmlthickness, G.pmlthickness, G.pmlthickness, G.pmlthickness, G.pmlthickness) # Round down time step to nearest float with precision one less than hardware maximum. Avoids inadvertently exceeding the CFL due to binary representation of floating point number. G.dt = round_value(G.dt, decimalplaces=d.getcontext().prec - 1) diff --git a/user_models/cylinder_Ascan_2D.in b/user_models/cylinder_Ascan_2D.in index 878836dd..5ff10d98 100644 --- a/user_models/cylinder_Ascan_2D.in +++ b/user_models/cylinder_Ascan_2D.in @@ -2,13 +2,11 @@ #domain: 0.240 0.190 0.002 #dx_dy_dz: 0.002 0.002 0.002 #time_window: 3e-9 -#time_step_limit_type: 2D -#pml_cells: 10 10 0 10 10 0 #material: 6 0 1 0 half_space #waveform: ricker 1 1.5e9 my_ricker -#hertzian_dipole: z 0.100 0.170 0 my_ricker +#hertzian_dipole: z 0.100 0.170 0 my_ricker 0 2e-9 #rx: 0.140 0.170 0 #box: 0 0 0 0.240 0.170 0.002 half_space diff --git a/user_models/cylinder_Bscan_2D.in b/user_models/cylinder_Bscan_2D.in index db419444..e4972b8f 100644 --- a/user_models/cylinder_Bscan_2D.in +++ b/user_models/cylinder_Bscan_2D.in @@ -2,8 +2,6 @@ #domain: 0.240 0.190 0.002 #dx_dy_dz: 0.002 0.002 0.002 #time_window: 3e-9 -#time_step_limit_type: 2D -#pml_cells: 10 10 0 10 10 0 #material: 6 0 1 0 half_space