Changeset 9656


Ignore:
Timestamp:
Feb 10, 2015, 6:31:05 PM (9 years ago)
Author:
davies
Message:

Experimenting with forcing constant inlet elevations

Location:
trunk/anuga_core/anuga/parallel
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/anuga/parallel/parallel_inlet.py

    r9655 r9656  
    195195            return 0.0
    196196
     197    def get_global_average_elevation(self):
     198        # GLOBAL: Master processor gathers elevations from all child processors, and returns average
     199
     200        # WARNING: requires synchronization, must be called by all procs associated
     201        # with this inlet
     202
     203        import pypar
     204        local_elevation = num.sum(self.get_elevations()*self.get_areas())
     205        global_area = self.get_global_area()
     206
     207
     208
     209        global_elevation = local_elevation
     210
     211        if self.myid == self.master_proc:
     212            for i in self.procs:
     213                if i == self.master_proc: continue
     214
     215                val = pypar.receive(i)
     216                global_elevation = global_elevation + val
     217        else:
     218            pypar.send(local_elevation, self.master_proc)
     219
     220
     221        if global_area > 0.0:
     222            return global_elevation/global_area
     223        else:
     224            return 0.0
    197225
    198226    def get_xmoms(self):
  • trunk/anuga_core/anuga/parallel/parallel_operator_factory.py

    r9632 r9656  
    857857    inlet_enq_proc = -1
    858858
    859 
    860 
    861859    # Calculate the number of points of the line inside full polygon
    862860
  • trunk/anuga_core/anuga/parallel/parallel_structure_operator.py

    r9653 r9656  
    107107            height = width
    108108
    109 
    110 
    111109        if apron is None:
    112110            apron = width
     
    194192                               enquiry_proc = self.enquiry_proc[0],
    195193                               verbose = self.verbose))
     194         
     195            # Try to enforce a constant inlet elevation
     196            inlet_global_elevation = self.inlets[-1].get_global_average_elevation()
     197            self.inlets[-1].set_elevations(inlet_global_elevation)
     198           
    196199        else:
    197200            self.inlets.append(None)
Note: See TracChangeset for help on using the changeset viewer.