'n_points': 200,
          'lc': 0.16739,
          'Ymax': 1000,
          'yi': 10,
          'alpha': 1.5,
          'Re': 500,
          'variables': 'v_eta',
          'equation': 'LNS',
          'mapping': ['semi_infinite_PB', [0, (46.7/13.8)]],
          'Froude': 0.02,
          'slope': 1.3e-5}


# In[3]:

g = sa.fluid(option)
g.diff_matrix()
g.integ_matrix()


# In[4]:

import numpy as np


# In[5]:

g.option['mapping'] = ['finite', [-5, 7]]


# In[6]:
Exemple #2
0
option = {
    'flow': 'DATA/G.txt',
    'n_points': 200,
    'lc': 0.16739,
    'Ymax': 1000,
    'yi': 5,
    'alpha': 0.1,
    'Re': 1274,
    'variables': 'p_u_v',
    'equation': 'LNS',
    'mapping': ['semi_infinite_PB', [0, (46.7 / 13.8)]],
    'Froude': 0.02,
    'slope': 1.3e-5
}

f = sa.fluid(option)

f.diff_matrix()
f.integ_matrix()
#f.read_velocity_profile()
f.mapping()

f.set_blasius(f.y)
#f.interpolate()

# f.infinite_mapping()
# f.set_hyptan()
# f.set_poiseuille()

f.set_operator_variables()
Exemple #3
0
    def validation(self, pos, amp, gamma, eig_idx, shape):
        """ check if the sensitivity of an eigenvalue is the same with the
        adjoint procedure, or with a simple superposition of the base flow
        plus the random perturbation:
            dc = c(U+dU) - c(U) = dc(adjoint) """

        self.get_perturbation(pos, amp, gamma, shape)  # call the perturbation creator
        self.U = self.U + self.perturb
        # after the u_pert() call the self.delta_U property is accessible
        d_delta_U = np.gradient(self.perturb) / np.gradient(self.y)
        dd_delta_U = np.gradient(d_delta_U) / np.gradient(self.y)
        self.dU = self.dU + d_delta_U
        self.ddU = self.ddU + dd_delta_U

        """self.cd_pert(pos, amp)
        self.aCD = self.aCD + self.delta_cd"""

        mpl.rc('xtick', labelsize=40)
        mpl.rc('ytick', labelsize=40)
        # JUST A LITTLE VISUAL TEST TO SEE IF THE ADDITION OF
        # THE VELOCITY WORKS
        """fig, ay = plt.subplots(figsize=(10, 10), dpi=100)
        lines = ay.plot(self.U, self.y, 'b', self.dU, self.y, 'g',
                        self.ddU, self.y, 'r', self.aCD, self.y, 'm',
                        self.daCD, self.y, 'c', lw=2)
        ay.set_ylabel(r'$y$', fontsize=32)
        lgd = ay.legend((lines),
                        (r'$U$', r'$\partial U$',
                         r'$\partial^2 U$', r'$a^* C_D$',
                         r'$\partial a^* C_D$'),
                        loc=3, ncol=3, bbox_to_anchor=(0, 1), fontsize=32)
        ay.set_ylim([0,5])
        ay.grid()
        plt.show()"""

        dic = dict(zip(self.sim_param_keys, self.sim_param_values))
        f = sa.fluid(dic)

        # pdb.set_trace()

        f.diff_matrix()
        f.integ_matrix()

        f.mapping()

        f.y = self.y
        f.U = self.U
        f.dU = self.dU
        f.ddU = self.ddU
        f.aCD = self.aCD
        f.daCD = self.daCD

        f.set_operator_variables()
        f.solve_eig()

        '''fig, ay = plt.subplots(figsize=(20, 20), dpi=50)
        lines = ay.plot(np.real(f.eigv),
            np.imag(f.eigv), 'r*', markersize=20)
        ay.set_ylabel(r'$c_i$', fontsize=32)
        ay.set_xlabel(r'$c_r$', fontsize=32)
        plt.show()'''

        # remove the infinite and nan eigenvectors, and their eigenfunctions
        selector = np.isfinite(f.eigv)
        f.eigv = f.eigv[selector]
        eigv_im = np.imag(f.eigv)
        idx_new = np.argmax(eigv_im)
        eigv_new = f.eigv[idx_new]

        print ('new:', eigv_new)
        print ('old:', self.eigv[eig_idx])
        print ('diff:', eigv_new-self.eigv[eig_idx])

        #self.get_perturbation(pos, amp, gamma)
        print ('adj:', self.c_per())
        print ('diff %', np.real((eigv_new-self.eigv[eig_idx]) -self.c_per())/np.real(self.c_per()) *100, np.imag((eigv_new-self.eigv[eig_idx]) -self.c_per())/np.imag(self.c_per()) *100)

        return( eigv_new)