Beispiel #1
0
    def __init__(self, tau, dt, time_end):
        super().__init__(dt, time_end)

        if tau <= 0:
            raise RTDInputError("tau less than 0")
        if tau >= self.time[-1]:
            raise RTDInputError("PFR lag is at or beyond end of supplied time")
        self._tau = tau

        self._exitage = self._calc_exitage()
Beispiel #2
0
    def __init__(self, n, tau, dt, time_end):
        super().__init__(dt, time_end)

        if n <= 0:
            raise RTDInputError("n less than zero")
        self._n = n

        if tau <= 0:
            raise RTDInputError("tau less than zero")
        self._tau = tau

        self._exitage = self._calc_exitage()
Beispiel #3
0
    def __init__(self, tau, peclet, dt, time_end):
        super().__init__(dt, time_end)

        if tau <= 0:
            raise RTDInputError('tau less than zero')
        self._tau = tau

        if peclet <= 0:
            raise RTDInputError('peclet less than zero')
        self._peclet = peclet

        self._exitage = self._calc_exitage()
Beispiel #4
0
    def __init__(self, b, c, dt, time_end):
        super().__init__(dt, time_end)

        if b <= 0:
            raise RTDInputError("b less than zero")
        self._b = b

        if c <= 0:
            raise RTDInputError("c less than zero")
        self._c = c

        self._a = self._calc_a()

        self._exitage = self._calc_exitage()
Beispiel #5
0
 def peclet(self, peclet):
     if peclet <= 0:
         raise RTDInputError('peclet less than zero')
     self._peclet = peclet
     self._tau_oo = self._calc_tau_oo()
     self._theta = self._calc_theta()
     self._exitage = self._calc_exitage()
Beispiel #6
0
 def peclet(self, peclet):
     """Set Peclet number"""
     if peclet <= 0:
         raise RTDInputError('peclet less than zero')
     self._peclet = peclet
     self._pde_result = self._calc_pde()
     self._exitage = self._calc_exitage()
Beispiel #7
0
 def tau(self, tau):
     if tau <= 0:
         raise RTDInputError('tau less than zero')
     self._tau = tau
     self._tau_oo = self._calc_tau_oo()
     self._theta = self._calc_theta()
     self._exitage = self._calc_exitage()
Beispiel #8
0
 def _get_elist_dt(elist):
     """Validate that all dts are the same and return dt."""
     dts = [item.dt for item in elist]
     if len(set(dts)) == 1:
         dt = dts[0]
     else:
         raise RTDInputError('RTDs have inconsistent dt in Elist')
     return dt
Beispiel #9
0
    def __init__(self, fun, dt, time_end):
        super().__init__(dt, time_end)

        if not isinstance(fun, typing.Callable):
            raise RTDInputError("fun is not callable")

        self._fun = fun
        self._exitage = self._calc_exitage()
Beispiel #10
0
    def _get_elist_time_end(elist):
        """Validate that all time_ends are the same and return time_end."""

        time_ends = [item.time_end for item in elist]
        if len(set(time_ends)) == 1:
            time_end = time_ends[0]
        else:
            raise RTDInputError('RTDs have inconsistent time_end in Elist')
        return time_end
Beispiel #11
0
    def _calc_exitage(self):
        try:
            t = self.time
            if self.tau >= self.time[-1]:
                raise RTDInputError(
                    'PFR lag is at or beyond end of supplied time')

            a = np.zeros(t.size)
            idx = np.nonzero(t <= self.tau)
            idxfirst = idx[0][-1]
            if idxfirst == t.size:
                raise RTDInputError('PFR lag is at end of supplied time')

            a[idxfirst] = (t[idxfirst + 1] - self.tau) / self.dt / self.dt
            a[idxfirst + 1] = (self.tau - t[idxfirst]) / self.dt / self.dt

            output = a
        except AttributeError:
            output = None
        return output
Beispiel #12
0
    def _calc_exitage(self):
        """Calculate exitage."""

        a = np.zeros_like(self.time)
        idx = np.nonzero(self.time <= self.tau)
        idxfirst = idx[0][-1]
        if idxfirst == self.time.size:
            raise RTDInputError('PFR lag is at end of supplied time')

        a[idxfirst] = (self.time[idxfirst + 1] - self.tau) / self.dt / self.dt
        a[idxfirst + 1] = (self.tau - self.time[idxfirst]) / self.dt / self.dt
        return a
Beispiel #13
0
    def __init__(self,
                 tau,
                 peclet,
                 dt,
                 time_end,
                 nx=200,
                 a=10000,
                 rtol=1e-5,
                 atol=1e-10,
                 max_step=None):
        """Axial Dispersion closed-closed model"""
        super().__init__(dt, time_end)

        self._tau = tau
        self._peclet = None
        self._pde_result = None

        self.nx = nx
        self.a = a
        self.rtol = rtol
        self.atol = atol
        if max_step is None:
            self.max_step = 2 / nx
        else:
            self.max_step = max_step

        if tau <= 0:
            raise RTDInputError('tau less than zero')
        self._tau = tau

        if peclet <= 0:
            raise RTDInputError('peclet less than zero')
        self._peclet = peclet

        self._pde_result = self._calc_pde(self.time_end / self.tau)
        self._exitage = self._calc_exitage()
Beispiel #14
0
 def tau(self, tau):
     if tau <= 0:
         raise RTDInputError("tau less than 0")
     self._tau = tau
     self._exitage = self._calc_exitage()
Beispiel #15
0
 def tau(self, tau):
     """Set tau"""
     if tau <= 0:
         raise RTDInputError('tau less than zero')
     self._tau = tau
     self._exitage = self._calc_exitage()
Beispiel #16
0
 def _validate_rtd(elist):
     """Validate that all models in elist are RTD models."""
     if any([not isinstance(item, RTD) for item in elist]):
         raise RTDInputError('item in list not an RTD class')
Beispiel #17
0
 def n(self, n):
     if n <= 0:
         raise RTDInputError("n less than zero")
     self._n = n
     self._exitage = self._calc_exitage()