def generate_base_flow(base_flow,scale_domain,tol,max_iter,min_iter,shear_layer_conv_u,wake_half_width,u_deficit,base_flow_file,\
   domain_size,half_grid_point,x_pos0,x_posN,eta,D1,D2,D3,D4,u,u_y,u_yy,Re):
    if (base_flow == "couette"):
        generate_couette_profile(eta, u, u_y, u_yy)
    elif (base_flow == "poiseuille"):
        generate_poiseuille_profile(eta, u, u_y, u_yy)
    elif (base_flow == "turbulent_channel"):
        generate_turbulent_channel_profile(eta, u, u_y, u_yy)
    elif (base_flow == "blasius"):
        generate_blasius_profile(tol, max_iter, min_iter, eta, D1, D2, D3, u,
                                 u_y, u_yy)
    elif (base_flow == "shear_layer"):
        generate_shear_layer_profile(shear_layer_conv_u, eta, u, u_y, u_yy)
    elif (base_flow == "wake"):
        generate_wake_profile(wake_half_width, u_deficit, eta, u, u_y, u_yy)
    elif (base_flow == "file_u"):
        read_from_file(1, base_flow_file, eta, u, u_y, u_yy)
    elif (base_flow == "file_u_y"):
        read_from_file(2, base_flow_file, eta, u, u_y, u_yy)
    elif (base_flow == "file_u_yy"):
        read_from_file(3, base_flow_file, eta, u, u_y, u_yy)
    elif (base_flow == "file_ascii_channel_DNS"):
        read_ascii_channel_DNS_from_file(base_flow_file, eta, u, u_y, u_yy)
    elif (base_flow == "file_hdf5_TBL_DNS"):
        read_hdf5_TBL_DNS_from_file(base_flow_file, x_pos0, x_posN, eta, u,
                                    u_y, u_yy, Re)
    io.write_base_flow(eta, u, u_y, u_yy)
    io.plot_base_flow(eta, u, u_y, u_yy)
    return
def generate_base_flow(base_flow,scale_domain,tol,max_iter,min_iter,shear_layer_conv_u,wake_half_width,u_deficit,base_flow_file,\
			domain_size,half_grid_point,x_pos0,x_posN,eta,D1,D2,D3,D4,u,u_y,u_yy,Re):
        if (base_flow == "couette"):
                generate_couette_profile(eta,u,u_y,u_yy)
        elif (base_flow == "poiseuille"):
                generate_poiseuille_profile(eta,u,u_y,u_yy)
        elif (base_flow == "turbulent_channel"):
                generate_turbulent_channel_profile(eta,u,u_y,u_yy)
        elif (base_flow == "blasius"):
                generate_blasius_profile(tol,max_iter,min_iter,eta,D1,D2,D3,u,u_y,u_yy)
        elif (base_flow == "shear_layer"):
                generate_shear_layer_profile(shear_layer_conv_u,eta,u,u_y,u_yy)
        elif (base_flow == "wake"):
                generate_wake_profile(wake_half_width,u_deficit,eta,u,u_y,u_yy)
        elif (base_flow == "file_u"):
                read_from_file(1,base_flow_file,eta,u,u_y,u_yy)
        elif (base_flow == "file_u_y"):
               	read_from_file(2,base_flow_file,eta,u,u_y,u_yy)
        elif (base_flow == "file_u_yy"):
               	read_from_file(3,base_flow_file,eta,u,u_y,u_yy)
        elif (base_flow == "file_ascii_channel_DNS"):
                read_ascii_channel_DNS_from_file(base_flow_file,eta,u,u_y,u_yy)
        elif (base_flow == "file_hdf5_TBL_DNS"):
                read_hdf5_TBL_DNS_from_file(base_flow_file,x_pos0,x_posN,eta,u,u_y,u_yy,Re)
	io.write_base_flow(eta,u,u_y,u_yy)
	io.plot_base_flow(eta,u,u_y,u_yy)
	return
	Nev = 2*(N+1)							# dimension of vorticity formulation eigenvalue operators

