import dmd_m as dmd
import io_vtk_m as io_vtk

#-----------------------------------------------------------------------
print '\n--------------------------------------------------------------'
print 'Running', sys.argv[0]
print '   This code calculates DMD and POD modes from a series of snapshots.'

if not os.path.exists('./results'):
	os.mkdir('./results')

print 'Reading input deck ...'
snapshot_dir, snapshot_list_file_name, dt, cell_volume_file_name, correct_for_cell_volumes, subtract_mean, \
	num_components, x_min, x_max, y_min, y_max, z_min, z_max, num_modes_trunc, num_modes_to_write, write_matrices, \
	test_POD_orthogonality, test_DMD_biorthogonality, test_stochastic_mode_orthogonality, tol_CN, tol_ortho, var_name,\
	restart_flag, restart_dir = input_deck.read_deck("calculate_pod_dmd_modes.in")

print '\n--------------------------------------------------------------'
print 'Building snapshot matrix ...'
fin = open(snapshot_dir + snapshot_list_file_name,'r')
file_list = list()
file_list = fin.readlines()
fin.close()
num_snapshots = len(file_list) - 1
print '   Number of snapshots = ', num_snapshots

grid = vtk.vtkUnstructuredGrid()
if (correct_for_cell_volumes=="true"):
	io_vtk.get_grid_template(x_min,x_max,y_min,y_max,z_min,z_max,snapshot_dir+cell_volume_file_name,grid)
	num_points = grid.GetNumberOfPoints()
	cell_volume = np.array(np.zeros((num_points), dtype=np.float64))
Example #2
0
import input_deck_m as input_deck
import rom_m as rom

#-----------------------------------------------------------------------
# Main program

print '\n-----------------------------------------------------------------------'
print 'Running ', sys.argv[0]
print '-----------------------------------------------------------------------\n'

if not os.path.exists('./results'):
    os.mkdir('./results')

#-----------------------------------------------------------------------
print "Reading input deck ...\n"
dt, num_modes, num_timesteps, pod_mode_dir, rom_coefficient_dir = input_deck.read_deck(
    "integrate_rom.in")

a = np.array(np.zeros((num_modes, num_timesteps), dtype=np.float64))
da_dt = np.array(np.zeros((num_modes, num_timesteps), dtype=np.float64))
constant = np.array(np.zeros((num_modes), dtype=np.float64))
linear = np.array(np.zeros((num_modes, num_modes), dtype=np.float64))
quadratic = np.array(
    np.zeros((num_modes, num_modes, num_modes), dtype=np.float64))

#-----------------------------------------------------------------------
print "Reading initial conditions and coefficients ...\n"
rom.read_initial_conditions(pod_mode_dir, num_modes, a[:, 0])
rom.read_constant_coefficients(rom_coefficient_dir, num_modes, constant)
rom.read_linear_coefficients(rom_coefficient_dir, num_modes, linear)
rom.read_quadratic_coefficients(rom_coefficient_dir, num_modes, quadratic)
import navier_stokes_m as ns 
import group_modes_m as gm 
import io_m as io

#=======================================================================
print '\n======================================================================='
print 'Running ', sys.argv[0] 
print '=======================================================================\n'

#=======================================================================
print '\nReading input deck ...'
run_type, equations, N, scale_domain, base_flow, base_flow_file, tol, max_iter, min_iter, \
	domain_size, half_grid_point, shear_layer_conv_u, u_deficit, wake_half_width,\
	top_BC, bottom_BC, Re, 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, num_modes_to_write, \
	dt, num_time_steps, x_pos0, x_posN = input_deck.read_deck("local_linear_stability.in")

if not os.path.exists('./results'):
        os.mkdir('./results')
if not os.path.exists('./images'):
        os.mkdir('./images')

#=======================================================================
print '\nAllocating memory ...'
kx = np.array(np.zeros((N_kx_real,N_kx_imag), dtype=np.complex))	# streamwise wavenumber set
kz = np.array(np.zeros((N_kz_real), dtype=np.complex))			# spanwise wavenumber set
u = np.array(np.zeros((N+1), dtype=np.float))				# baseflow velocity
u_y = np.array(np.zeros((N+1), dtype=np.float))				# baseflow velocity first wall normal derivative
u_yy = np.array(np.zeros((N+1), dtype=np.float))			# baseflow velocity second wall normal derivative
eta = np.array(np.zeros((N+1), dtype=np.float))				# chebyshev collocation grid
D1 = np.array(np.zeros((N+1,N+1), dtype=np.float))			# chebyshev 1st derivative matrix
import os
import numpy as np
import input_deck_m as input_deck
import rom_coefficients_m as rom_coefficients

#-----------------------------------------------------------------------
# Main program
print '\n-----------------------------------------------------------------------'
print 'Running ', sys.argv[0]
print '-----------------------------------------------------------------------\n'
if not os.path.exists('./results'):
    os.mkdir('./results')

#-----------------------------------------------------------------------
print "Reading input deck ..."
Re, correct_for_cell_volumes, calibrate_coefficients, interp_factor, num_snapshots, num_components, num_dimensions, num_modes, pod_mode_dir = input_deck.read_deck(
    "calculate_rom_coefficients.in")

#-----------------------------------------------------------------------
print "\nReading data ..."

constant = np.array(np.zeros((num_modes), dtype=np.float64))
linear = np.array(np.zeros((num_modes, num_modes), dtype=np.float64))
quadratic = np.array(
    np.zeros((num_modes, num_modes, num_modes), dtype=np.float64))

