Example #1
0
# In[3]:

f = sa.fluid(option)
f.diff_matrix()
f.set_couette()
f.integ_matrix()

f.set_operator_variables()

f.solve_eig()
f.adjoint_spectrum('cont')
f.solve_eig_adj()

f.save_sim('cou_cont')

# In[4]:

v = po.viz('cou_cont.npz')
v.plot_velocity()
v.plot_spectrum()

# In[5]:
# 56 62 73
om = sn.sensitivity('cou_cont.npz', 73)
a, b, c, d = om.c_per(obj='norm')
print(a, b, c, d)

#om.sens_spectrum('ke_cd_N001_puv.png', 1e-7, 1e-4, 189, obj='u', shape='gauss') # eps, gamma
om.validation(1, 1e-7, 1e-4, 69, 'gauss')
Example #2
0
f.set_operator_variables()

f.solve_eig()
f.adjoint_spectrum_v_eta('disc')
f.solve_eig_adj()

f.save_sim('200_puv_disc')
#f.check_adj()

v = po.viz('200_puv_disc.npz')
v.plot_velocity()
v.plot_spectrum()
#  f.omega_alpha_curves(0.0001,2,5

idx = np.argmax(np.imag(f.eigv))
om = sn.sensitivity('200_puv_disc.npz', idx)
om.c_per(obj='norm')

