你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 15:10:13 +08:00
Revert some of the style changes from PR341
这个提交包含在:
@@ -114,14 +114,12 @@ class Waveform(UserObjectMulti):
|
|||||||
try:
|
try:
|
||||||
wavetype = self.kwargs['wave_type'].lower()
|
wavetype = self.kwargs['wave_type'].lower()
|
||||||
except KeyError:
|
except KeyError:
|
||||||
logger.exception(
|
logger.exception(f"{self.params_str()} must have one of the " +
|
||||||
f"{self.params_str()} must have one of the following types {','.join(WaveformUser.types)}."
|
f"following types {','.join(WaveformUser.types)}.")
|
||||||
)
|
|
||||||
raise
|
raise
|
||||||
if wavetype not in WaveformUser.types:
|
if wavetype not in WaveformUser.types:
|
||||||
logger.exception(
|
logger.exception(f"{self.params_str()} must have one of the " +
|
||||||
f"{self.params_str()} must have one of the following types {','.join(WaveformUser.types)}."
|
f"following types {','.join(WaveformUser.types)}.")
|
||||||
)
|
|
||||||
raise ValueError
|
raise ValueError
|
||||||
|
|
||||||
if wavetype != 'user':
|
if wavetype != 'user':
|
||||||
@@ -836,14 +834,15 @@ class Rx(UserObjectMulti):
|
|||||||
r.outputs[field] = np.zeros(grid.iterations,
|
r.outputs[field] = np.zeros(grid.iterations,
|
||||||
dtype=config.sim_config.dtypes['float_or_double'])
|
dtype=config.sim_config.dtypes['float_or_double'])
|
||||||
else:
|
else:
|
||||||
logger.exception(
|
logger.exception(f'{self.params_str()} contains an output '
|
||||||
f'{self.params_str()} contains an output type that is not allowable. Allowable outputs in current context are {allowableoutputs}.'
|
f'type that is not allowable. Allowable '
|
||||||
)
|
f'outputs in current context are '
|
||||||
|
f'{allowableoutputs}.')
|
||||||
raise ValueError
|
raise ValueError
|
||||||
|
|
||||||
logger.info(
|
logger.info(f"{self.grid_name(grid)}Receiver at {p2[0]:g}m, {p2[1]:g}m, "
|
||||||
f"{self.grid_name(grid)}Receiver at {p2[0]:g}m, {p2[1]:g}m, {p2[2]:g}m with output component(s) {', '.join(r.outputs)} created."
|
f"{p2[2]:g}m with output component(s) "
|
||||||
)
|
f"{', '.join(r.outputs)} created.")
|
||||||
|
|
||||||
grid.rxs.append(r)
|
grid.rxs.append(r)
|
||||||
|
|
||||||
@@ -910,9 +909,10 @@ class RxArray(UserObjectMulti):
|
|||||||
'not be less than the spatial discretisation.')
|
'not be less than the spatial discretisation.')
|
||||||
raise ValueError
|
raise ValueError
|
||||||
|
|
||||||
logger.info(
|
logger.info(f'{self.grid_name(grid)}Receiver array '
|
||||||
f'{self.grid_name(grid)}Receiver array {p3[0]:g}m, {p3[1]:g}m, {p3[2]:g}m, to {p4[0]:g}m, {p4[1]:g}m, {p4[2]:g}m with steps {dx * grid.dx:g}m, {dy * grid.dy:g}m, {dz * grid.dz:g}m'
|
f'{p3[0]:g}m, {p3[1]:g}m, {p3[2]:g}m, to '
|
||||||
)
|
f'{p4[0]:g}m, {p4[1]:g}m, {p4[2]:g}m with steps '
|
||||||
|
f'{dx * grid.dx:g}m, {dy * grid.dy:g}m, {dz * grid.dz:g}m')
|
||||||
|
|
||||||
for x in range(xs, xf + 1, dx):
|
for x in range(xs, xf + 1, dx):
|
||||||
for y in range(ys, yf + 1, dy):
|
for y in range(ys, yf + 1, dy):
|
||||||
@@ -1024,9 +1024,10 @@ class Snapshot(UserObjectMulti):
|
|||||||
# Check and set output names
|
# Check and set output names
|
||||||
for output in tmp:
|
for output in tmp:
|
||||||
if output not in SnapshotUser.allowableoutputs.keys():
|
if output not in SnapshotUser.allowableoutputs.keys():
|
||||||
logger.exception(
|
logger.exception(f"{self.params_str()} contains an output "
|
||||||
f"{self.params_str()} contains an output type that is not allowable. Allowable outputs in current context are {', '.join(SnapshotUser.allowableoutputs.keys())}."
|
f"type that is not allowable. Allowable "
|
||||||
)
|
f"outputs in current context are "
|
||||||
|
f"{', '.join(SnapshotUser.allowableoutputs.keys())}.")
|
||||||
raise ValueError
|
raise ValueError
|
||||||
else:
|
else:
|
||||||
outputs[output] = True
|
outputs[output] = True
|
||||||
@@ -1084,35 +1085,33 @@ class Material(UserObjectMulti):
|
|||||||
sm = self.kwargs['sm']
|
sm = self.kwargs['sm']
|
||||||
material_id = self.kwargs['id']
|
material_id = self.kwargs['id']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
logger.exception(f'{self.params_str()} requires exactly five parameters.')
|
logger.exception(f'{self.params_str()} requires exactly five '
|
||||||
|
f'parameters.')
|
||||||
raise
|
raise
|
||||||
|
|
||||||
if er < 1:
|
if er < 1:
|
||||||
logger.exception(
|
logger.exception(f'{self.params_str()} requires a positive value of '
|
||||||
f'{self.params_str()} requires a positive value of one or greater for static (DC) permittivity.'
|
f'one or greater for static (DC) permittivity.')
|
||||||
)
|
|
||||||
raise ValueError
|
raise ValueError
|
||||||
if se != 'inf':
|
if se != 'inf':
|
||||||
se = float(se)
|
se = float(se)
|
||||||
if se < 0:
|
if se < 0:
|
||||||
logger.exception(
|
logger.exception(f'{self.params_str()} requires a positive '
|
||||||
f'{self.params_str()} requires a positive value for electric conductivity.'
|
f'value for electric conductivity.')
|
||||||
)
|
|
||||||
raise ValueError
|
raise ValueError
|
||||||
else:
|
else:
|
||||||
se = float('inf')
|
se = float('inf')
|
||||||
if mr < 1:
|
if mr < 1:
|
||||||
logger.exception(
|
logger.exception(f'{self.params_str()} requires a positive value of '
|
||||||
f'{self.params_str()} requires a positive value of one or greater for magnetic permeability.'
|
f'one or greater for magnetic permeability.')
|
||||||
)
|
|
||||||
raise ValueError
|
raise ValueError
|
||||||
if sm < 0:
|
if sm < 0:
|
||||||
logger.exception(
|
logger.exception(f'{self.params_str()} requires a positive value '
|
||||||
f'{self.params_str()} requires a positive value for magnetic loss.'
|
f'for magnetic loss.')
|
||||||
)
|
|
||||||
raise ValueError
|
raise ValueError
|
||||||
if any(x.ID == material_id for x in grid.materials):
|
if any(x.ID == material_id for x in grid.materials):
|
||||||
logger.exception(f'{self.params_str()} with ID {material_id} already exists')
|
logger.exception(f'{self.params_str()} with ID {material_id} '
|
||||||
|
f'already exists')
|
||||||
raise ValueError
|
raise ValueError
|
||||||
|
|
||||||
# Create a new instance of the Material class material
|
# Create a new instance of the Material class material
|
||||||
@@ -1127,9 +1126,9 @@ class Material(UserObjectMulti):
|
|||||||
m.averagable = False
|
m.averagable = False
|
||||||
|
|
||||||
m.er = er
|
m.er = er
|
||||||
logger.info(
|
logger.info(f'{self.grid_name(grid)}Material {m.ID} with eps_r={m.er:g}, '
|
||||||
f'{self.grid_name(grid)}Material {m.ID} with eps_r={m.er:g}, sigma={m.se:g} S/m; mu_r={m.mr:g}, sigma*={m.sm:g} Ohm/m created.'
|
f'sigma={m.se:g} S/m; mu_r={m.mr:g}, sigma*={m.sm:g} Ohm/m '
|
||||||
)
|
f'created.')
|
||||||
|
|
||||||
grid.materials.append(m)
|
grid.materials.append(m)
|
||||||
|
|
||||||
@@ -1202,9 +1201,9 @@ class AddDebyeDispersion(UserObjectMulti):
|
|||||||
# Replace original material with newly created DispersiveMaterial
|
# Replace original material with newly created DispersiveMaterial
|
||||||
grid.materials = [disp_material if mat.numID==material.numID else mat for mat in grid.materials]
|
grid.materials = [disp_material if mat.numID==material.numID else mat for mat in grid.materials]
|
||||||
|
|
||||||
logger.info(
|
logger.info(f"{self.grid_name(grid)}Debye disperion added to {disp_material.ID} "
|
||||||
f"{self.grid_name(grid)}Debye disperion added to {disp_material.ID} with delta_eps_r={', '.join('%4.2f' % deltaer for deltaer in disp_material.deltaer)}, and tau={', '.join('%4.3e' % tau for tau in disp_material.tau)} secs created."
|
f"with delta_eps_r={', '.join('%4.2f' % deltaer for deltaer in disp_material.deltaer)}, "
|
||||||
)
|
f"and tau={', '.join('%4.3e' % tau for tau in disp_material.tau)} secs created.")
|
||||||
|
|
||||||
|
|
||||||
class AddLorentzDispersion(UserObjectMulti):
|
class AddLorentzDispersion(UserObjectMulti):
|
||||||
@@ -1280,8 +1279,10 @@ class AddLorentzDispersion(UserObjectMulti):
|
|||||||
grid.materials = [disp_material if mat.numID==material.numID else mat for mat in grid.materials]
|
grid.materials = [disp_material if mat.numID==material.numID else mat for mat in grid.materials]
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
f"{self.grid_name(grid)}Lorentz disperion added to {disp_material.ID} with delta_eps_r={', '.join('%4.2f' % deltaer for deltaer in disp_material.deltaer)}, omega={', '.join('%4.3e' % omega for omega in disp_material.tau)} secs, and gamma={', '.join('%4.3e' % delta for delta in disp_material.alpha)} created."
|
f"{self.grid_name(grid)}Lorentz disperion added to {disp_material.ID} "
|
||||||
)
|
f"with delta_eps_r={', '.join('%4.2f' % deltaer for deltaer in disp_material.deltaer)}, "
|
||||||
|
f"omega={', '.join('%4.3e' % omega for omega in disp_material.tau)} secs, "
|
||||||
|
f"and gamma={', '.join('%4.3e' % delta for delta in disp_material.alpha)} created.")
|
||||||
|
|
||||||
|
|
||||||
class AddDrudeDispersion(UserObjectMulti):
|
class AddDrudeDispersion(UserObjectMulti):
|
||||||
@@ -1351,8 +1352,9 @@ class AddDrudeDispersion(UserObjectMulti):
|
|||||||
grid.materials = [disp_material if mat.numID==material.numID else mat for mat in grid.materials]
|
grid.materials = [disp_material if mat.numID==material.numID else mat for mat in grid.materials]
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
f"{self.grid_name(grid)}Drude disperion added to {disp_material.ID} with omega={', '.join('%4.3e' % omega for omega in disp_material.tau)} secs, and gamma={', '.join('%4.3e' % alpha for alpha in disp_material.alpha)} secs created."
|
f"{self.grid_name(grid)}Drude disperion added to {disp_material.ID} "
|
||||||
)
|
f"with omega={', '.join('%4.3e' % omega for omega in disp_material.tau)} secs, "
|
||||||
|
f"and gamma={', '.join('%4.3e' % alpha for alpha in disp_material.alpha)} secs created.")
|
||||||
|
|
||||||
|
|
||||||
class SoilPeplinski(UserObjectMulti):
|
class SoilPeplinski(UserObjectMulti):
|
||||||
@@ -1513,7 +1515,8 @@ class MaterialRange(UserObjectMulti):
|
|||||||
|
|
||||||
# Create a new instance of the Material class material
|
# Create a new instance of the Material class material
|
||||||
# (start index after pec & free_space)
|
# (start index after pec & free_space)
|
||||||
s = RangeMaterialUser(ID, (er_lower, er_upper), (sigma_lower, sigma_upper), (mr_lower, mr_upper), (ro_lower, ro_upper))
|
s = RangeMaterialUser(ID, (er_lower, er_upper), (sigma_lower, sigma_upper),
|
||||||
|
(mr_lower, mr_upper), (ro_lower, ro_upper))
|
||||||
|
|
||||||
logger.info(self.grid_name(grid) + 'Material properties used to '
|
logger.info(self.grid_name(grid) + 'Material properties used to '
|
||||||
f'create {s.ID} with range(s) {s.er[0]:g} to {s.er[1]:g}, relative permittivity '
|
f'create {s.ID} with range(s) {s.er[0]:g} to {s.er[1]:g}, relative permittivity '
|
||||||
@@ -1547,8 +1550,7 @@ class MaterialList(UserObjectMulti):
|
|||||||
logger.exception(self.params_str() + ' requires at at least 2 '
|
logger.exception(self.params_str() + ' requires at at least 2 '
|
||||||
'parameters.')
|
'parameters.')
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
if any(x.ID == ID for x in grid.mixingmodels):
|
if any(x.ID == ID for x in grid.mixingmodels):
|
||||||
logger.exception(self.params_str() + f' with ID {ID} already exists')
|
logger.exception(self.params_str() + f' with ID {ID} already exists')
|
||||||
raise ValueError
|
raise ValueError
|
||||||
@@ -1564,7 +1566,6 @@ class MaterialList(UserObjectMulti):
|
|||||||
grid.mixingmodels.append(s)
|
grid.mixingmodels.append(s)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class GeometryView(UserObjectMulti):
|
class GeometryView(UserObjectMulti):
|
||||||
"""Outputs to file(s) information about the geometry (mesh) of model.
|
"""Outputs to file(s) information about the geometry (mesh) of model.
|
||||||
|
|
||||||
@@ -1625,7 +1626,6 @@ class GeometryView(UserObjectMulti):
|
|||||||
|
|
||||||
dx, dy, dz = uip.discretise_static_point(dl)
|
dx, dy, dz = uip.discretise_static_point(dl)
|
||||||
|
|
||||||
|
|
||||||
if dx < 0 or dy < 0 or dz < 0:
|
if dx < 0 or dy < 0 or dz < 0:
|
||||||
logger.exception(self.params_str() + ' the step size should not be '
|
logger.exception(self.params_str() + ' the step size should not be '
|
||||||
'less than zero.')
|
'less than zero.')
|
||||||
|
@@ -97,19 +97,16 @@ class Discretisation(UserObjectSingle):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
if G.dl[0] <= 0:
|
if G.dl[0] <= 0:
|
||||||
logger.exception(
|
logger.exception(f'{self.__str__()} discretisation requires the '
|
||||||
f'{self.__str__()} discretisation requires the x-direction spatial step to be greater than zero'
|
f'x-direction spatial step to be greater than zero')
|
||||||
)
|
|
||||||
raise ValueError
|
raise ValueError
|
||||||
if G.dl[1] <= 0:
|
if G.dl[1] <= 0:
|
||||||
logger.exception(
|
logger.exception(f'{self.__str__()} discretisation requires the '
|
||||||
f'{self.__str__()} discretisation requires the y-direction spatial step to be greater than zero'
|
f'y-direction spatial step to be greater than zero')
|
||||||
)
|
|
||||||
raise ValueError
|
raise ValueError
|
||||||
if G.dl[2] <= 0:
|
if G.dl[2] <= 0:
|
||||||
logger.exception(
|
logger.exception(f'{self.__str__()} discretisation requires the '
|
||||||
f'{self.__str__()} discretisation requires the z-direction spatial step to be greater than zero'
|
f'z-direction spatial step to be greater than zero')
|
||||||
)
|
|
||||||
raise ValueError
|
raise ValueError
|
||||||
|
|
||||||
logger.info(f'Spatial discretisation: {G.dl[0]:g} x {G.dl[1]:g} x {G.dl[2]:g}m')
|
logger.info(f'Spatial discretisation: {G.dl[0]:g} x {G.dl[1]:g} x {G.dl[2]:g}m')
|
||||||
@@ -134,9 +131,8 @@ class Domain(UserObjectSingle):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
if G.nx == 0 or G.ny == 0 or G.nz == 0:
|
if G.nx == 0 or G.ny == 0 or G.nz == 0:
|
||||||
logger.exception(
|
logger.exception(f'{self.__str__()} requires at least one cell in '
|
||||||
f'{self.__str__()} requires at least one cell in every dimension'
|
f'every dimension')
|
||||||
)
|
|
||||||
raise ValueError
|
raise ValueError
|
||||||
|
|
||||||
logger.info(f"Domain size: {self.kwargs['p1'][0]:g} x {self.kwargs['p1'][1]:g} x " +
|
logger.info(f"Domain size: {self.kwargs['p1'][0]:g} x {self.kwargs['p1'][1]:g} x " +
|
||||||
@@ -190,9 +186,8 @@ class TimeStepStabilityFactor(UserObjectSingle):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
if f <= 0 or f > 1:
|
if f <= 0 or f > 1:
|
||||||
logger.exception(
|
logger.exception(f'{self.__str__()} requires the value of the time '
|
||||||
f'{self.__str__()} requires the value of the time step stability factor to be between zero and one'
|
f'step stability factor to be between zero and one')
|
||||||
)
|
|
||||||
raise ValueError
|
raise ValueError
|
||||||
G.dt = G.dt * f
|
G.dt = G.dt * f
|
||||||
|
|
||||||
@@ -256,14 +251,12 @@ class OMPThreads(UserObjectSingle):
|
|||||||
try:
|
try:
|
||||||
n = self.kwargs['n']
|
n = self.kwargs['n']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
logger.exception(
|
logger.exception(f'{self.__str__()} requires exactly one parameter '
|
||||||
f'{self.__str__()} requires exactly one parameter to specify the number of CPU OpenMP threads to use'
|
f'to specify the number of CPU OpenMP threads to use')
|
||||||
)
|
|
||||||
raise
|
raise
|
||||||
if n < 1:
|
if n < 1:
|
||||||
logger.exception(
|
logger.exception(f'{self.__str__()} requires the value to be an '
|
||||||
f'{self.__str__()} requires the value to be an integer not less than one'
|
f'integer not less than one')
|
||||||
)
|
|
||||||
raise ValueError
|
raise ValueError
|
||||||
|
|
||||||
config.get_model_config().ompthreads = set_omp_threads(n)
|
config.get_model_config().ompthreads = set_omp_threads(n)
|
||||||
@@ -341,13 +334,9 @@ class SrcSteps(UserObjectSingle):
|
|||||||
logger.exception(f'{self.__str__()} requires exactly three parameters')
|
logger.exception(f'{self.__str__()} requires exactly three parameters')
|
||||||
raise
|
raise
|
||||||
|
|
||||||
logger.info(
|
logger.info(f'Simple sources will step {G.srcsteps[0] * G.dx:g}m, ' +
|
||||||
(
|
f'{G.srcsteps[1] * G.dy:g}m, {G.srcsteps[2] * G.dz:g}m ' +
|
||||||
f'Simple sources will step {G.srcsteps[0] * G.dx:g}m, '
|
'for each model run.')
|
||||||
+ f'{G.srcsteps[1] * G.dy:g}m, {G.srcsteps[2] * G.dz:g}m '
|
|
||||||
+ 'for each model run.'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class RxSteps(UserObjectSingle):
|
class RxSteps(UserObjectSingle):
|
||||||
@@ -368,13 +357,9 @@ class RxSteps(UserObjectSingle):
|
|||||||
logger.exception(f'{self.__str__()} requires exactly three parameters')
|
logger.exception(f'{self.__str__()} requires exactly three parameters')
|
||||||
raise
|
raise
|
||||||
|
|
||||||
logger.info(
|
logger.info(f'All receivers will step {G.rxsteps[0] * G.dx:g}m, ' +
|
||||||
(
|
f'{G.rxsteps[1] * G.dy:g}m, {G.rxsteps[2] * G.dz:g}m ' +
|
||||||
f'All receivers will step {G.rxsteps[0] * G.dx:g}m, '
|
'for each model run.')
|
||||||
+ f'{G.rxsteps[1] * G.dy:g}m, {G.rxsteps[2] * G.dz:g}m '
|
|
||||||
+ 'for each model run.'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class ExcitationFile(UserObjectSingle):
|
class ExcitationFile(UserObjectSingle):
|
||||||
|
@@ -224,15 +224,14 @@ class SimulationConfig:
|
|||||||
# solver: cpu, cuda, opencl.
|
# solver: cpu, cuda, opencl.
|
||||||
# subgrid: whether the simulation uses sub-grids.
|
# subgrid: whether the simulation uses sub-grids.
|
||||||
# precision: data type for electromagnetic field output (single/double).
|
# precision: data type for electromagnetic field output (single/double).
|
||||||
|
# progressbars: progress bars on stdoout or not - switch off
|
||||||
|
# progressbars when logging level is greater than
|
||||||
|
# info (20)
|
||||||
|
|
||||||
self.general = {
|
self.general = {'solver': 'cpu',
|
||||||
'solver': 'cpu',
|
'subgrid': False,
|
||||||
'subgrid': False,
|
'precision': 'single',
|
||||||
'precision': 'single',
|
'progressbars': args.log_level <= 20}
|
||||||
'progressbars': args.log_level <= 20,
|
|
||||||
}
|
|
||||||
# Progress bars on stdoout or not - switch off progressbars when
|
|
||||||
# logging level is greater than info (20)
|
|
||||||
|
|
||||||
self.em_consts = {'c': c, # Speed of light in free space (m/s)
|
self.em_consts = {'c': c, # Speed of light in free space (m/s)
|
||||||
'e0': e0, # Permittivity of free space (F/m)
|
'e0': e0, # Permittivity of free space (F/m)
|
||||||
|
@@ -277,11 +277,10 @@ class Comments():
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# Comments for Paraview macro
|
# Comments for Paraview macro
|
||||||
comments = {'gprMax_version': __version__, 'dx_dy_dz': self.dx_dy_dz_comment()}
|
comments = {'gprMax_version': __version__,
|
||||||
comments['nx_ny_nz'] = self.nx_ny_nz_comment()
|
'dx_dy_dz': self.dx_dy_dz_comment(),
|
||||||
|
'nx_ny_nz': self.nx_ny_nz_comment(),
|
||||||
# Write the name and numeric ID for each material
|
'Materials': self.materials_comment()} # Write the name and numeric ID for each material
|
||||||
comments['Materials'] = self.materials_comment()
|
|
||||||
|
|
||||||
# Write information on PMLs, sources, and receivers
|
# Write information on PMLs, sources, and receivers
|
||||||
if not self.materials_only:
|
if not self.materials_only:
|
||||||
|
@@ -178,9 +178,8 @@ def write_processed_file(processedlines):
|
|||||||
for item in processedlines:
|
for item in processedlines:
|
||||||
f.write(f'{item}')
|
f.write(f'{item}')
|
||||||
|
|
||||||
logger.info(
|
logger.info(f'Written input commands, after processing any Python code and '
|
||||||
f'Written input commands, after processing any Python code and include commands, to file: {processedfile}\n'
|
f'include commands, to file: {processedfile}\n')
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def check_cmd_names(processedlines, checkessential=True):
|
def check_cmd_names(processedlines, checkessential=True):
|
||||||
|
@@ -620,13 +620,11 @@ def process_materials(G):
|
|||||||
z += 3
|
z += 3
|
||||||
|
|
||||||
# Construct information on material properties for printing table
|
# Construct information on material properties for printing table
|
||||||
materialtext = [
|
materialtext = [str(material.numID),
|
||||||
str(material.numID),
|
material.ID[:50] if len(material.ID) > 50 else material.ID,
|
||||||
material.ID[:50] if len(material.ID) > 50 else material.ID,
|
material.type,
|
||||||
material.type,
|
f'{material.er:g}',
|
||||||
f'{material.er:g}',
|
f'{material.se:g}']
|
||||||
f'{material.se:g}',
|
|
||||||
]
|
|
||||||
if config.get_model_config().materials['maxpoles'] > 0:
|
if config.get_model_config().materials['maxpoles'] > 0:
|
||||||
if 'debye' in material.type:
|
if 'debye' in material.type:
|
||||||
materialtext.append('\n'.join('{:g}'.format(deltaer) for deltaer in material.deltaer))
|
materialtext.append('\n'.join('{:g}'.format(deltaer) for deltaer in material.deltaer))
|
||||||
@@ -646,9 +644,7 @@ def process_materials(G):
|
|||||||
else:
|
else:
|
||||||
materialtext.extend(['', '', '', '', ''])
|
materialtext.extend(['', '', '', '', ''])
|
||||||
|
|
||||||
materialtext.extend(
|
materialtext.extend((f'{material.mr:g}', f'{material.sm:g}', material.averagable))
|
||||||
(f'{material.mr:g}', f'{material.sm:g}', material.averagable)
|
|
||||||
)
|
|
||||||
materialsdata.append(materialtext)
|
materialsdata.append(materialtext)
|
||||||
|
|
||||||
return materialsdata
|
return materialsdata
|
@@ -56,13 +56,11 @@ class Waveform:
|
|||||||
if self.freq is None:
|
if self.freq is None:
|
||||||
raise ValueError("Frequency is not specified")
|
raise ValueError("Frequency is not specified")
|
||||||
|
|
||||||
if self.type in [
|
if self.type in ['gaussian',
|
||||||
'gaussian',
|
'gaussiandot',
|
||||||
'gaussiandot',
|
'gaussiandotnorm',
|
||||||
'gaussiandotnorm',
|
'gaussianprime',
|
||||||
'gaussianprime',
|
'gaussiandoubleprime']:
|
||||||
'gaussiandoubleprime',
|
|
||||||
]:
|
|
||||||
self.chi = 1 / self.freq
|
self.chi = 1 / self.freq
|
||||||
self.zeta = 2 * np.pi**2 * self.freq**2
|
self.zeta = 2 * np.pi**2 * self.freq**2
|
||||||
elif self.type in ['gaussiandotdot', 'gaussiandotdotnorm', 'ricker']:
|
elif self.type in ['gaussiandotdot', 'gaussiandotdotnorm', 'ricker']:
|
||||||
|
73
setup.py
73
setup.py
@@ -216,13 +216,11 @@ else:
|
|||||||
pass
|
pass
|
||||||
os.environ['MIN_SUPPORTED_MACOSX_DEPLOYMENT_TARGET'] = MIN_MACOS_VERSION
|
os.environ['MIN_SUPPORTED_MACOSX_DEPLOYMENT_TARGET'] = MIN_MACOS_VERSION
|
||||||
# Sometimes worth testing with '-fstrict-aliasing', '-fno-common'
|
# Sometimes worth testing with '-fstrict-aliasing', '-fno-common'
|
||||||
compile_args = [
|
compile_args = ['-O3',
|
||||||
'-O3',
|
'-w',
|
||||||
'-w',
|
'-fopenmp',
|
||||||
'-fopenmp',
|
'-march=native',
|
||||||
'-march=native',
|
f'-mmacosx-version-min={MIN_MACOS_VERSION}']
|
||||||
f'-mmacosx-version-min={MIN_MACOS_VERSION}',
|
|
||||||
]
|
|
||||||
linker_args = ['-fopenmp', f'-mmacosx-version-min={MIN_MACOS_VERSION}']
|
linker_args = ['-fopenmp', f'-mmacosx-version-min={MIN_MACOS_VERSION}']
|
||||||
libraries=['gomp']
|
libraries=['gomp']
|
||||||
|
|
||||||
@@ -258,42 +256,37 @@ else:
|
|||||||
with open('README.rst','r') as fd:
|
with open('README.rst','r') as fd:
|
||||||
long_description = fd.read()
|
long_description = fd.read()
|
||||||
|
|
||||||
setup(
|
setup(name='gprMax',
|
||||||
name='gprMax',
|
version=version,
|
||||||
version=version,
|
author='Craig Warren, Antonis Giannopoulos, and John Hartley',
|
||||||
author='Craig Warren, Antonis Giannopoulos, and John Hartley',
|
url='http://www.gprmax.com',
|
||||||
url='http://www.gprmax.com',
|
description='Electromagnetic Modelling Software based on the '
|
||||||
description='Electromagnetic Modelling Software based on the '
|
+ 'Finite-Difference Time-Domain (FDTD) method',
|
||||||
+ 'Finite-Difference Time-Domain (FDTD) method',
|
long_description=long_description,
|
||||||
long_description=long_description,
|
long_description_content_type="text/x-rst",
|
||||||
long_description_content_type="text/x-rst",
|
license='GPLv3+',
|
||||||
license='GPLv3+',
|
python_requires=f'>{str(MIN_PYTHON_VERSION[0])}.{str(MIN_PYTHON_VERSION[1])}',
|
||||||
python_requires=f'>{str(MIN_PYTHON_VERSION[0])}.{str(MIN_PYTHON_VERSION[1])}',
|
install_requires=['colorama',
|
||||||
install_requires=[
|
'cython',
|
||||||
'colorama',
|
'h5py',
|
||||||
'cython',
|
'jinja2',
|
||||||
'h5py',
|
'matplotlib',
|
||||||
'jinja2',
|
'numpy',
|
||||||
'matplotlib',
|
'psutil',
|
||||||
'numpy',
|
'scipy',
|
||||||
'psutil',
|
'terminaltables',
|
||||||
'scipy',
|
'tqdm'],
|
||||||
'terminaltables',
|
|
||||||
'tqdm',
|
|
||||||
],
|
|
||||||
ext_modules=extensions,
|
ext_modules=extensions,
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
include_dirs=[np.get_include()],
|
include_dirs=[np.get_include()],
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
classifiers=[
|
classifiers=['Environment :: Console',
|
||||||
'Environment :: Console',
|
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
|
||||||
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
|
'Operating System :: MacOS',
|
||||||
'Operating System :: MacOS',
|
'Operating System :: Microsoft :: Windows',
|
||||||
'Operating System :: Microsoft :: Windows',
|
'Operating System :: POSIX :: Linux',
|
||||||
'Operating System :: POSIX :: Linux',
|
'Programming Language :: Cython',
|
||||||
'Programming Language :: Cython',
|
'Programming Language :: Python :: 3',
|
||||||
'Programming Language :: Python :: 3',
|
'Topic :: Scientific/Engineering'],
|
||||||
'Topic :: Scientific/Engineering',
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
|
在新工单中引用
屏蔽一个用户