Beispiel #1
0
    def create_pinv_matrix_and_vector_2(self, mult=1.0, case_id=0):
        cases = {}
        cases[0] = 'case_18'
        cases[1] = 'case_800'
        matrices_path = pyfeti_dir(
            os.path.join('cases', 'matrices', cases[case_id]))
        K = load_object(os.path.join(matrices_path, 'K.pkl'))
        B1 = load_object(os.path.join(matrices_path, 'B_left.pkl'))
        B2 = load_object(os.path.join(matrices_path, 'B_right.pkl'))

        ones = np.ones(B1.shape[0])

        f = B2.T.dot(ones) - B1.T.dot(ones)

        R = scipy.linalg.null_space(K.A)
        Pr = (np.eye(f.shape[0]) - R.dot(R.T))
        fr = Pr.dot(f)

        null_space_force = R.T.dot(fr)

        return K, mult * fr
Beispiel #2
0
def get_case_matrices(case_id):
    case_path = pyfeti_dir(os.path.join('cases/matrices', case_dict[case_id]))
    K = load_object(os.path.join(case_path, 'K.pkl'))
    f = load_object(os.path.join(case_path, 'f.pkl'))
    B_left = load_object(os.path.join(case_path, 'B_left.pkl'))
    B_right = load_object(os.path.join(case_path, 'B_right.pkl'))
    B_bottom = load_object(os.path.join(case_path, 'B_bottom.pkl'))
    B_top = load_object(os.path.join(case_path, 'B_top.pkl'))
    s = load_object(os.path.join(case_path, 'selectionOperator.pkl'))
    return K, f, B_left, B_right, B_bottom, B_top, s
Beispiel #3
0
def read_solution(solution_path):
    ''' read solution file
    '''
    solution_obj = load_object(solution_path,tries=1,)

    return solution_obj
Beispiel #4
0
Nsectors = 24
domain_label = 4
cyclic_left_label = 3
cyclic_right_label = 2
dirichlet_label = 1
unit = 'deg'
tol_radius = 1.0e-5
dimension = 3

mesh_file = 'meshes/3d_simple_bladed_disk_24_sector.msh'
mesh_file = 'meshes/3D_simple_bladed_disk_24_sectors_course_v3.inp'
mesh_file = 'meshes/3D_simple_bladed_disk_24_sectors_1524_nodes.inp'
mesh_file = 'meshes/3D_simple_bladed_disk_24_sectors_2649_nodes.inp'
#mesh_file = 'meshes/3D_simple_bladed_disk_24_sectors_16480_nodes.inp'
#m1 = load_object('3D_simple_bladed_disk_24_sectors_1524_nodes.pkl')
m1 = load_object('3D_simple_bladed_disk_24_sectors_512_nodes.pkl')
#m1.import_msh(mesh_file)
#m1.import_inp(mesh_file,scale)
#save_object(m1,'3D_simple_bladed_disk_24_sectors_2649_nodes')


def plot1(m1):
    ax1 = amfe.plot3Dmesh(m1, boundaries=False)
    bc = np.array([-200, 200])
    ax1.set_xlim(bc)
    ax1.set_ylim(bc)
    ax1.set_zlim(bc)
    plt.show()


def plot_mesh_list(mesh_list):
Beispiel #5
0
def load_pkl(variable_name):
    return load_object(filepath(variable_name))
Beispiel #6
0
            logging.info('Setting a new log level = %i ' % new_loglevel)
            looger.setLevel(new_loglevel)

        logging.info(header)
        logging.info('MPI rank %i' % rank)
        logging.info('Directory pass to MPI solver = %s' % os.getcwd())
        localtime = localtime = time.asctime(time.localtime(time.time()))
        start_time = time.time()
        logging.info('Time at start: %s' % localtime)
        logging.info(header)

        case_path = mpi_kwargs['prefix'] + str(obj_id) + mpi_kwargs['ext']
        logging.info('Local object name passed to MPI solver = %s' % case_path)

        start_time_load = time.time()
        local_problem = load_object(case_path)
        elapsed_time = time.time() - start_time_load
        logging.info('{"load_object": %2.5e} # Elapsed time in seconds' %
                     elapsed_time)

        start_time = time.time()
        parsolver = LocalSolverManager(obj_id, local_problem, **mpi_kwargs)
        u_i = parsolver.mpi_solver()

        comm.Barrier()
        elapsed_time = time.time() - start_time

        logging.info(
            'Total Parallel solver elapsed time after loading data : %f' %
            elapsed_time)