if (calibrate_coefficients != "temporal"):
    num_points, num_boundary_faces = rom_coefficients.get_number_of_points_and_boundary_faces(
        pod_mode_dir, calibrate_coefficients)
    print '   Number of points = ', num_points
    print '   Number of boundary faces = ', num_boundary_faces
import input_deck_m as input_deck
import rom_m as rom

#-----------------------------------------------------------------------
# Main program

print '\n-----------------------------------------------------------------------'
print 'Running ', sys.argv[0]
print '-----------------------------------------------------------------------\n'

if not os.path.exists('./results'):
        os.mkdir('./results')

#-----------------------------------------------------------------------
print "Reading input deck ...\n"
dt, num_modes, num_timesteps, pod_mode_dir, rom_coefficient_dir = input_deck.read_deck("integrate_rom.in")

a = np.array(np.zeros((num_modes,num_timesteps), dtype=np.float64))
da_dt = np.array(np.zeros((num_modes,num_timesteps), dtype=np.float64))
constant = np.array(np.zeros((num_modes), dtype=np.float64))
linear = np.array(np.zeros((num_modes,num_modes), dtype=np.float64))
quadratic = np.array(np.zeros((num_modes,num_modes,num_modes), dtype=np.float64))

#-----------------------------------------------------------------------
print "Reading initial conditions and coefficients ...\n"
rom.read_initial_conditions(pod_mode_dir,num_modes,a[:,0])
rom.read_constant_coefficients(rom_coefficient_dir,num_modes,constant)
rom.read_linear_coefficients(rom_coefficient_dir,num_modes,linear)
rom.read_quadratic_coefficients(rom_coefficient_dir,num_modes,quadratic)

#-----------------------------------------------------------------------
Example #6
0
import dmd_m as dmd
import io_vtk_m as io_vtk

#-----------------------------------------------------------------------
print '\n--------------------------------------------------------------'
print 'Running', sys.argv[0]
print '   This code calculates DMD and POD modes from a series of snapshots.'

if not os.path.exists('./results'):
    os.mkdir('./results')

print 'Reading input deck ...'
snapshot_dir, snapshot_list_file_name, dt, cell_volume_file_name, correct_for_cell_volumes, subtract_mean, \
 num_components, x_min, x_max, y_min, y_max, z_min, z_max, num_modes_trunc, num_modes_to_write, write_matrices, \
 test_POD_orthogonality, test_DMD_biorthogonality, test_stochastic_mode_orthogonality, tol_CN, tol_ortho, var_name,\
 restart_flag, restart_dir = input_deck.read_deck("calculate_pod_dmd_modes.in")

print '\n--------------------------------------------------------------'
print 'Building snapshot matrix ...'
fin = open(snapshot_dir + snapshot_list_file_name, 'r')
file_list = list()
file_list = fin.readlines()
fin.close()
num_snapshots = len(file_list) - 1
print '   Number of snapshots = ', num_snapshots

grid = vtk.vtkUnstructuredGrid()
if (correct_for_cell_volumes == "true"):
    io_vtk.get_grid_template(x_min, x_max, y_min, y_max, z_min, z_max,
                             snapshot_dir + cell_volume_file_name, grid)
    num_points = grid.GetNumberOfPoints()
Example #7
0
import navier_stokes_m as ns
import group_modes_m as gm
import io_m as io

#=======================================================================
print '\n======================================================================='
print 'Running ', sys.argv[0]
print '=======================================================================\n'

#=======================================================================
print '\nReading input deck ...'
run_type, equations, N, scale_domain, base_flow, base_flow_file, tol, max_iter, min_iter, \
 domain_size, half_grid_point, shear_layer_conv_u, u_deficit, wake_half_width,\
 top_BC, bottom_BC, Re, 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, num_modes_to_write, \
 dt, num_time_steps, x_pos0, x_posN = input_deck.read_deck("local_linear_stability.in")

if not os.path.exists('./results'):
    os.mkdir('./results')
if not os.path.exists('./images'):
    os.mkdir('./images')

#=======================================================================
print '\nAllocating memory ...'
kx = np.array(np.zeros((N_kx_real, N_kx_imag),
                       dtype=np.complex))  # streamwise wavenumber set
kz = np.array(np.zeros((N_kz_real),
                       dtype=np.complex))  # spanwise wavenumber set
u = np.array(np.zeros((N + 1), dtype=np.float))  # baseflow velocity
u_y = np.array(np.zeros(
    (N + 1), dtype=np.float))  # baseflow velocity first wall normal derivative
import numpy as np
import input_deck_m as input_deck
import rom_coefficients_m as rom_coefficients

# -----------------------------------------------------------------------
# Main program
print "\n-----------------------------------------------------------------------"
print "Running ", sys.argv[0]
print "-----------------------------------------------------------------------\n"
if not os.path.exists("./results"):
    os.mkdir("./results")

# -----------------------------------------------------------------------
print "Reading input deck ..."
Re, correct_for_cell_volumes, calibrate_coefficients, interp_factor, num_snapshots, num_components, num_dimensions, num_modes, pod_mode_dir = input_deck.read_deck(
    "calculate_rom_coefficients.in"
)

# -----------------------------------------------------------------------
print "\nReading data ..."

constant = np.array(np.zeros((num_modes), dtype=np.float64))
linear = np.array(np.zeros((num_modes, num_modes), dtype=np.float64))
quadratic = np.array(np.zeros((num_modes, num_modes, num_modes), dtype=np.float64))

if calibrate_coefficients != "temporal":
    num_points, num_boundary_faces = rom_coefficients.get_number_of_points_and_boundary_faces(
        pod_mode_dir, calibrate_coefficients
    )
    print "   Number of points = ", num_points
    print "   Number of boundary faces = ", num_boundary_faces