Hi Junting,
With dual integrator, in certain circumstances the physical time counter
can accumulate round-off error and if the error exceeds 5e-12 at an
output time, the writer plugin does not realise it needs to write. As
you said, the simulation should run ok and this bug only affects the
writer plugin with dual integrator.
For now please use the attached patch which forces the output at the
next physical time-step. I will submit a fix to this asap.
Thanks,
Niki
On 03/07/19 15:50, Junting Chen wrote:
Hello all,
I am experiencing failures from the writer function occasionally. For
instance, once I have -
[soln-plugin-writer]
dt-out = 50
basedir = .
basename = concaveTower_{t:04.0f}
- in the ini file, and this simulation started from t=1800. It
supposed to write out a file at t=1850 but nothing was written.
Another time I had dt-out = 20, the simulation only wrote out properly
until t=60. After that simulation carried on but no pyfrs file wrote out.
In both cases I am sure the simulation runs ok because the velocity
and pressure probes wrote out properly.
Is anyone experiencing the same issue?
Junting Chen
--
You received this message because you are subscribed to the Google
Groups "PyFR Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/pyfrmailinglist.
To view this discussion on the web, visit
https://groups.google.com/d/msgid/pyfrmailinglist/41b781ac-9aca-4ca0-b7f0-892a65cfb72d%40googlegroups.com
<https://groups.google.com/d/msgid/pyfrmailinglist/41b781ac-9aca-4ca0-b7f0-892a65cfb72d%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "PyFR
Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send an email to [email protected].
Visit this group at https://groups.google.com/group/pyfrmailinglist.
To view this discussion on the web, visit
https://groups.google.com/d/msgid/pyfrmailinglist/4d633e9f-1226-5313-b75b-ed574a0f7bc1%40imperial.ac.uk.
For more options, visit https://groups.google.com/d/optout.
>From 2c8284e76a6262cd4d472359b7922ced6118a558 Mon Sep 17 00:00:00 2001
From: Niki <[email protected]>
Date: Wed, 3 Jul 2019 17:43:34 +0100
Subject: [PATCH 1/1] Writer patch
---
pyfr/plugins/tavg.py | 13 +++++++------
pyfr/plugins/writer.py | 8 ++++----
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/pyfr/plugins/tavg.py b/pyfr/plugins/tavg.py
index e2ffaab..2ff6676 100644
--- a/pyfr/plugins/tavg.py
+++ b/pyfr/plugins/tavg.py
@@ -42,7 +42,7 @@ class TavgPlugin(BasePlugin):
# Time averaging parameters
self.dtout = self.cfg.getfloat(cfgsect, 'dt-out')
self.nsteps = self.cfg.getint(cfgsect, 'nsteps')
- self.tout = intg.tcurr + self.dtout
+ self.tout = intg.tcurr
# Register our output times with the integrator
intg.call_plugin_dt(self.dtout)
@@ -117,7 +117,8 @@ class TavgPlugin(BasePlugin):
return [np.dstack(exs).swapaxes(1, 2) for exs in exprs]
def __call__(self, intg):
- dowrite = abs(self.tout - intg.tcurr) < self.tol
+ dtout = intg.tcurr - self.tout
+ dowrite = dtout >= self.dtout
doaccum = intg.nacptsteps % self.nsteps == 0
if dowrite or doaccum:
@@ -127,20 +128,19 @@ class TavgPlugin(BasePlugin):
# Accumulate them; always do this even when just writing
for a, p, c in zip(self.accmex, self.prevex, currex):
a += 0.5*(intg.tcurr - self.prevt)*(p + c)
-
# Save the time and solution
self.prevt = intg.tcurr
self.prevex = currex
if dowrite:
# Normalise
- accmex = [a / self.dtout for a in self.accmex]
+ accmex = [a / dtout for a in self.accmex]
stats = Inifile()
stats.set('data', 'prefix', 'tavg')
stats.set('data', 'fields',
','.join(k for k, v in self.exprs))
- stats.set('tavg', 'tstart', intg.tcurr - self.dtout)
+ stats.set('tavg', 'tstart', self.tout)
stats.set('tavg', 'tend', intg.tcurr)
intg.collect_stats(stats)
@@ -150,5 +150,6 @@ class TavgPlugin(BasePlugin):
self._writer.write(accmex, metadata, intg.tcurr)
- self.tout = intg.tcurr + self.dtout
self.accmex = [np.zeros_like(a) for a in accmex]
+
+ self.tout = intg.tcurr
diff --git a/pyfr/plugins/writer.py b/pyfr/plugins/writer.py
index b6e16a9..3ca0c23 100644
--- a/pyfr/plugins/writer.py
+++ b/pyfr/plugins/writer.py
@@ -21,7 +21,7 @@ class WriterPlugin(BasePlugin):
# Output time step and next output time
self.dt_out = self.cfg.getfloat(cfgsect, 'dt-out')
- self.tout_next = intg.tcurr
+ self.tout = intg.tcurr
# Output field names
self.fields = intg.system.elementscls.convarmap[self.ndims]
@@ -33,10 +33,10 @@ class WriterPlugin(BasePlugin):
if not intg.isrestart:
self(intg)
else:
- self.tout_next += self.dt_out
+ pass
def __call__(self, intg):
- if abs(self.tout_next - intg.tcurr) > self.tol:
+ if intg.tcurr - self.tout < self.dt_out:
return
stats = Inifile()
@@ -57,4 +57,4 @@ class WriterPlugin(BasePlugin):
t=intg.tcurr)
# Compute the next output time
- self.tout_next = intg.tcurr + self.dt_out
+ self.tout = intg.tcurr
--
1.8.3.1