Changeset 8167


Ignore:
Timestamp:
Mar 25, 2011, 5:55:00 PM (14 years ago)
Author:
steve
Message:

Found an error in vtk visualiser

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/generic_domain.py

    r8164 r8167  
    13441344            self.update_boundary()
    13451345
     1346            # Update any other quantities that might be useful
     1347            self.update_other_quantities()
     1348
    13461349            # Update extrema if necessary (for reporting)
    13471350            self.update_extrema()           
     
    16581661
    16591662    def apply_fractional_steps(self):
     1663
    16601664        for operator in self.fractional_step_operators:
    16611665            operator()
     
    17841788                num.put(Q_cv, Idg, num.take(Q_cv, Idf, axis=0))
    17851789
    1786  
     1790    def update_other_quantities(self):
     1791        """ There may be a need to calculates some of the other quantities
     1792        based on the new values of conserved quantities
     1793        """
     1794
     1795        pass
     1796
    17871797    def distribute_to_vertices_and_edges(self):
    17881798        """Extrapolate conserved quantities from centroid to
     
    18021812            else:
    18031813                raise Exception('Unknown order: %s' % str(self._order_))
     1814
    18041815
    18051816    def centroid_norm(self, quantity, normfunc):
  • trunk/anuga_core/source/anuga/operators/run_dam_break.py

    r8166 r8167  
    1515from math import cos
    1616from numpy import zeros, float, where
     17import numpy
    1718from time import localtime, strftime, gmtime
    1819
     
    3940L = 100000.
    4041W = 10*dx
     42#W = dx
    4143
    4244# structured mesh
     
    4648
    4749domain.set_name(output_file)               
    48 #domain.set_datadir(output_dir)
    4950
    5051#------------------------------------------------------------------------------
     
    5354domain.set_timestepping_method('rk2')
    5455domain.set_default_order(2)
     56domain.set_beta(1.7)
    5557
    5658#------------------------------------------------------------------------------
     
    5961domain.set_use_kinematic_viscosity(True)
    6062
    61 domain.set_beta(1.7)
    6263#------------------------------------------------------------------------------
    6364# Setup initial conditions
     
    8788
    8889# Associate boundary tags with boundary objects
    89 domain.set_boundary({'left': Br, 'right': Bt, 'top': Br, 'bottom': Br})
     90domain.set_boundary({'left': Br, 'right': Br, 'top': Br, 'bottom': Br})
    9091
    9192
     
    9495vis = RealtimeVisualiser(domain)
    9596vis.render_quantity_height("stage", zScale = 50000/(h0-h1), dynamic=True)
    96 vis.colour_height_quantity('stage', (0.0, 0.5, 1.0))
     97vis.colour_height_quantity("stage",
     98#        (lambda q: numpy.sqrt( (q["xvelocity"]**2 ) + (q['yvelocity']**2 )), 0.0, 10.0) )
     99        (lambda q: q["yvelocity"], -10.0, 10.0) )
    97100vis.start()
    98101#===============================================================================
     
    112115#    else:
    113116#        domain.set_use_kinematic_viscosity(True)
    114        
     117
     118    #print domain.quantities['height'].vertex_values
     119
     120    #domain.quantities['height'].vertex_values
     121
     122    #print domain.quantities['height'].vertex_values
     123
     124    #print len(domain)
     125
     126    #vertex_values, _ = domain.get_quantity('height').get_vertex_values(xy=False, smooth=False)
     127
     128    #print vertex_values
     129
    115130    vis.update()
    116131
  • trunk/anuga_core/source/anuga/shallow_water/shallow_water_domain.py

    r8165 r8167  
    582582        protect_against_infinitesimal_and_negative_heights(self)
    583583       
     584
     585    def update_other_quantities(self):
     586        """ There may be a need to calculates some of the other quantities
     587        based on the new values of conserved quantities
     588        """
     589
     590        # The centroid values of height and x and y velocity
     591        # might not have been setup
     592
     593        self.update_centroids_of_velocities_and_height()
     594
     595        for name in ['height', 'xvelocity', 'yvelocity']:
     596            Q = self.quantities[name]
     597            if self._order_ == 1:
     598                Q.extrapolate_first_order()
     599            elif self._order_ == 2:
     600                Q.extrapolate_second_order_and_limit_by_edge()
     601            else:
     602                raise Exception('Unknown order')
     603
     604
    584605
    585606    def update_centroids_of_velocities_and_height(self):
  • trunk/anuga_core/source/anuga/visualiser/realtime.py

    r7452 r8167  
    6161        vertex_values, _ = self.source.get_quantity(quantityName).get_vertex_values(xy=False, smooth=False)
    6262
     63       
    6364        for n in range(N_vert):
    6465            qty_index[n] = vertex_values[n]
     
    9495        quantities = {}
    9596        for q in self.source.get_quantity_names():
    96             quantities[q], _ = self.source.get_quantity(q).get_vertex_values(xy=False)
     97            #quantities[q], _ = self.source.get_quantity(q).get_vertex_values(xy=False)
     98            quantities[q]  = self.source.get_quantity(q).vertex_values.flatten()
    9799        return quantities
    98100
  • trunk/anuga_core/source/anuga/visualiser/visualiser.py

    r6113 r8167  
    174174                    # range.
    175175                    scalars = vtkFloatArray()
     176
    176177                    map(scalars.InsertNextValue, colour[0](self.build_quantity_dict()))
    177178                    self.vtk_polyData[quantityName].GetPointData().SetScalars(scalars)
    178                     mapper.SetScalarRange(colour[1:])
     179                    #mapper.SetScalarRange(colour[1:])
    179180                    mapper.Update()
    180181                else:
Note: See TracChangeset for help on using the changeset viewer.