Changeset 8418


Ignore:
Timestamp:
May 8, 2012, 5:29:03 PM (13 years ago)
Author:
steve
Message:

Strange proble with parallel_safe

Location:
trunk/anuga_core/source
Files:
7 edited

Legend:

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

    r8371 r8418  
    467467        return q
    468468
     469    def get_CFL(self):
     470        """get CFL
     471        """
     472
     473        return self.CFL
     474   
     475
    469476    def set_CFL(self, cfl=1.0):
    470         """Set CFL parameter, warn if greater than 1.0
    471         """
    472         if cfl > 1.0:
     477        """Set CFL parameter, warn if greater than 2.0
     478        """
     479        if cfl > 2.0:
    473480            self.CFL = cfl
    474             log.warn('Setting CFL > 1.0')
     481            log.warn('Setting CFL > 2.0')
    475482
    476483        assert cfl > 0.0
    477484        self.CFL = cfl
    478 
    479 
    480485
    481486    def set_time(self, time=0.0):
  • trunk/anuga_core/source/anuga/config.py

    r8406 r8418  
    117117# beta values. In this case the settings for timestepping_method will be overriden
    118118
    119 #flow_algorithm = 1    # 1st order euler and conservative piecewise constant spatial reconstruction
    120 flow_algorithm = 1.5  # 1st order euler and conservative piecewise linear spatial reconstruction
    121 #flow_algorithm = 1.75 # 1st order euler and more aggressive piecewise linear spatial reconstruction
    122 #flow_algorithm = 2    # 2nd order TVD scheme and more aggressive piecewise linear spatial reconstruction
    123 #flow_algorithm = 2.5  # 3rd order TVD scheme and more aggressive piecewise linear spatial reconstruction
     119#flow_algorithm = '1_0'    # 1st order euler and conservative piecewise constant spatial reconstruction
     120flow_algorithm = '1_5'  # 1st order euler and conservative piecewise linear spatial reconstruction
     121#flow_algorithm = '1_75' # 1st order euler and more aggressive piecewise linear spatial reconstruction
     122#flow_algorithm = '2_0'    # 2nd order TVD scheme and more aggressive piecewise linear spatial reconstruction
     123#flow_algorithm = '2.5'  # 3rd order TVD scheme and more aggressive piecewise linear spatial reconstruction
    124124
    125125
  • trunk/anuga_core/source/anuga/operators/base_operator.py

    r8366 r8418  
    2727
    2828
    29         if domain.numproc > 1:
    30             msg = 'Not implemented to run in parallel'
    31             assert self.__parallel_safe(), msg
     29#        if domain.numproc > 1:
     30#            msg = 'Not implemented to run in parallel'
     31#            assert self.__parallel_safe(), msg
    3232
    3333        if description == None:
     
    6363        """By default an operator is not parallel safe
    6464        """
     65
     66        print "ZZZZ in --parallel_safe base_oprator"
    6567        return False
    6668
  • trunk/anuga_core/source/anuga/shallow_water/shallow_water_domain.py

    r8406 r8418  
    270270        parameters['use_sloped_mannings']     = self.use_sloped_mannings
    271271        parameters['compute_fluxes_method']   = self.get_compute_fluxes_method()
    272         parameters['flow_algorithm']             = self.get_flow_algorithm()
     272        parameters['flow_algorithm']          = self.get_flow_algorithm()
     273        parameters['CFL']                     = self.get_CFL()
     274        parameters['timestepping_method']     = self.get_timestepping_method()
    273275
    274276        parameters['optimised_gradient_limiter']        = self.optimised_gradient_limiter
     
    358360        """
    359361
    360         flag = str(flag)
    361 
    362         flow_algorithms = ['1', '1.5', '1.75', '2', '2.5']
     362        if isinstance(flag, str) :
     363            flag = flag.replace(".","_")
     364        else:
     365            flag = str(float(str(flag))).replace(".","_")
     366
     367        flow_algorithms = ['1_0', '1_5', '1_75', '2_0', '2_5']
    363368
    364369        if flag in flow_algorithms:
     
    370375
    371376
    372         if self.flow_algorithm == '1':
     377        if self.flow_algorithm == '1_0':
    373378            self.set_timestepping_method(1)
    374379            self.set_default_order(1)
    375 
    376         if self.flow_algorithm == '1.5':
     380            self.set_CFL(1.0)
     381
     382        if self.flow_algorithm == '1_5':
    377383            self.set_timestepping_method(1)
    378384            self.set_default_order(2)
     
    384390            beta_vh_dry = 0.2
    385391            self.set_betas(beta_w, beta_w_dry, beta_uh, beta_uh_dry, beta_vh, beta_vh_dry)
    386 
    387 
    388         if self.flow_algorithm == '1.75':
     392            self.set_CFL(1.0)
     393
     394
     395        if self.flow_algorithm == '1_75':
    389396            self.set_timestepping_method(1)
    390397            self.set_default_order(2)
     
    396403            beta_vh_dry = 0.2
    397404            self.set_betas(beta_w, beta_w_dry, beta_uh, beta_uh_dry, beta_vh, beta_vh_dry)
    398 
    399 
    400         if self.flow_algorithm == '2':
     405            self.set_CFL(0.75)
     406
     407
     408        if self.flow_algorithm == '2_0':
    401409            self.set_timestepping_method(2)
    402410            self.set_default_order(2)
    403             beta_w      = 1.7
     411            beta_w      = 1.9
    404412            beta_w_dry  = 0.2
    405             beta_uh     = 1.7
     413            beta_uh     = 1.9
    406414            beta_uh_dry = 0.2
    407             beta_vh     = 1.7
     415            beta_vh     = 1.9
    408416            beta_vh_dry = 0.2
    409417            self.set_betas(beta_w, beta_w_dry, beta_uh, beta_uh_dry, beta_vh, beta_vh_dry)
    410 
    411         if self.flow_algorithm == '2.5':
     418            self.set_CFL(1.0)
     419
     420        if self.flow_algorithm == '2_5':
    412421            self.set_timestepping_method(3)
    413422            self.set_default_order(2)
    414             beta_w      = 1.7
     423            beta_w      = 1.9
    415424            beta_w_dry  = 0.2
    416             beta_uh     = 1.7
     425            beta_uh     = 1.9
    417426            beta_uh_dry = 0.2
    418             beta_vh     = 1.7
     427            beta_vh     = 1.9
    419428            beta_vh_dry = 0.2
    420429            self.set_betas(beta_w, beta_w_dry, beta_uh, beta_uh_dry, beta_vh, beta_vh_dry)
     430            self.set_CFL(1.0)
    421431
    422432
     
    426436
    427437        Currently
    428            1, 1.5, 2, 2.5
     438           1_0, 1_5, 1_75 2_0, 2_5
    429439        """
    430440
     
    898908                Q.extrapolate_first_order()
    899909            elif self._order_ == 2:
    900                 Q.extrapolate_second_order_and_limit_by_edge()
     910                if self.use_edge_limiter:
     911                    Q.extrapolate_second_order_and_limit_by_edge()
     912                else:
     913                    Q.extrapolate_second_order_and_limit_by_vertex()
    901914            else:
    902915                raise Exception('Unknown order')
  • trunk/anuga_core/source/anuga_parallel/parallel_boyd_box_operator.py

    r8224 r8418  
    9595
    9696
     97    def __parallel_safe(self):
     98
     99        print "ZZZZ parallel_boyd"
     100        return True
     101
     102
     103
     104
    97105    def debug_discharge_routine(self):
    98106        local_debug ='false'
  • trunk/anuga_core/source/anuga_parallel/parallel_structure_operator.py

    r8224 r8418  
    5555                 enquiry_proc = None):
    5656
     57        self.myid = pypar.rank()
     58        self.num_procs = pypar.size()
     59       
    5760        anuga.Operator.__init__(self,domain)
    5861
     
    8285        self.exchange_lines = ensure_numeric(exchange_lines)
    8386        self.enquiry_points = ensure_numeric(enquiry_points)
    84         self.myid = pypar.rank()
    85         self.num_procs = pypar.size()
     87
    8688       
    8789        if height is None:
     
    162164        self.outflow_index = 1
    163165
    164         self.set_logging(logging)
     166        self.set_parallel_logging(logging)
    165167
    166168    def __call__(self):
     
    440442
    441443
    442     def set_logging(self, flag=True):
     444    def set_parallel_logging(self, flag=True):
    443445        # Warning: requires synchronization, must be called by all procs associated
    444446        # with this structure
     
    448450
    449451        # If flag is true open file with mode = "w" to form a clean file for logging
    450         if self.logging:
     452        if self.logging and self.myid == self.master_proc:
    451453            self.log_filename = self.label + '.log'
    452454            log_to_file(self.log_filename, stats, mode='w')
     
    455457            #log_to_file(self.log_filename, self.culvert_type)
    456458
     459    def set_logging(self, flag=True):
     460        # Overwrite the sequential procedure with a dummy procedure.
     461        # Need to call set_parallel_logging which needs t obe done later
     462        # after the calculation of master processors
     463
     464        pass
     465   
    457466
    458467    def timestepping_statistics(self):
     
    504513        return self.enquiry_proc
    505514
     515
    506516    def __parallel_safe(self):
    507517        return True
     518
     519
     520
  • trunk/anuga_core/source/anuga_parallel/run_parallel_sw_merimbula_profile.py

    r8225 r8418  
    3535
    3636
    37 from anuga_parallel import distribute, myid, numprocs, finalize
     37from anuga_parallel import distribute, myid, numprocs, finalize, barrier
    3838
    3939
     
    8383#domain.smooth = False
    8484
    85 domain.set_default_order(2)
    86 domain.set_timestepping_method('rk2')
     85
     86domain.set_flow_algorithm(2.0)
     87
     88if myid == 0:
     89    domain.print_algorithm_parameters()
     90
     91barrier()
     92
     93#domain.set_default_order(2)
     94#domain.set_timestepping_method('rk2')
    8795#domain.set_CFL(0.7)
    8896#domain.set_beta(1.5)
     97
     98
    8999domain.set_name('meribula')
    90100
Note: See TracChangeset for help on using the changeset viewer.