你已经派生过 gprMax
镜像自地址
https://gitee.com/sunhf/gprMax.git
已同步 2025-08-07 04:56:51 +08:00
Formatting cleanups.
这个提交包含在:
@@ -7,10 +7,10 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
# Code profiling
|
# Code profiling
|
||||||
# Time profiling
|
# Time profiling
|
||||||
#import cProfile, pstats
|
# import cProfile, pstats
|
||||||
#cProfile.run('gprMax.gprMax.main()','stats')
|
# cProfile.run('gprMax.gprMax.main()','stats')
|
||||||
#p = pstats.Stats('stats')
|
# p = pstats.Stats('stats')
|
||||||
#p.sort_stats('time').print_stats(25)
|
# p.sort_stats('time').print_stats(25)
|
||||||
|
|
||||||
# Memory profiling - use in gprMax.py
|
# Memory profiling - use in gprMax.py
|
||||||
# from memory profiler import profile
|
# from memory profiler import profile
|
||||||
|
@@ -65,13 +65,10 @@ class FractalSurface(object):
|
|||||||
|
|
||||||
if self.xs == self.xf:
|
if self.xs == self.xf:
|
||||||
surfacedims = (self.ny + 1, self.nz + 1)
|
surfacedims = (self.ny + 1, self.nz + 1)
|
||||||
d = G.dx
|
|
||||||
elif self.ys == self.yf:
|
elif self.ys == self.yf:
|
||||||
surfacedims = (self.nx + 1, self.nz + 1)
|
surfacedims = (self.nx + 1, self.nz + 1)
|
||||||
d = G.dy
|
|
||||||
elif self.zs == self.zf:
|
elif self.zs == self.zf:
|
||||||
surfacedims = (self.nx + 1, self.ny + 1)
|
surfacedims = (self.nx + 1, self.ny + 1)
|
||||||
d = G.dz
|
|
||||||
|
|
||||||
self.fractalsurface = np.zeros(surfacedims, dtype=complextype)
|
self.fractalsurface = np.zeros(surfacedims, dtype=complextype)
|
||||||
|
|
||||||
|
@@ -199,7 +199,7 @@ def dispersion_check(G):
|
|||||||
# Minimum wavelength
|
# Minimum wavelength
|
||||||
minwavelength = minvelocity / maxfreq
|
minwavelength = minvelocity / maxfreq
|
||||||
|
|
||||||
# Resolution of minimum wavelength
|
# Resolution of minimum wavelength
|
||||||
resolution = minwavelength / resolvedsteps
|
resolution = minwavelength / resolvedsteps
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@@ -177,9 +177,9 @@ class PeplinskiSoil(object):
|
|||||||
f = 1.3e9
|
f = 1.3e9
|
||||||
w = 2 * np.pi * f
|
w = 2 * np.pi * f
|
||||||
erealw = Material.watereri + ((Material.waterdeltaer) / (1 + (w * Material.watertau)**2))
|
erealw = Material.watereri + ((Material.waterdeltaer) / (1 + (w * Material.watertau)**2))
|
||||||
eimagw = w * Material.watertau * ((Material.waterdeltaer) / (1 + (w * Material.watertau)**2))
|
# eimagw = w * Material.watertau * ((Material.waterdeltaer) / (1 + (w * Material.watertau)**2))
|
||||||
|
|
||||||
a = 0.65 # Experimentally derived constant
|
a = 0.65 # Experimentally derived constant
|
||||||
es = (1.01 + 0.44 * self.rs)**2 - 0.062
|
es = (1.01 + 0.44 * self.rs)**2 - 0.062
|
||||||
b1 = 1.2748 - 0.519 * self.S - 0.152 * self.C
|
b1 = 1.2748 - 0.519 * self.S - 0.152 * self.C
|
||||||
b2 = 1.33797 - 0.603 * self.S - 0.166 * self.C
|
b2 = 1.33797 - 0.603 * self.S - 0.166 * self.C
|
||||||
@@ -187,7 +187,7 @@ class PeplinskiSoil(object):
|
|||||||
# For frequencies in the range 0.3GHz to 1.3GHz
|
# For frequencies in the range 0.3GHz to 1.3GHz
|
||||||
sigf1 = 0.0467 + 0.2204 * self.rb - 0.411 * self.S + 0.6614 * self.C
|
sigf1 = 0.0467 + 0.2204 * self.rb - 0.411 * self.S + 0.6614 * self.C
|
||||||
# For frequencies in the range 1.4GHz to 18GHz
|
# For frequencies in the range 1.4GHz to 18GHz
|
||||||
sigf2 = -1.645 + 1.939 * self.rb - 2.25622 * self.S + 1.594 * self.C
|
# sigf2 = -1.645 + 1.939 * self.rb - 2.25622 * self.S + 1.594 * self.C
|
||||||
|
|
||||||
# Generate a set of bins based on the given volumetric water fraction values
|
# Generate a set of bins based on the given volumetric water fraction values
|
||||||
mubins = np.linspace(self.mu[0], self.mu[1], nbins + 1)
|
mubins = np.linspace(self.mu[0], self.mu[1], nbins + 1)
|
||||||
|
@@ -99,9 +99,9 @@ def run_opt_sim(args, numbermodelruns, inputfile, usernamespace):
|
|||||||
optparams, levels, levelsdiff = calculate_ranges_experiments(optparams, optparamsinit, levels, levelsopt, levelsdiff, OA, N, k, s, iteration)
|
optparams, levels, levelsdiff = calculate_ranges_experiments(optparams, optparamsinit, levels, levelsopt, levelsdiff, OA, N, k, s, iteration)
|
||||||
|
|
||||||
# Run model for each experiment
|
# Run model for each experiment
|
||||||
if args.mpi: # Mixed mode MPI/OpenMP - MPI task farm for models with each model parallelised with OpenMP
|
if args.mpi: # Mixed mode MPI/OpenMP - MPI task farm for models with each model parallelised with OpenMP
|
||||||
run_mpi_sim(args, numbermodelruns, inputfile, usernamespace, optparams)
|
run_mpi_sim(args, numbermodelruns, inputfile, usernamespace, optparams)
|
||||||
else: # Standard behaviour - models run serially with each model parallelised with OpenMP
|
else: # Standard behaviour - models run serially with each model parallelised with OpenMP
|
||||||
run_std_sim(args, numbermodelruns, inputfile, usernamespace, optparams)
|
run_std_sim(args, numbermodelruns, inputfile, usernamespace, optparams)
|
||||||
|
|
||||||
# Calculate fitness value for each experiment
|
# Calculate fitness value for each experiment
|
||||||
@@ -312,7 +312,7 @@ def calculate_ranges_experiments(optparams, optparamsinit, levels, levelsopt, le
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# Gaussian reduction function used for calculating levels
|
# Gaussian reduction function used for calculating levels
|
||||||
T = 18 # Usually values between 15 - 20
|
T = 18 # Usually values between 15 - 20
|
||||||
RR = np.exp(-(i / T)**2)
|
RR = np.exp(-(i / T)**2)
|
||||||
|
|
||||||
# Calculate levels for each parameter
|
# Calculate levels for each parameter
|
||||||
|
@@ -242,8 +242,8 @@ def build_pmls(G):
|
|||||||
|
|
||||||
for index, pmlthickness in enumerate(G.pmlthickness):
|
for index, pmlthickness in enumerate(G.pmlthickness):
|
||||||
if pmlthickness > 0:
|
if pmlthickness > 0:
|
||||||
sumer = 0 # Sum of relative permittivities in PML slab
|
sumer = 0 # Sum of relative permittivities in PML slab
|
||||||
summr = 0 # Sum of relative permeabilities in PML slab
|
summr = 0 # Sum of relative permeabilities in PML slab
|
||||||
pmldirection = PML.directions[index]
|
pmldirection = PML.directions[index]
|
||||||
|
|
||||||
if pmldirection[0] == 'x':
|
if pmldirection[0] == 'x':
|
||||||
|
@@ -279,7 +279,7 @@ def write_output_file(filename, grid, res):
|
|||||||
|
|
||||||
|
|
||||||
def write_xml_doc(options):
|
def write_xml_doc(options):
|
||||||
#write xml to file
|
# write xml to file
|
||||||
with open(options['filename'] + '.xdmf', 'wb') as xdmf_f:
|
with open(options['filename'] + '.xdmf', 'wb') as xdmf_f:
|
||||||
xdmf_f.write(options['xml_doc'])
|
xdmf_f.write(options['xml_doc'])
|
||||||
|
|
||||||
|
在新工单中引用
屏蔽一个用户