Changeset 1688


Ignore:
Timestamp:
Aug 7, 2005, 10:24:22 PM (19 years ago)
Author:
steve
Message:

Picked typo in validation example 2. Intermittent problems with vpython. Seems to work better with new version of vpython.

Location:
inundation/ga/storm_surge
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pyvolution/netherlands.py

    r1636 r1688  
    8383N = 130 #size = 33800
    8484N = 600 #Size = 720000
    85 N = 60
     85N = 100
    8686
    8787
     
    121121else:
    122122    domain.initialise_visualiser(rect=[0.0,0.0,1.0,1.0])
    123     domain.visualiser.coloring['stage'] = True
     123    #domain.initialise_visualiser()
     124    #domain.visualiser.coloring['stage'] = False
    124125    domain.visualise_timer = True
    125126    domain.checkpoint = False
     
    161162
    162163
     164#from realtime_visualisation_new import Visualiser
     165#V = Visualiser(domain,title='netherlands')
     166#V.update_quantity('stage')
     167#V.update_quantity('elevation')
    163168
    164 for t in domain.evolve(yieldstep = 0.1, finaltime = 15.0):
     169for t in domain.evolve(yieldstep = 0.02, finaltime = 15.0):
    165170    domain.write_time()
     171    #V.update_quantity('stage')
    166172    #rpdb.set_active()
    167173    #domain.visualiser.scale_z = 1.0
  • inundation/ga/storm_surge/pyvolution/realtime_visualisation_new.py

    r1639 r1688  
    6868        self.coloring = {}
    6969        self.updating = {}
     70        self.setup = {}
    7071
    7172        self.qcolor['stage']  = self.stage_color
     
    7374        self.coloring['stage'] = False
    7475        self.updating['stage'] = True
     76        self.setup['stage'] = True
    7577
    7678        self.qcolor['elevation']  = self.elevation_color
     
    7880        self.coloring['elevation'] = False
    7981        self.updating['elevation'] = False
     82        self.setup['elevation'] = False
    8083
    8184        #print self.max_x, self.min_x, self.max_y, self.min_y,
     
    146149        self.scene.select()
    147150
    148         self.update_quantity('elevation')
    149         self.update_quantity('stage')
     151        for key in ['elevation','stage']:
     152            if self.setup[key] | self.updating[key]:
     153                self.update_quantity(key)
     154
     155
    150156
    151157    def update_all(self):
     
    153159        self.scene.select()
    154160
    155         if self.updating['elevation']:
    156             self.update_quantity('elevation')
    157 
    158         if self.updating['stage']:
    159             self.update_quantity('stage')
    160 
    161 
     161        for key in ['elevation','stage']:
     162            if self.updating[key]:
     163                self.update_quantity(key)
    162164
    163165
     
    203205
    204206        #print 'update bed image'
    205         self.vpython_z_models[qname].pos    = self.pos
     207        if qname=='elevation':
     208            self.vpython_z_models[qname].pos    = self.pos+1.0e-3
     209        else:
     210            self.vpython_z_models[qname].pos    = self.pos
     211
    206212        self.vpython_z_models[qname].color  = self.colour
    207213        self.vpython_z_models[qname].normal = self.normals
     
    608614    from advection import Domain as A_Domain
    609615    from shallow_water import Domain as SW_Domain
     616    from shallow_water import Constant_height, Constant_stage
    610617    from mesh_factory import rectangular
    611618
    612     points, vertices, boundary = rectangular(20, 20, len1=200, len2=200)
     619    points, vertices, boundary = rectangular(60, 60, len1=200, len2=200)
    613620    a_domain  = A_Domain(points, vertices, boundary)
    614     sw_domain = SW_Domain(points, vertices, boundary)
     621    print 'No of Elements' , a_domain.number_of_elements
     622    #sw_domain = SW_Domain(points, vertices, boundary)
     623    #sw_domain.set_quantity('elevation', Constant_stage(0.0))
     624    #sw_domain.set_quantity('stage', Constant_stage(0.0))
    615625
    616626    a_domain.initialise_visualiser()
    617     a_domain.visualiser.update_all()
    618 
    619 
    620     sw_domain.initialise_visualiser()
    621     sw_domain.visualiser.update_all()
     627    a_domain.visualiser.setup_all()
     628
     629
     630    #sw_domain.initialise_visualiser()
     631    #sw_domain.visualiser.setup['elevation']=True
     632    #sw_domain.visualiser.setup_all()
     633
     634    time = 0.0
     635    while (True):
     636        time = time+0.001
     637        #print 'Time = ',time
     638        #sw_domain.set_quantity('stage', time)
     639        a_domain.set_quantity('stage',time)
     640
     641        #sw_domain.visualiser.update_quantity('stage')
     642        a_domain.visualiser.update_quantity('stage')
     643
     644        if time>1.0 :
     645            break
    622646
    623647    #a_v = Visualiser(domain=a_domain, title='advection')
  • inundation/ga/storm_surge/pyvolution/shallow_water.py

    r1671 r1688  
    113113            from realtime_visualisation_new import Visualiser
    114114            self.visualiser = Visualiser(self,scale_z,rect)
     115            self.visualiser.updating['elevation']=True
    115116        self.visualise = True
    116117
     
    203204        #Initialise real time viz if requested
    204205        if self.visualise is True and self.time == 0.0:
    205             #import realtime_visualisation_new as visualise
     206            #pass
     207            import realtime_visualisation_new as visualise
    206208            #visualise.create_surface(self)
    207209            self.initialise_visualiser()
     
    214216            #print 'Storing results in ' + self.writer.filename
    215217        else:
     218            pass
    216219            #print 'Results will not be stored.'
    217220            #print 'To store results set domain.store = True'
    218             pass
    219221            #FIXME: Diagnostic output should be controlled by
    220222            # a 'verbose' flag living in domain (or in a parent class)
     
    224226            #Real time viz
    225227            if self.visualise is True:
    226                 #visualise.update(self)
    227                 if self.visualise is True:
    228                     self.visualiser.update_all()
    229                     self.visualiser.update_timer()
     228                #pass
     229                self.visualiser.update_all()
     230                self.visualiser.update_timer()
    230231
    231232            #Store model data, e.g. for subsequent visualisation
     
    233234                self.store_timestep(self.quantities_to_be_stored)
    234235
    235                 #FIXME: Could maybe be taken from specified list
    236                 #of 'store every step' quantities
     236            #FIXME: Could maybe be taken from specified list
     237            #of 'store every step' quantities
    237238
    238239            #Pass control on to outer loop for more specific actions
     
    603604        #perform the extrapolation and limiting on
    604605        #all of the conserved quantitie
    605        
     606
    606607        if (domain.order == 1):
    607608            for name in domain.conserved_quantities:
     
    612613        else:
    613614            raise 'Unknown order'
    614     else:   
     615    else:
    615616        #old code:
    616617        for name in domain.conserved_quantities:
     
    623624            else:
    624625                raise 'Unknown order'
    625            
     626
    626627
    627628    #Take bed elevation into account when water heights are small
  • inundation/ga/storm_surge/validation/LWRU2/lwru2.py

    r1674 r1688  
    88
    99"""
     10
     11import sys
     12from os import sep
     13sys.path.append('..'+sep+'..'+sep)
    1014
    1115def prepare_timeboundary(filename):
     
    2731    N = len(lines)
    2832
    29     T = zeros(N, Float)       #Time
     33    T = zeros(N, Float)  #Time
    3034    Q = zeros(N, Float)  #Values
    3135
    3236    for i, line in enumerate(lines):
    3337        fields = line.split()
    34        
     38
    3539        T[i] = float(fields[0])
    3640        Q[i] = float(fields[1])
     
    3943    from Scientific.IO.NetCDF import NetCDFFile
    4044
    41     fid = NetCDFFile(filename[-4:] + '.sww', 'w')
     45    print filename[:-4] + '.sww'
     46
     47    fid = NetCDFFile(filename[:-4] + '.sww', 'w')
    4248
    4349    fid.institution = 'Geoscience Australia'
     
    4753    fid.createVariable('time', Float, ('number_of_timesteps',))
    4854    fid.variables['time'][:] = T
    49            
     55
    5056    fid.createVariable('stage', Float, ('number_of_timesteps',))
    5157    fid.variables['stage'][:] = Q[:]
     
    5561
    5662    fid.createVariable('ymomentum', Float, ('number_of_timesteps',))
    57     fid.variables['ymomentum'][:] = 0.0               
     63    fid.variables['ymomentum'][:] = 0.0
    5864
    5965
     
    7278
    7379try:
     80    print 'Read pickled domain'
    7481    fid = open(picklefile)
    7582    domain = load(fid)
    76     print 'Read pickled domain'
     83
    7784except:
    7885
    7986    #Preparing time boundary
    8087    prepare_timeboundary('Benchmark_2_input.txt')
    81    
     88
    8289    #Preparing points
    8390    from pyvolution.data_manager import xya2pts
     
    104111    #LS code to be included in set_quantity
    105112    from pyvolution import util, least_squares
    106     points, attributes = util.read_xya('bathymetry.pts')
    107    
     113    points, attributes = util.read_xya('Benchmark_2_Bathymetry.pts')
     114
    108115    #Fit attributes to mesh
    109116    vertex_attributes = least_squares.fit_to_mesh(domain.coordinates,
     
    125132
    126133
    127 
    128134######################
    129135# Boundary conditions
     
    140146import time
    141147t0 = time.time()
     148domain.visualise = True
    142149
    143 for t in domain.evolve(yieldstep = 0.1, finaltime = 22.5):
     150for t in domain.evolve(yieldstep = 1.0, finaltime = 22.5):
    144151    domain.write_time()
    145152
    146153
    147154print 'That took %.2f seconds' %(time.time()-t0)
    148 
Note: See TracChangeset for help on using the changeset viewer.