Beispiel #7
0
        shape=M.shape, matvec=lambda x: system(x, tol=FETI_tolerance))

    print_date('Solving Projected Dual Eigenproblem')
    eigval, V = sparse.linalg.eigsh(D, k=nmodes, v0=P.dot(u0))

    freq_dual, V = eig2freq(eigval, V)

    save_pkl(V, '%i_cyclic_V.pkl' % tol_factor)
    save_pkl(freq_dual, '%i_cyclic_freq_dual.pkl' % tol_factor)

    freq_list = [freq_dual, freq_dual_wp_]
    V_list = [V, V_wp_]
    return freq_list, V_list


system_list = load_object('case_512/system_list.pkl')
global2local_primal_dofs = load_object('case_512/global2local_primal_dofs.pkl')
#B = load_pkl('B.pkl')
K = load_pkl('K.pkl')
M = load_pkl('M.pkl')
L = load_pkl('L.pkl')
Lexp = load_pkl('Lexp.pkl')
K_dict = load_pkl('K_dict.pkl')
M_dict = load_pkl('M_dict.pkl')
B_dict = load_pkl('B_dict.pkl')
f_dict = load_pkl('f_dict.pkl')

B_new_dict = B_dict.copy()
for domain_id, B_local in B_dict.items():
    for pair, Bij in B_local.items():
        local_id, nei_id = pair
Beispiel #8
0
import sys
import os

sys.path.append('../..')
cases_folder = os.path.dirname(os.path.realpath(__file__))
casefiles_folder = os.path.join(cases_folder, 'case1files')
sys.path.append(cases_folder)
sys.path.append(casefiles_folder)

from pyfeti.src.utils import load_object

K1 = load_object(os.path.join(casefiles_folder, 'K1.pkl'))
K2 = load_object(os.path.join(casefiles_folder, 'K2.pkl'))
B1_dict = load_object(os.path.join(casefiles_folder, 'B1_dict.pkl'))
B2_dict = load_object(os.path.join(casefiles_folder, 'B2_dict.pkl'))
global_to_local_dict_1 = load_object(
    os.path.join(casefiles_folder, 'global2local_1.pkl'))
global_to_local_dict_2 = load_object(
    os.path.join(casefiles_folder, 'global2local_2.pkl'))
dofs_dict = load_object(os.path.join(casefiles_folder, 'dofs_dict.pkl'))
map_dofs = load_object(os.path.join(casefiles_folder, 'map_dofs.pkl'))
K_global = load_object(os.path.join(casefiles_folder, 'K_global.pkl'))[0]
Beispiel #9
0
import os

def translator(string): 
    
    if string[0] == 'F':
        return int(string.split('_')[0][3:])
    elif string[0] == 'S':
        return int('99'.join(string.split('_')[2:4]))
    else:
        return 0


disk_mesh_file = 'disk_sector'
folder = 'meshes'

m2 = load_object(os.path.join(folder, disk_mesh_file + '.pkl'),tries=1)
if m2 is None:
    sector_mesh_file = os.path.join(folder, disk_mesh_file + '.inp')
    m2 = amfe.Mesh()
    m2.import_inp(sector_mesh_file)

    count=1
    for name in m2.get_phys_group_types():
        m2.change_tag_in_eldf('phys_group',name,translator(name))
        count+=1
    save_object(m2,os.path.join(folder, disk_mesh_file + '.pkl'))


blade_mesh_file = 'blade_sector'
m3 = load_object(os.path.join(folder, blade_mesh_file + '.pkl'),tries=1)
if m3 is None: