Changeset 1931


Ignore:
Timestamp:
Oct 14, 2005, 6:16:39 PM (20 years ago)
Author:
steve
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/analytical solutions/Analytical solution_oblique_shock_01.py

    r1913 r1931  
    7373
    7474def shock_hb(t):
    75     return 2.5
     75    return 1.5
    7676
    7777def shock_hh(t):
    78     return 2.5
     78    return 1.5
    7979
    8080def shock_pb(t):
    81     return 10
     81    return 5
    8282
    8383def shock_pp(t):
    84     return 10
     84    return 5
    8585
    8686
     
    126126domain.set_quantity('xmomentum',shock_p )
    127127
     128class SetValueWhere:
    128129
     130    def __init__(self,quantity,value=0,xrange=0.0):
     131        self.quantity =  quantity
     132        self.value = value
     133        self.xrange = xrange
     134
     135    def __call__(self,x,y):
     136        n = x.shape[0]
     137        w = self.quantity.centroid_values
     138        for i in range(n):
     139            if x[i]<self.xrange:
     140                w[i] = self.value
     141        return w
     142
     143
     144Stage = domain.quantities['stage']
     145Xmom =  domain.quantities['xmomentum']
     146Ymom =  domain.quantities['ymomentum']
    129147
    130148#for id, face in domain.boundary:
     
    135153import time
    136154t0 = time.time()
    137 for t in domain.evolve(yieldstep = 0.5, finaltime = 5.0):
     155for t in domain.evolve(yieldstep = 0.1, finaltime = 6.0):
    138156    domain.write_time()
    139157    id = 3399
    140     print domain.quantities['stage'].get_values(location='centroids',indices=[id])
    141     print domain.quantities['xmomentum'].get_values(location='centroids',indices=[id])
    142     print domain.quantities['ymomentum'].get_values(location='centroids',indices=[id])
     158    print Stage.get_values(location='centroids',indices=[id])
     159    print Xmom.get_values(location='centroids',indices=[id])
     160    print Ymom.get_values(location='centroids',indices=[id])
     161    vstage =  Stage.get_values(location='centroids',indices=[id])
     162    vxmom  =  Xmom.get_values(location='centroids',indices=[id])
    143163    id = 12719
    144     print domain.quantities['stage'].get_values(location='centroids',indices=[id])
    145     print domain.quantities['xmomentum'].get_values(location='centroids',indices=[id])
    146     print domain.quantities['ymomentum'].get_values(location='centroids',indices=[id])
     164    print Stage.get_values(location='centroids',indices=[id])
     165    print Xmom.get_values(location='centroids',indices=[id])
     166    print Ymom.get_values(location='centroids',indices=[id])
     167    tclean = 2.0
     168#    if t > tclean-0.09 and t < tclean+0.01:
     169#        print 'Cleaning up Initial profile'
     170#        setstage = SetValueWhere(quantity=Stage,value=vstage[0],xrange=10)
     171#        setxmom  = SetValueWhere(quantity=Xmom,value=vxmom[0],xrange=10)
     172#        Stage.set_values(setstage,location='centroids')
     173#        Xmom.set_values(setxmom,location='centroids')
     174#        Dnew = Dirichlet_boundary([vstage[0] , vxmom[0], 0.0])
     175#        domain.set_boundary({'left': Dnew, 'right': T, 'top': R, 'bottom': R})
    147176
    148177print 'That took %.2f seconds' %(time.time()-t0)
     
    155184#im = ImageGrab.grab()
    156185#im.save("ccube.eps")
     186
Note: See TracChangeset for help on using the changeset viewer.