mirror of
https://github.com/smyalygames/FiniteVolumeGPU_HIP.git
synced 2025-05-18 14:34:12 +02:00
fix: floating point number practically causing an infinite loop
This commit is contained in:
parent
5a27445de8
commit
aa21733806
@ -157,7 +157,7 @@ class BaseSimulator(object):
|
|||||||
self.num_substeps = num_substeps
|
self.num_substeps = num_substeps
|
||||||
|
|
||||||
#Handle autotuning block size
|
#Handle autotuning block size
|
||||||
if (self.context.autotuner):
|
if self.context.autotuner:
|
||||||
peak_configuration = self.context.autotuner.get_peak_performance(self.__class__)
|
peak_configuration = self.context.autotuner.get_peak_performance(self.__class__)
|
||||||
block_width = int(peak_configuration["block_width"])
|
block_width = int(peak_configuration["block_width"])
|
||||||
block_height = int(peak_configuration["block_height"])
|
block_height = int(peak_configuration["block_height"])
|
||||||
@ -202,22 +202,22 @@ class BaseSimulator(object):
|
|||||||
t_end = t_start + t
|
t_end = t_start + t
|
||||||
|
|
||||||
update_dt = True
|
update_dt = True
|
||||||
if (dt is not None):
|
if dt is not None:
|
||||||
update_dt = False
|
update_dt = False
|
||||||
self.dt = dt
|
self.dt = dt
|
||||||
|
|
||||||
with tqdm(total=t_end) as pbar:
|
for _ in tqdm(range(math.ceil(t_end / self.dt))):
|
||||||
while(self.simTime() < t_end):
|
|
||||||
# Update dt every 100 timesteps and cross your fingers it works
|
# Update dt every 100 timesteps and cross your fingers it works
|
||||||
# for the next 100
|
# for the next 100
|
||||||
if (update_dt and (self.simSteps() % 100 == 0)):
|
# TODO this is probably broken now after fixing the "infinite" loop
|
||||||
|
if update_dt and (self.simSteps() % 100 == 0):
|
||||||
self.dt = self.computeDt()*self.cfl_scale
|
self.dt = self.computeDt()*self.cfl_scale
|
||||||
|
|
||||||
# Compute timestep for "this" iteration (i.e., shorten last timestep)
|
# Compute timestep for "this" iteration (i.e., shorten last timestep)
|
||||||
current_dt = np.float32(min(self.dt, t_end-self.simTime()))
|
current_dt = np.float32(min(self.dt, t_end-self.simTime()))
|
||||||
|
|
||||||
# Stop if end reached (should not happen)
|
# Stop if end reached (should not happen)
|
||||||
if (current_dt <= 0.0):
|
if current_dt <= 0.0:
|
||||||
self.logger.warning("Timestep size {:d} is less than or equal to zero!".format(self.simSteps()))
|
self.logger.warning("Timestep size {:d} is less than or equal to zero!".format(self.simSteps()))
|
||||||
break
|
break
|
||||||
|
|
||||||
@ -225,7 +225,6 @@ class BaseSimulator(object):
|
|||||||
self.step(current_dt)
|
self.step(current_dt)
|
||||||
|
|
||||||
#Print info
|
#Print info
|
||||||
pbar.update(current_dt)
|
|
||||||
# print_string = printer.getPrintString(self.simTime() - t_start)
|
# print_string = printer.getPrintString(self.simTime() - t_start)
|
||||||
# if (print_string):
|
# if (print_string):
|
||||||
# self.logger.info("%s: %s", self, print_string)
|
# self.logger.info("%s: %s", self, print_string)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user