Changeset 6144


Ignore:
Timestamp:
Jan 13, 2009, 11:21:22 AM (16 years ago)
Author:
ole
Message:

A bit more testing of volumetric checking in culvert.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/culvert_flows/test_culvert_class.py

    r6142 r6144  
    7272               # Sloping Embankment Across Channel
    7373                if 5.0 < x[i] < 10.1:
    74                     # Cut Out Segment for Culvert FACE               
     74                    # Cut Out Segment for Culvert face               
    7575                    if  1.0+(x[i]-5.0)/5.0 <  y[i]  < 4.0 - (x[i]-5.0)/5.0:
    7676                       z[i]=z[i]
     
    8080                   z[i] +=  2.5                    # Flat Crest of Embankment
    8181                if 12.0 < x[i] < 14.5:
    82                     # Cut Out Segment for Culvert FACE               
     82                    # Cut Out Segment for Culvert face               
    8383                    if  2.0-(x[i]-12.0)/2.5 <  y[i]  < 3.0 + (x[i]-12.0)/2.5:
    8484                       z[i]=z[i]
     
    186186               # Sloping Embankment Across Channel
    187187                if 5.0 < x[i] < 10.1:
    188                     # Cut Out Segment for Culvert FACE               
     188                    # Cut Out Segment for Culvert face               
    189189                    if  1.0+(x[i]-5.0)/5.0 <  y[i]  < 4.0 - (x[i]-5.0)/5.0:
    190190                       z[i]=z[i]
     
    194194                   z[i] +=  2.5                    # Flat Crest of Embankment
    195195                if 12.0 < x[i] < 14.5:
    196                     # Cut Out Segment for Culvert FACE               
     196                    # Cut Out Segment for Culvert face               
    197197                    if  2.0-(x[i]-12.0)/2.5 <  y[i]  < 3.0 + (x[i]-12.0)/2.5:
    198198                       z[i]=z[i]
     
    287287               # Sloping Embankment Across Channel
    288288                if 5.0 < x[i] < 10.1:
    289                     # Cut Out Segment for Culvert FACE               
     289                    # Cut Out Segment for Culvert face               
    290290                    if  1.0+(x[i]-5.0)/5.0 <  y[i]  < 4.0 - (x[i]-5.0)/5.0:
    291291                       z[i]=z[i]
     
    295295                   z[i] +=  2.5                    # Flat Crest of Embankment
    296296                if 12.0 < x[i] < 14.5:
    297                     # Cut Out Segment for Culvert FACE               
     297                    # Cut Out Segment for Culvert face               
    298298                    if  2.0-(x[i]-12.0)/2.5 <  y[i]  < 3.0 + (x[i]-12.0)/2.5:
    299299                       z[i]=z[i]
     
    308308        domain.set_quantity('friction', 0.01)         # Constant friction
    309309        domain.set_quantity('stage',
    310                             expression='elevation + 0.2') # Shallow initial condition
     310                            expression='elevation + 0.1') # Shallow initial condition
    311311                           
    312         # NOTE: Shallow values may cause this test to fail regardless of the
    313         # culvert due to initial adjustments. A good value is 0.2
    314 
    315312
    316313        filename = os.path.join(path, 'example_rating_curve.csv')
     
    335332
    336333
     334       
    337335        #-----------------------------------------------------------------------
    338336        # Evolve system through time
     
    348346            if not allclose(new_volume, ref_volume):
    349347                print msg
    350             assert allclose(new_volume, ref_volume), msg
     348            assert allclose(new_volume, ref_volume), msg       
     349       
     350       
     351       
     352        # Now try this for a range of other depths
     353        for depth in [1.0, 0.5, 0.2, 0.1, 0.05]:
     354            domain.set_time(0.0)
     355           
     356            domain.set_quantity('stage',
     357                                expression='elevation + %f' % depth)
     358           
     359       
     360            ref_volume = domain.get_quantity('stage').get_integral()
     361            for t in domain.evolve(yieldstep = 0.1, finaltime = 25):
     362                #print domain.timestepping_statistics()
     363                new_volume = domain.get_quantity('stage').get_integral()
     364           
     365                #print new_volume, ref_volume, new_volume-ref_volume
     366                msg = 'Total volume has changed: Is %.2f m^3 should have been %.2f m^3'\
     367                    % (new_volume, ref_volume)
     368
     369                assert allclose(new_volume, ref_volume), msg
    351370   
    352371   
     
    394413               # Sloping Embankment Across Channel
    395414                if 5.0 < x[i] < 10.1:
    396                     # Cut Out Segment for Culvert FACE               
     415                    # Cut Out Segment for Culvert face               
    397416                    if  1.0+(x[i]-5.0)/5.0 <  y[i]  < 4.0 - (x[i]-5.0)/5.0:
    398417                       z[i]=z[i]
     
    402421                   z[i] +=  2.5                    # Flat Crest of Embankment
    403422                if 12.0 < x[i] < 14.5:
    404                     # Cut Out Segment for Culvert FACE               
     423                    # Cut Out Segment for Culvert face               
    405424                    if  2.0-(x[i]-12.0)/2.5 <  y[i]  < 3.0 + (x[i]-12.0)/2.5:
    406425                       z[i]=z[i]
Note: See TracChangeset for help on using the changeset viewer.