Ignore:
Timestamp:
Nov 11, 2010, 11:55:52 AM (13 years ago)
Author:
habili
Message:

Fixed bug where starttime and duration in the evolve function did not produce correct results. Starttime is now set in the constructor of Domain and is 0 by default. time is is to starttime. Also a bug was fixed where duration did not correctly calculate the finaltime. Associated unit tests have also been fixed to reflect the change.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/shallow_water/test_forcing_terms.py

    r7814 r8068  
    887887        domain.forcing_terms.append(R)
    888888
    889         # This will test that time used in the forcing function takes
    890         # startime into account.
    891         domain.starttime = 5.0
    892 
    893         domain.time = 7.
     889        # This will test that time is set to starttime in set_starttime
     890        domain.set_starttime(5.0)
    894891
    895892        domain.compute_forcing_terms()
     
    898895                            (3*domain.get_time() + 7)/1000)
    899896        assert num.allclose(domain.quantities['stage'].explicit_update[1],
    900                             (3*(domain.time + domain.starttime) + 7)/1000)
    901 
    902         # Using internal time her should fail
    903         assert not num.allclose(domain.quantities['stage'].explicit_update[1],
    904                                 (3*domain.time + 7)/1000)
     897                            (3*domain.get_starttime() + 7)/1000)
    905898
    906899        assert num.allclose(domain.quantities['stage'].explicit_update[0], 0)
     
    953946        domain.forcing_terms.append(R)
    954947
    955         # This will test that time used in the forcing function takes
    956         # startime into account.
    957         domain.starttime = 5.0
    958 
    959         domain.time = 7.
     948        # This will test that time is set to starttime in set_starttime
     949        domain.set_starttime(5.0)
    960950
    961951        domain.compute_forcing_terms()
     
    964954                            (3*domain.get_time() + 7)/1000)
    965955        assert num.allclose(domain.quantities['stage'].explicit_update[1],
    966                             (3*(domain.time + domain.starttime) + 7)/1000)
    967 
    968         # Using internal time her should fail
    969         assert not num.allclose(domain.quantities['stage'].explicit_update[1],
    970                                 (3*domain.time + 7)/1000)
     956                            (3*domain.get_starttime() + 7)/1000)
     957
    971958
    972959        assert num.allclose(domain.quantities['stage'].explicit_update[0], 0)
Note: See TracChangeset for help on using the changeset viewer.