Source code for pyfr.integrators.dual.phys.controllers

# -*- coding: utf-8 -*-

from pyfr.integrators.dual.phys.base import BaseDualIntegrator

class BaseDualController(BaseDualIntegrator):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        # Solution filtering frequency
        self._fnsteps = self.cfg.getint('soln-filter', 'nsteps', '0')

        # Fire off any event handlers if not restarting
        if not self.isrestart:
            for csh in self.completed_step_handlers:

    def _accept_step(self, idxcurr):
        self.tcurr += self._dt
        self.nacptsteps += 1
        self.nacptchain += 1

        # Filter
        if self._fnsteps and self.nacptsteps % self._fnsteps == 0:

        # Invalidate the solution cache
        self._curr_soln = None

        # Invalidate the solution gradients cache
        self._curr_grad_soln = None

        # Fire off any event handlers
        for csh in self.completed_step_handlers:

        # Abort if plugins request it

        # Clear the pseudo step info
        self.pseudointegrator.pseudostepinfo = []

[docs]class DualNoneController(BaseDualController): controller_name = 'none'
[docs] def advance_to(self, t): if t < self.tcurr: raise ValueError('Advance time is in the past') while self.tcurr < t: # Take the physical step self.step(self.tcurr, self._dt) # We are not adaptive, so accept every step self._accept_step(self.pseudointegrator._idxcurr)