#=======================================================================
print '\nGenerating grid and Chebyshev matrices ...'
cheb.generate_grid_and_derivative_matrices(eta,D1,D2,D3,D4)
cheb.generate_chebyshev_integral_weights(N,IW)
cheb.scale_domain_and_derivatives(scale_domain,domain_size,half_grid_point,eta,D1,D2,D3,D4)

print '\nGenerating wavenumber set ...'
ns.generate_wavenumber_sets(kx_real_min, kx_real_max, N_kx_real, kx_imag_min, kx_imag_max, N_kx_imag,\
		                  N_kz_real, kz_real_max, kz_real_min, kz_imag, kx, kz)

if (run_type=="write_grid"):
        print "\nWriting grid to file ..."
	io.write_base_flow(eta,u,u_y,u_yy)
	io.plot_base_flow(eta,u,u_y,u_yy)
        print "\nInterpolate field onto this grid and write profile in the same format."
        print "Re-run the stability code with 'run_type = stability_analysis'\n"

elif (run_type=="stability_analysis"):
	print '\nGenerating base flow ...'
	bf.generate_base_flow(base_flow,scale_domain,tol,max_iter,min_iter,shear_layer_conv_u,wake_half_width,u_deficit,base_flow_file,\
				domain_size,half_grid_point,x_pos0,x_posN,eta,D1,D2,D3,D4,u,u_y,u_yy,Re)
	print '\nBuilding linear operators and solving the eigenvalue problem ...'
	ns.run_stability_analysis(Nev,N_kx_real,N_kx_imag,N_kz_real,kx,kz,equations,\
					eta,u,u_y,u_yy,Re,D1,D2,D4,top_BC,bottom_BC,num_modes_to_write)
	if (N_kx_real*N_kx_imag*N_kz_real>1):
        	print "To group the eigenvalues into like modes re-run the stability code with 'run_type = group_modes'\n"

elif (run_type=="group_modes"):
	print '\nGrouping eigenvalues into modes ...'
예제 #4
0
#=======================================================================
print '\nGenerating grid and Chebyshev matrices ...'
cheb.generate_grid_and_derivative_matrices(eta, D1, D2, D3, D4)
cheb.generate_chebyshev_integral_weights(N, IW)
cheb.scale_domain_and_derivatives(scale_domain, domain_size, half_grid_point,
                                  eta, D1, D2, D3, D4)

print '\nGenerating wavenumber set ...'
ns.generate_wavenumber_sets(kx_real_min, kx_real_max, N_kx_real, kx_imag_min, kx_imag_max, N_kx_imag,\
                    N_kz_real, kz_real_max, kz_real_min, kz_imag, kx, kz)

if (run_type == "write_grid"):
    print "\nWriting grid to file ..."
    io.write_base_flow(eta, u, u_y, u_yy)
    io.plot_base_flow(eta, u, u_y, u_yy)
    print "\nInterpolate field onto this grid and write profile in the same format."
    print "Re-run the stability code with 'run_type = stability_analysis'\n"

elif (run_type == "stability_analysis"):
    print '\nGenerating base flow ...'
    bf.generate_base_flow(base_flow,scale_domain,tol,max_iter,min_iter,shear_layer_conv_u,wake_half_width,u_deficit,base_flow_file,\
       domain_size,half_grid_point,x_pos0,x_posN,eta,D1,D2,D3,D4,u,u_y,u_yy,Re)
    print '\nBuilding linear operators and solving the eigenvalue problem ...'
    ns.run_stability_analysis(Nev,N_kx_real,N_kx_imag,N_kz_real,kx,kz,equations,\
        eta,u,u_y,u_yy,Re,D1,D2,D4,top_BC,bottom_BC,num_modes_to_write)
    if (N_kx_real * N_kx_imag * N_kz_real > 1):
        print "To group the eigenvalues into like modes re-run the stability code with 'run_type = group_modes'\n"

elif (run_type == "group_modes"):
    print '\nGrouping eigenvalues into modes ...'