← Back to team overview

cbc team mailing list archive

[noreply@xxxxxxxxxxxxx: [Branch ~cbc-core/cbc.solve/main] Rev 99: Fixed auto time-step size corrector when T is a multiple of dt]

 

What if T = 10 and dt = 0.9999999999. Then we get

  ceil(T / dt) = 11.

--
Anders
--- Begin Message ---
------------------------------------------------------------
revno: 99
committer: Harish Narayanan <hnarayanan@xxxxxxxxx>
branch nick: cbc.solve
timestamp: Tue 2010-04-13 13:23:24 +0200
message:
  Fixed auto time-step size corrector when T is a multiple of dt
modified:
  cbc/common/CBCSolver.py
  cbc/common/utils.py


--
lp:cbc.solve
https://code.launchpad.net/~cbc-core/cbc.solve/main

Your team CBC Core Team is subscribed to branch lp:cbc.solve.
To unsubscribe from this branch go to https://code.launchpad.net/~cbc-core/cbc.solve/main/+edit-subscription
=== modified file 'cbc/common/CBCSolver.py'
--- cbc/common/CBCSolver.py	2010-04-13 09:09:35 +0000
+++ cbc/common/CBCSolver.py	2010-04-13 11:23:24 +0000
@@ -36,7 +36,7 @@
         self._cpu_time = cpu_time
 
         # Write some useful information
-        s = "Time step %d finished in %g seconds." % (self._time_step, elapsed_time)
+        s = "Time step %d (t = %g) finished in %g seconds." % (self._time_step, t, elapsed_time)
         info("\n" + s + "\n" + len(s)*"-" + "\n")
 
         # Update progress bar

=== modified file 'cbc/common/utils.py'
--- cbc/common/utils.py	2010-04-13 08:10:09 +0000
+++ cbc/common/utils.py	2010-04-13 11:23:24 +0000
@@ -4,6 +4,7 @@
 __copyright__ = "Copyright (C) 2009 Simula Research Laboratory and %s" % __author__
 __license__  = "GNU GPL Version 3 or any later version"
 
+from math import ceil
 from numpy import linspace
 from dolfin import PeriodicBC, warning
 
@@ -28,7 +29,7 @@
         ds = 0.25*mesh.hmin()
 
     # Compute range
-    n = int(T / ds + 1.0)
+    n = ceil(T / ds)
     t_range = linspace(0, T, n + 1)[1:]
     dt = t_range[0]
 


--- End Message ---

Attachment: signature.asc
Description: Digital signature


Follow ups