← Back to team overview

cbc team mailing list archive

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

 

On 4/13/10 3:08 PM, Anders Logg wrote:
> On Tue, Apr 13, 2010 at 03:02:08PM +0200, Harish Narayanan wrote:
>> On 4/13/10 2:47 PM, Anders Logg wrote:
>>> On Tue, Apr 13, 2010 at 02:42:34PM +0200, Harish Narayanan wrote:
>>>> On 4/13/10 1:32 PM, Anders Logg wrote:
>>>>> What if T = 10 and dt = 0.9999999999. Then we get
>>>>>
>>>>>   ceil(T / dt) = 11.
>>>>
>>>> I am not sure I understand what is wrong with this.
>>>>
>>>> If dt = 1.0, then we get 10 time steps. If dt < 1.0, we get more time steps.
>>>>
>>>> Harish
>>>
>>> Isn't there a chance that one might specify the time step to be k and
>>> the end time to be n*k and get T / k = n + eps?
>>
>> This, in my mind, is a common case. But the same problem would have
>> existed in the earlier code as well. All I was doing was to replace the
>> earlier code which always added one time step. Now:
>>
>> If T / k is an integer, dt = k.
>> If T / k is not, then dt = T /(int(T / k) + 1)
>>
>> The earlier code was always using the second definition.
> 
> I'm not saying the old code was correct, but there should be some
> clever solution that does the right thing. How about this:
> 
> n = ceil(T / dt - DOLFIN_EPS)

Will think about it. I am guessing it will need an intelligent +/-
DOLFIN_EPS.

Harish



Follow ups

References