Changeset 9705


Ignore:
Timestamp:
Mar 4, 2015, 10:17:28 AM (9 years ago)
Author:
steve
Message:

Allow inlet_operators to run beyond time defined by file function

Location:
trunk/anuga_core/anuga
Files:
2 edited

Legend:

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

    r9282 r9705  
    3636                 Q = 0.0,
    3737                 velocity = None,
    38                  default = None,
     38                 default = 0.0,
    3939                 description = None,
    4040                 label = None,
     
    169169                Q = self.Q(t)
    170170            except Modeltime_too_early, e:
    171                 raise Modeltime_too_early(e)
     171                Q = self.get_default(t)
    172172            except Modeltime_too_late, e:
    173173                Q = self.get_default(t)
     
    238238            #log_to_file(self.log_filename, self.culvert_type)
    239239
    240     def log_timestepping_statistics(self):
    241 
    242         if self.logging and self.myid == self.master_proc:
    243             log_to_file(self.log_filename, self.timestepping_statistics())
    244240
    245241    def timestepping_statistics(self):
  • trunk/anuga_core/anuga/structures/inlet_operator.py

    r9693 r9705  
    2121                 Q = 0.0,
    2222                 velocity = None,
    23                  default = None,
     23                 default = 0.0,
    2424                 description = None,
    2525                 label = None,
     
    109109                Q = self.Q(t)
    110110            except Modeltime_too_early, e:
    111                 raise Modeltime_too_early(e)
     111                Q = self.get_default(t,err_msg=e)
    112112            except Modeltime_too_late, e:
    113113                Q = self.get_default(t,err_msg=e)
     
    187187        """
    188188
    189         from anuga.fit_interpolate.interpolate import Modeltime_too_early, Modeltime_too_late
    190 
    191 
    192         if self.default is None:
    193             msg = '%s: ANUGA is trying to run longer than specified data.\n' %str(err_msg)
    194             msg += 'You can specify keyword argument default in the '
    195             msg += 'operator to tell it what to do in the absence of time data.'
    196             raise Modeltime_too_late(msg)
    197         else:
    198             # Pass control to default rate function
    199             value = self.default(t)
    200 
    201             if self.default_invoked is False:
    202                 # Issue warning the first time
    203                 msg = ('%s\n'
    204                        'Instead I will use the default rate: %s\n'
    205                        'Note: Further warnings will be supressed'
    206                        % (str(err_msg), str(self.default(t))))
    207                
    208                 warnings.warn(msg)
    209 
    210                 # FIXME (Ole): Replace this crude flag with
    211                 # Python's ability to print warnings only once.
    212                 # See http://docs.python.org/lib/warning-filter.html
    213                 self.default_invoked = True
     189
     190        # Pass control to default rate function
     191        value = self.default(t)
     192
     193        if self.default_invoked is False:
     194            # Issue warning the first time
     195            msg = ('%s\n'
     196                   'Instead I will use the default rate: %s\n'
     197                   'Note: Further warnings will be suppressed'
     198                   % (str(err_msg), str(self.default(t))))
     199           
     200            warnings.warn(msg)
     201
     202            # FIXME (Ole): Replace this crude flag with
     203            # Python's ability to print warnings only once.
     204            # See http://docs.python.org/lib/warning-filter.html
     205            self.default_invoked = True
    214206
    215207        return value
Note: See TracChangeset for help on using the changeset viewer.