#om.sens_spectrum('ke_cd_N001_puv.png', 1e-3, 1e-2, obj='u', shape='sin') # eps, gamma
#om.validation(1, 1e-2, 1, 17, 'tanh')
"""
# PROCEDURE TO ANALYZE THE SINGLE MODES IN THE SPECTRUM
# it needs to be implemented in the "fluid" class and generalyzed in the
# interface

a = np.linspace(0.0001,2,50)
omega_sel = np.zeros(len(a))
for i in np.arange(len(a)):
     f.set_perturbation(a[i],160)
     f.LNS()
     f.solve_eig()
Example #3
0
f = sa.fluid(option)
f.diff_matrix()
f.set_couette()
f.integ_matrix()

f.set_operator_variables()

f.solve_eig()
f.adjoint_spectrum('cont')
f.solve_eig_adj()

f.save_sim('cou_cont')


# In[4]:

v = po.viz('cou_cont.npz')
v.plot_velocity()
v.plot_spectrum()


# In[5]:
# 56 62 73
om = sn.sensitivity('cou_cont.npz', 73)
a, b, c, d = om.c_per(obj='norm')
print (a, b, c,d)

#om.sens_spectrum('ke_cd_N001_puv.png', 1e-7, 1e-4, 189, obj='u', shape='gauss') # eps, gamma
om.validation(1, 1e-7, 1e-4, 69, 'gauss')
Example #4
0
    f.diff_matrix()
    f.integ_matrix()
    f.read_velocity_profile()
    f.mapping()
    f.interpolate()
    f.set_operator_variables()
    f.solve_eig()

    idx = np.argmax(np.imag(f.eigv))
    #print idx
    eigv_sel[i] = f.eigv[idx]

    f.adjoint_spectrum('cont')
    f.solve_eig_adj()
    f.save_sim("temp")
    om = sn.sensitivity("temp", idx, show_f=False)
    #norm_guRe[i], norm_guIm[i], norm_gcdRe[i], norm_gcdIm[i] = om.c_per(obj='norm')
    norm_guRe[i], norm_guIm[i], norm_gK11Re[i], norm_gK11Im[i], norm_gK22Re[i], norm_gK22Im[i] = om.c_per(obj='norm')


file_name = option['flow'][-5]+"_"+str(option['Re'])

np.savez('norm_alpha_'+file_name, alpha=a, norm_guRe=norm_guRe, norm_guIm=norm_guIm, norm_gK11Re=norm_gK11Re, norm_gK11Im=norm_gK11Im, norm_gK22Re=norm_gK22Re, norm_gK22Im=norm_gK22Im)

#header = 'alpha  Gu_r  Gu_i  Gcd_r  Gcd_i'
#np.savetxt('norm_alpha'+name_file+'.txt' ,np.transpose([a, norm_guRe, norm_guIm, norm_gcdRe, norm_gcdIm]), fmt='%.4e', delimiter=' ', newline='\n', header=header)

fig, ay  =  plt.subplots(dpi = 100)
lines = ay.plot(a, norm_guRe, 'r', a, norm_guIm, 'g', a, norm_gK11Re, 'm', a, norm_gK11Im, 'y', a, norm_gK22Re, 'g', a, norm_gK22Im, 'c', lw = 2)
#ay.set_ylabel(r'$c_i$',fontsize = 32)
ay.set_xlabel(r'$\alpha$',fontsize = 32)
Example #5
0
# f.set_hyptan()
# f.set_poiseuille()

f.set_operator_variables()

f.solve_eig()
f.adjoint_spectrum('cont')
f.solve_eig_adj()


file_name = option['flow'][-5]+"_"+str(option['Re'])

f.save_sim(file_name)
#f.check_adj()


v = po.viz(file_name)
v.plot_velocity()
v.plot_spectrum()

#f.omega_alpha_curves(0.1, 1, 20, 0.9, 1.1, 'G_RE_1e5')

idx = np.argmax(np.imag(f.eigv))
om = sn.sensitivity(file_name, idx, show_f=False)
a, b, c, d, e, g= om.c_per(obj='norm')
print (a, b, c,d, e, g)

f.omega_alpha_curves(0.1, 1, 20, 0.5, 1.4, name_file=file_name)
#om.sens_spectrum('ke_cd_N001_puv.png', 1e-7, 1e-4, 189, obj='u', shape='gauss') # eps, gamma
#om.validation(1, 1e-7, 1e-4, idx, 'gauss')
Example #6
0
    f.diff_matrix()
    f.integ_matrix()
    f.read_velocity_profile()
    f.mapping()
    f.interpolate()
    f.set_operator_variables()
    f.solve_eig()

    idx = np.argmax(np.imag(f.eigv))
    #print idx
    eigv_sel[i] = f.eigv[idx]

    f.adjoint_spectrum('cont')
    f.solve_eig_adj()
    f.save_sim("temp")
    om = sn.sensitivity("temp", idx, show_f=False)
    #norm_guRe[i], norm_guIm[i], norm_gcdRe[i], norm_gcdIm[i] = om.c_per(obj='norm')
    norm_guRe[i], norm_guIm[i], norm_gK11Re[i], norm_gK11Im[i], norm_gK22Re[
        i], norm_gK22Im[i] = om.c_per(obj='norm')

file_name = option['flow'][-5] + "_" + str(option['Re'])

np.savez('norm_alpha_' + file_name,
         alpha=a,
         norm_guRe=norm_guRe,
         norm_guIm=norm_guIm,
         norm_gK11Re=norm_gK11Re,
         norm_gK11Im=norm_gK11Im,
         norm_gK22Re=norm_gK22Re,
         norm_gK22Im=norm_gK22Im)
Example #7
0
f = sa.fluid(option)
f.diff_matrix()
f.set_couette()
f.integ_matrix()

f.set_operator_variables()

f.solve_eig()
f.adjoint_spectrum_v_eta('disc')
f.solve_eig_adj()

f.save_sim('cou_disc')
f.check_adj()

# In[13]:

v = po.viz('cou_disc.npz')
v.plot_velocity()
v.plot_spectrum()

# In[14]:

om = sn.sensitivity(0.00001, 'cou_disc.npz', 378)
#om.u_pert(0.4, 0.2)
#om.cd_pert(0.5, 0.1)
#om.c_per()

#om.sens_spectrum('ke_u_N01_ve.png', per_variab='u')
om.validation(0, 0.01, 378)
Example #8
0
f.diff_matrix()
f.set_couette()
f.integ_matrix()

f.set_operator_variables()

f.solve_eig()
f.adjoint_spectrum_v_eta('disc')
f.solve_eig_adj()

f.save_sim('cou_disc')
f.check_adj()


# In[13]:

v = po.viz('cou_disc.npz')
v.plot_velocity()
v.plot_spectrum()


# In[14]:

om = sn.sensitivity(0.00001, 'cou_disc.npz', 378)
#om.u_pert(0.4, 0.2)
#om.cd_pert(0.5, 0.1)
#om.c_per()

#om.sens_spectrum('ke_u_N01_ve.png', per_variab='u')
om.validation(0, 0.01, 378)
Example #9
0
f.solve_eig()
f.adjoint_spectrum_v_eta('disc')
f.solve_eig_adj()

f.save_sim('200_puv_disc')
#f.check_adj()


v = po.viz('200_puv_disc.npz')
v.plot_velocity()
v.plot_spectrum()
#  f.omega_alpha_curves(0.0001,2,5

idx = np.argmax(np.imag(f.eigv))
om = sn.sensitivity('200_puv_disc.npz', idx)
om.c_per(obj='norm')

#om.sens_spectrum('ke_cd_N001_puv.png', 1e-3, 1e-2, obj='u', shape='sin') # eps, gamma
#om.validation(1, 1e-2, 1, 17, 'tanh')




"""
# PROCEDURE TO ANALYZE THE SINGLE MODES IN THE SPECTRUM
# it needs to be implemented in the "fluid" class and generalyzed in the
# interface

a = np.linspace(0.0001,2,50)
omega_sel = np.zeros(len(a))