numbacs.diagnostics =================== .. py:module:: numbacs.diagnostics Module Contents --------------- .. py:function:: ftle_grid_2D(flowmap, T, dx, dy) Compute 2D FTLE field from flowmap which is solution of ode over an initial grid defined by x and y for integration time T. :param flowmap: array containing final positions of trajectories of initial grid from t0 to t0+T. :type flowmap: np.ndarray, shape = (nx,ny,2) :param T: integration time. :type T: float :param dx: grid spacing in x-direction. :type dx: float :param dy: grid spacing in y-direction. :type dy: float :returns: **ftle** -- array containing ftle values. :rtype: np.ndarray, shape = (nx,ny) .. py:function:: C_tensor_2D(flowmap_aux, dx, dy, h=1e-05) Compute eigenvalues and eigenvectors of Cauchy Green tensor in 2D from flowmap_aux which is solution of ode over an auxilary grid defined by x,y +-h for integration time T. :param flowmap_aux: array containing final positions of initial grid with aux grid spacing h from t0 to t0+T. :type flowmap_aux: np.ndarray, shape = (nx,ny,n_aux,2) :param dx: grid spacing in x-direction. :type dx: float :param dy: grid spacing in y-direction. :type dy: float :param h: aux grid spacing. The default is 1e-5. :type h: float, optional :returns: **C** -- array containing C11, C12, C22 components of Cauchy Green tensor. :rtype: np.ndarray, shape = (nx,ny,3) .. py:function:: C_eig_aux_2D(flowmap_aux, dx, dy, h=1e-05, eig_main=True) Compute eigenvalues and eigenvectors of Cauchy Green tensor in 2D from flowmap_aux which is solution of ode over an auxilary grid defined by x,y +-h for integration time T. :param flowmap_aux: array containing final positions of initial grid with aux grid spacing h from t0 to t0+T. :type flowmap_aux: np.ndarray, shape = (nx,ny,n_aux,2) :param dx: grid spacing in x-direction. :type dx: float :param dy: grid spacing in y-direction. :type dy: float :param h: aux grid spacing. The default is 1e-5. :type h: float, optional :param eig_main: flag to determine if eigevalues are computed from main grid. The default is True. :type eig_main: boolean, optional :returns: * **eigvals** (*np.ndarray, shape = (nx,ny,2)*) -- array containing eigenvalues values. * **eigvecs** (*np.ndarray, shape = (nx,ny,2,2)*) -- array containing eigenvectors. .. py:function:: C_eig_2D(flowmap, dx, dy) Compute eigenvalues and eigenvectors of Cauchy Green tensor in 2D from flowmap which is solution of ode over a grid defined by x,y for integration time T. :param flowmap: array containing final positions of initial grid from t0 to t0+T. :type flowmap: np.ndarray, shape = (nx,ny,2) :param dx: grid spacing in x-direction. :type dx: float :param dy: grid spacing in y-direction. :type dy: float :returns: * **eigvals** (*np.ndarray, shape = (nx,ny,2)*) -- array containing eigenvalues. * **eigvecs** (*np.ndarray, shape = (nx,ny,2,2)*) -- array containing eigenvectors. .. py:function:: ftle_from_eig(eigval_max, T) Compute FTLE field from eigval_max where eigval_max is eigenvalue of Cauchy-Green tensor computed using integration time T. :param eigval_max: maximum eigenvalue of Cauchy-Green tensor computed using integration time T. :type eigval_max: np.ndarray, shape = (nx,ny) :param T: integration time. :type T: float :returns: **ftle** -- array containing ftle values. :rtype: np.ndarray, shape = (nx,ny) .. py:function:: lavd_grid_2D(flowmap_n, tspan, T, vort_interp, xrav, yrav, period_x=0.0, period_y=0.0) Compute LAVD from flowmap_n where flowmap_n contains trajectories computed over gridpoints defined by xrav,yrav for an integration time T and trajectories are returned at times given by tspan. vort_interp is an interpolant function of vorticity over (at least) that time window. :param flowmap_n: array containing trajectories of initial grid from t0 to t0+T. :type flowmap_n: np.ndarray, shape = (nx,ny,n,2) :param tspan: array containing n times corresponding to axis=2 of flowmap_n. :type tspan: np.ndarray, shape = (n,) :param T: integration time. :type T: float :param vort_interp: interpolant function of vorticity which must be (at least) defined over all values of flowmap_n and times from tspan. :type vort_interp: jit-callable :param xrav: array containing raveled or flattened meshgrid X, can be obtained using X.ravel() or X.flatten(). :type xrav: np.ndarray, shape = (nx*ny,)) :param yrav: array containing raveled or flattened meshgrid Y, can be obtained using Y.ravel() or Y.flatten(). :type yrav: np.ndarray, shape = (nx*ny,)) :param period_x: value for period in x-direction, if not periodic, set equal to 0.0. The default is 0.0. :type period_x: float :param period_y: value for period in y-direction, if not periodic, set equal to 0.0. The default is 0.0. :type period_y: float :returns: **lavd** -- array containing lavd values. :rtype: np.ndarray, shape = (nx,ny) .. py:function:: ftle_grid_ND(flowmap, IC, T, dX) Compute ND FTLE field from flowmap which is solution of ode over an initial grid defined by IC for integration time T. :param flowmap: array containing final positions of initial grid from t0 to t0+T. :type flowmap: np.ndarray, shape = (nx_1*nx_2*...*nx_ndims,ndims) :param IC: initial condition array. :type IC: np.ndarray, shape = (nx_1,nx_2,...,nx_ndims,ndims) :param T: integration time. :type T: float :param dX: array containing spacing in each x_i direction for i = 1,...,ndims. :type dX: np.ndarray, shape = (ndims,) :returns: **ftle** -- array containing ftle values. :rtype: np.ndarray, shape = (nx_1*nx_2*...*nx_ndims,) .. py:function:: ile_2D_func(vel, x, y, t0=None, h=0.001) Compute the iLE field from the flow defined by vel which is a jit-callable function, step size of h is used in finite differencing. :param vel: function returing interpolated of function value of velocity in x,y directions. :type vel: jit-callable :param x: array containing x-values. :type x: np.ndarray, shape = (nx,) :param y: array containing y-values. :type y: np.ndarray, shape = (ny,) :param t0: time value at which to evaluate if v1,v2 interpolants depend on time, if they do not depend on time, set to None. The default is None. :type t0: float or None, optional :param h: step size to be used in finite differencing. The default is 1e-3. :type h: float, optional :returns: **ile** -- array containing ile values. :rtype: np.ndarray, shape = (nx,ny) .. py:function:: S_eig_2D_func(vel, x, y, t0=None, h=0.001) Compute eigenvalues and eigenvectors of Eulerian rate of strain tensor in 2D from vel which is a jit-callable function, step size of h is used for finite differencing. :param vel: function returing interpolated of function value of velocity in x,y directions. :type vel: jit-callable :param x: array containing x-values. :type x: np.ndarray, shape = (nx,) :param y: array containing y-values. :type y: np.ndarray, shape = (ny,) :param t0: time value at which to evaluate if v1,v2 interpolants depend on time, if they do not depend on time, set to None. The default is None. :type t0: float or None, optional :param h: step size to be used in finite differencing. The default is 1e-2. :type h: float, optional :returns: * **eigvals** (*np.ndarray, shape = (nx,ny)*) -- array containg eigenvalues of S. * **eigvecs** (*np.ndarray, shape = (nx,ny)*) -- array containing eigenvectors of S. .. py:function:: S_2D_func(vel, x, y, t0=None, h=0.001) Compute Eulerian rate of strain tensor in 2D from vel which is a jit-callable functions, step size of h is used for finite differencing. :param v1: function returing interpolated value of velocity in x-direction. :type v1: jit-callable :param v2: function returing interpolated value of velocity in y-direction. :type v2: jit-callable :param x: array containing x-values. :type x: np.ndarray, shape = (nx,) :param y: array containing y-values. :type y: np.ndarray, shape = (ny,) :param t0: time value at which to evaluate if v1,v2 interpolants depend on time, if they do not depend on time, set to None. The default is None. :type t0: float or None, optional :param h: step size to be used in finite differencing. The default is 1e-3. :type h: float, optional :returns: **S** -- S11,S12, and S22 components of S tensor. :rtype: np.ndarray, shape = (nx,ny) .. py:function:: ile_2D_data(u, v, dx, dy) Compute the iLE field from the flow defined by u,v over an intial grid defined by x,y. :param u: array containing velocity values in x-direction. :type u: np.ndarray, shape = (nx,ny) :param v: array containing velocity values in y-direction. :type v: np.ndarray, shape = (nx,ny) :param dx: grid spacing in x-direction. :type dx: float :param dy: grid spacing in y-direction. :type dy: float :returns: **ile** -- array containing ile values. :rtype: np.ndarray, shape = (nx,ny) .. py:function:: S_eig_2D_data(u, v, dx, dy) Compute eigenvalues and eigenvectors of Eulerian rate of strain tensor in 2D from u,v which describe the x,y velocity. :param u: array containing velocity values in x-direction. :type u: np.ndarray, shape = (nx,ny) :param v: array containing velocity values in y-direction. :type v: np.ndarray, shape = (nx,ny) :param dx: grid spacing in x-direction. :type dx: float :param dy: grid spacing in y-direction. :type dy: float :returns: * **eigvals** (*np.ndarray, shape = (nx,ny,2)*) -- array containg eigenvalues of S. * **eigvecs** (*np.ndarray, shape = (nx,ny,2,2)*) -- array containing eigenvectors of S. .. py:function:: ivd_grid_2D(vort, vort_avg) Compute IVD at an instant from vort and vort_avg. :param vort: array containg vorticity values. :type vort: np.ndarray, shape = (nx,ny) :param vort_avg: value of average spatial vorticity at specific time. :type vort_avg: float :returns: **ivd** -- array containing values of ivd. :rtype: np.ndarray, shape = (nx,ny)