[pyfr] 07/32: Improve how plugins handle time-dependent invocations.
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Thu Apr 21 08:21:50 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch master
in repository pyfr.
commit d766d4d9e2cd0da83919b49fdd99b15ea7e533ad
Author: Freddie Witherden <freddie at witherden.org>
Date: Mon Feb 1 20:36:23 2016 +0000
Improve how plugins handle time-dependent invocations.
The minimum time step is also increased to a more reasonable
1e-12 from 1e-14.
---
pyfr/integrators/controllers.py | 2 +-
pyfr/plugins/base.py | 3 +++
pyfr/plugins/tavg.py | 2 +-
pyfr/plugins/writer.py | 2 +-
4 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/pyfr/integrators/controllers.py b/pyfr/integrators/controllers.py
index 447290d..286e3f1 100644
--- a/pyfr/integrators/controllers.py
+++ b/pyfr/integrators/controllers.py
@@ -15,7 +15,7 @@ class BaseController(BaseIntegrator):
# Current and minimum time steps
self._dt = self.cfg.getfloat('solver-time-integrator', 'dt')
- self.dtmin = 1.0e-14
+ self.dtmin = 1.0e-12
# Solution filtering frequency
self._fnsteps = self.cfg.getint('soln-filter', 'nsteps', '0')
diff --git a/pyfr/plugins/base.py b/pyfr/plugins/base.py
index 36ee692..c96d987 100644
--- a/pyfr/plugins/base.py
+++ b/pyfr/plugins/base.py
@@ -37,6 +37,9 @@ class BasePlugin(object, metaclass=ABCMeta):
self.ndims = intg.system.ndims
self.nvars = intg.system.nvars
+ # Tolerance for time comparisons
+ self.tol = 5*intg.dtmin
+
# Check that we support this particular system
if not ('*' in self.systems or intg.system.name in self.systems):
raise RuntimeError('System {0} not supported by plugin {1}'
diff --git a/pyfr/plugins/tavg.py b/pyfr/plugins/tavg.py
index 7e2fb38..09eaffb 100644
--- a/pyfr/plugins/tavg.py
+++ b/pyfr/plugins/tavg.py
@@ -67,7 +67,7 @@ class TavgPlugin(BasePlugin):
return [np.dstack(exs).swapaxes(1, 2) for exs in exprs]
def __call__(self, intg):
- dowrite = abs(self.tout - intg.tcurr) < intg.dtmin
+ dowrite = abs(self.tout - intg.tcurr) < self.tol
doaccum = intg.nacptsteps % self.nsteps == 0
if dowrite or doaccum:
diff --git a/pyfr/plugins/writer.py b/pyfr/plugins/writer.py
index c96043c..d09d508 100644
--- a/pyfr/plugins/writer.py
+++ b/pyfr/plugins/writer.py
@@ -35,7 +35,7 @@ class WriterPlugin(BasePlugin):
self.tout_next += self.dt_out
def __call__(self, intg):
- if abs(self.tout_next - intg.tcurr) > intg.dtmin:
+ if abs(self.tout_next - intg.tcurr) > self.tol:
return
stats = Inifile()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pyfr.git
More information about the debian-science-commits
mailing list