Changeset 7398


Ignore:
Timestamp:
Aug 21, 2009, 1:27:33 PM (15 years ago)
Author:
ole
Message:

Updated steady state flow test, verifying that predicted flow
can be created through boundary conditions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/shallow_water/test_shallow_water_domain.py

    r7347 r7398  
    62626262        """test_volumetric_balance_computation
    62636263       
    6264         Test that total in and out flows are computed correctly
    6265         FIXME(Ole): This test is more about looking at the printed report
     6264        Test that total in and out flows are computed correctly 
     6265        in a steady state situation
    62666266        """
    62676267
     6268        # Set to True if volumetric output is sought
    62686269        verbose = False
    62696270
     
    62856286        #----------------------------------------------------------------------
    62866287
    6287         finaltime = 300.0
     6288        finaltime = 500.0
    62886289        length = 300.
    62896290        width  = 20.
     
    63106311        #----------------------------------------------------------------------
    63116312
    6312         slope = 0.0
    6313         def topography(x, y):
    6314             z=-x * slope
    6315             return z
    6316 
    6317         # Use function for elevation
    6318         domain.set_quantity('elevation', topography)
    6319         domain.set_quantity('friction', 0.0)        # Constant friction
     6313        domain.set_quantity('elevation', 0.0)  # Flat bed
     6314        domain.set_quantity('friction', 0.0)   # Constant zero friction
    63206315               
    6321         domain.set_quantity('stage', expression='elevation')
     6316        domain.set_quantity('stage', expression='elevation + %d' % d)
    63226317
    63236318        #----------------------------------------------------------------------
     
    63276322        Br = Reflective_boundary(domain)      # Solid reflective wall
    63286323               
    6329         # Constant flow into domain
     6324        # Constant flow in and out of domain
    63306325        # Depth = 1m, uh=1 m/s, i.e. a flow of 20 m^3/s
    6331        
    63326326        Bi = Dirichlet_boundary([d, uh, vh])
    6333         Bo = Dirichlet_boundary([0, 0, 0])
     6327        Bo = Dirichlet_boundary([d, uh, vh])
    63346328
    63356329        domain.set_boundary({'left': Bi, 'right': Bo, 'top': Br, 'bottom': Br})
     
    63396333        #----------------------------------------------------------------------
    63406334
    6341         for t in domain.evolve(yieldstep=100.0, finaltime=finaltime):
     6335        for t in domain.evolve(yieldstep=50.0, finaltime=finaltime):
    63426336            S = domain.volumetric_balance_statistics()
    63436337            if verbose :
    63446338                print domain.timestepping_statistics()
    63456339                print S
     6340               
     6341            if t > 300:
     6342                # Steady state reached
     6343               
     6344                # Square on flowline at 200m
     6345                q = domain.get_flow_through_cross_section([[200.0,  0.0],
     6346                                                           [200.0, 20.0]])
     6347               
     6348                assert num.allclose(q, ref_flow)
    63466349
    63476350
     
    72237226
    72247227if __name__ == "__main__":
    7225     #suite = unittest.makeSuite(Test_Shallow_Water, 'test_variable_elevation')
    7226     suite = unittest.makeSuite(Test_Shallow_Water, 'test')
     7228    suite = unittest.makeSuite(Test_Shallow_Water, 'test_volumetric_balance')
     7229    #suite = unittest.makeSuite(Test_Shallow_Water, 'test')
    72277230    runner = unittest.TextTestRunner(verbosity=1)
    72287231    runner.run(suite)
Note: See TracChangeset for help on using the changeset viewer.