Пример #1
0
    def get_stability(self, state, markers1=None, markers2=None):
        dico = deepcopy(self.get_dictionary())
        param = self.get_required_param()
        for p in param:
            dico['parameters'][p] = state[p]
        scheme = pylbm.Scheme(dico)
        stab = pylbm.Stability(scheme)

        consm0 = [0.] * len(stab.consm)
        for k, moment in enumerate(stab.consm):
            consm0[k] = state.get(moment, 0.)

        n_wv = 1024
        v_xi, eigs = stab.eigenvalues(consm0, n_wv)
        nx = v_xi.shape[1]

        if markers1 is not None:
            pos0 = np.empty((nx * stab.nvtot, 2))
            for k in range(stab.nvtot):
                pos0[nx * k:nx * (k + 1), 0] = np.real(eigs[:, k])
                pos0[nx * k:nx * (k + 1), 1] = np.imag(eigs[:, k])
            markers1.set_offsets(pos0)

        if markers2 is not None:
            pos1 = np.empty((nx * stab.nvtot, 2))
            for k in range(stab.nvtot):
                pos1[nx * k:nx * (k + 1), 0] = np.max(v_xi, axis=0)
                pos1[nx * k:nx * (k + 1), 1] = np.abs(eigs[:, k])
            markers2.set_offsets(pos1)

        return stab
Пример #2
0
    def __call__(self, config, extra_config=None):
        scheme = pylbm.Scheme(config)
        stab = pylbm.Stability(scheme)
        n_wv = 1024

        for state in self.states:
            consm0 = [0.] * len(stab.consm)
            for k, moment in enumerate(stab.consm):
                consm0[k] = state.get(moment, 0.)

            stab.eigenvalues(consm0, n_wv, extra_config)

            if not stab.is_stable_l2:
                return False
        return True
Пример #3
0
            'relaxation_parameters': [0, S_1, S_1, S_2],
            'equilibrium': [U, CX * U, CY * U, (CX**2 - CY**2) * U],
        },
    ],
    'parameters': {
        LA: la,
        S_1: s_1,
        S_2: s_2,
        CX: c_x,
        CY: c_y,
    },
    'relative_velocity': [CX, CY],
}

scheme = pylbm.Scheme(dico)
stab = pylbm.Stability(scheme)
stab.visualize({
    'parameters': {
        CX: {
            'range': [0, 1],
            'init': c_x,
            'step': 0.01,
        },
        CY: {
            'range': [0, 1],
            'init': c_y,
            'step': 0.01,
        },
        S_1: {
            'name': r"$s_1$",
            'range': [0, 2],