def __init__(self, problem, scheme, postprocessor=None, params=None): Parameterized.__init__(self, params) self.problem = problem self.scheme = scheme self.postprocessor = postprocessor self.velocity_converter = VelocityConverter() self.pressure_converter = PressureConverter()
def __init__(self, params=None, name="default", label=None): Parameterized.__init__(self, params) if label: self.label = str(label) else: self.label = None self._name = name if Field._recording: Field._record.append(self)
def __init__(self, params=None, timer=None): Parameterized.__init__(self, params) if isinstance(timer, Timer): self._timer = timer elif timer: self._timer = Timer(1) else: self._timer = Timer() self._extrapolate = self.params.extrapolate # Storage of actual fields self._fields = {} # Representations of field dependencies self._sorted_fields_keys = [] # Topological ordering of field names self._dependencies = { } # Direct dependencies dep[name] = ((depname0, ts0), (depname1, ts1), ...) self._full_dependencies = {} # Indirect dependencies included for depname in builtin_fields: self._dependencies[depname] = [] self._full_dependencies[depname] = [] # Create instances required for plotting, saving and planning #self._reverse_dependencies = {} # TODO: Need this? self._plotter = Plotter(self._timer) self._saver = Saver(self._timer, self.params.casedir, self.params.flush_frequency) self._planner = Planner(self._timer, self.params.initial_dt) # Plan of what to compute now and in near future self._plan = defaultdict(lambda: defaultdict(int)) # Cache of computed values needed for planned computations self._cache = defaultdict(dict) # Solution provided to update_all self._solution = dict() # Keep track of which fields have been finalized self._finalized = {} # Keep track of how many times update_all has been called self._update_all_count = 0 # Keep track of how many times .get has called each field.compute, for administration: self._compute_counts = defaultdict( int) # Actually only used for triggering "before_first_compute" if self.params.clean_casedir: self._saver._clean_casedir() """
def __init__(self, params): """Initialize problem instance. Params will be taken from default_params and overridden by the values given to this constructor. """ Parameterized.__init__(self, params) # Optionally set end time based on period and number of periods if self.params.T is None: if (self.params.num_periods is None or self.params.period is None): raise ValueError( "You must provide parameter values for either end time T, or period and num_periods." ) self.params.T = self.params.T0 + self.params.period * self.params.num_periods else: if self.params.num_periods is not None: raise ValueError( "Ambiguous time period, cannot set both T and num_periods." )
def __init__(self, postprocessor, params=None): Parameterized.__init__(self, params) self.postproc = postprocessor self._functions = {} self.timer = self.postproc._timer
def __init__(self, params=None): Parameterized.__init__(self, params)