#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Apr 12 17:27:27 2017 @author: rg The module for simulation of temperature distribution in non-stationary (dynamical) regime for linear case The linear non-stationary Fourier Equation for N-layer Wall for different geometries: Planar, cylindrical, spherical """ from nLayerWall_1_0 import EPSILOC8, EPSILOC10, EPSILOC11, NBETA_ACT_d, CONV_ANA, SET_BETA_NN, Contact_Res_ana, \ str_gap_list, recalc_only_fl, air_gap_list_num, str_gap_list1, position_res, air_gap_list3_first, \ air_gap_list3_last, air_gap_list3_all, air_gap_list3_x12, position_x12_res from nLayerWall_1_0.classpack.wall_class import WallPlane #from nLayerWall_1_0.iopack.io_class import InputOutputClass #PlotClass1, #UtilCalc, SumSolve, from nLayerWall_1_0.plotpack.plot_class import PlotComp from nLayerWall_1_0.utils.util_class import DataSolve from nLayerWall_1_0.utils.estimate_class import LsEstim from nLayerWall_1_0.utils.wall_fun import error_calc from copy import deepcopy #from nLayerWall_1_0.utils.util_class import UtilBeta import numpy as np #from matplotlib.ticker import AutoMinorLocator #import numpy as np #from scipy import integrate #from nLayerWall_1_0.plotpack.plot_class import PlotClass1 #test_dict_1_temp, test_dict_1_flux, from nLayerWall_1_0.testcheck.super_test import TestBeta, SolutionTest from nLayerWall_1_0 import input_mat_dict, input_dictionary0, input_dictionary1, input_dictionary2, input_dictionary3,\ input_dictionary00, rooth_globals, input_data_files, which_test, test_data, sol_test_dict, \ i_fig0, eigen_dict, u_dict, steady_dict0, calc_dict, plot_dict, fluent_dict, test_dict0, \ solution_titles, test_dict_0_temp, test_dict_0_flux, io_dict0, estim_dict, start_sample, \ SEC_HOUR # , data_type import time import gc import sys #import os #import sys #import pickle #-------------------- Read input Data----------------------------------------------------------------------------------- path = rooth_globals['__path__'][0] data_sol1 = DataSolve( calc_dict, fluent_dict, input_file = input_data_files, fluent_file = fluent_dict['fluent_file'], data_path = path, test_dict = [test_dict_0_temp, test_dict_0_flux], steady_dict = steady_dict0, io_dict = io_dict0, estim_dict_ext = estim_dict ) #, data_type_ext = data_type fluent_fl_00 = False #------------------- Read Fluent Data----------------------------------------------------------------------------------- if data_sol1.fluent_dict['test_fluent'] or data_sol1.fluent_dict['test_fluent_read'] : fluent_fl_00 = True data_sol1.read_solve ( 2 ) #sys.exit(0) #------------------- Read Measured Data--------------------------------------------------------------------------------- data_folder = input_data_files['data_folder'] data_sol1.read_solve ( 1, folder_name = data_folder ) #----------------------------------------------------------------------------------------------------------------------- plot_comp1 = PlotComp (plot_dict, eigen_dict, u_dict, steady_dict0, test_dict0) #print ('=====================================================') #print ('calc_dict = ', data_sol1.calc_dict['test_case']) #print ('plot_input_fl = ', data_sol1.calc_dict['plot_input_fl'] ) #print ('=====================================================') #===========================P L O T M E A S U R E M E T D A T A ==================================================== if data_sol1.calc_dict['plot_input_fl'] and not data_sol1.calc_dict['test_case'] : # print ('=====================================================') # print ('calc_dict = ', data_sol1.calc_dict['test_case']) # print ('me_plot[1] = ', plot_comp1.plot_dict['me_plot'][1]) # print ('=====================================================') i_fig0 = plot_comp1 (data_sol1, i_fig0, plot_comp1.plot_dict['me_plot'][1] ) elif data_sol1.calc_dict['plot_input_fl'] and data_sol1.calc_dict['test_case'] : i_fig0 = plot_comp1 (data_sol1, i_fig0, plot_comp1.plot_dict['me_plot'][2] ) #======================================================================================================================= #sys.exit(0) if not data_sol1.io_dict['read_WallClass'] : if data_sol1.fluent_dict['test_fluent'] : wallpl2 = WallPlane(input_dictionary00) else : #----------- Generate Wall class from input_dict------------------------------------------------------------------------ # print ( '=============================================================================================' ) # print ( 'input_mat_dict = ', input_mat_dict ) # print ( '=============================================================================================' ) wallpl2 = WallPlane(input_mat_dict) # print ( '=============================================================================================' ) # print ('wallpl2.temp10_noalf =' , wallpl2.temp10_noalf ) # print ( '---------------------------------------------------------------------------------------------' ) # print ('wallpl2.temp01_noalf =' , wallpl2.temp01_noalf ) # print ( '---------------------------------------------------------------------------------------------' ) # print ('wallpl2.uu_noalf =' , wallpl2.uu_noalf ) # print ( '---------------------------------------------------------------------------------------------' ) # print ('wallpl2.inv_th_res =' , wallpl2.inv_th_res ) # print ( '=============================================================================================' ) if recalc_only_fl : print ('==================recalculation_procedure_only_started==========================') nn_wall =len(input_mat_dict['tickness']) wall_file_00 = data_sol1.io_dict['wall_file'][1] index_gap = 0 for air_gap_num, str_gap_act in zip( air_gap_list_num, str_gap_list1 ) : data_sol1.io_dict['wall_file'][1] = wall_file_00 + '_contact_res_' + str_gap_act + position_res if position_res == '_first' : air_gap_list3 = [air_gap_num] + [0.0] * ( nn_wall - 2 ) elif position_res == '_last' : air_gap_list3 = [0.0]*( nn_wall - 2 ) + [air_gap_num] elif position_res == '_all' : air_gap_list3 = [air_gap_num] * ( nn_wall - 1) elif any((position_res == '_12', position_res == '_23', position_res == '_34', position_res == '_45')) : air_gap_list3 = [0.0] * ( nn_wall - 1) air_gap_list3[position_x12_res - 1] = air_gap_num print ('---------------------------------------------------------------------------------------------------') print ('index_gap, wall_file, air_gap_list3 =', index_gap, data_sol1.io_dict['wall_file'][1], air_gap_list3 ) index_gap += 1 input_mat_dict ['layer_gap'] = air_gap_list3 wallpl2 = WallPlane( input_mat_dict ) wallpl2.calc_dict = data_sol1.calc_dict wallpl2.bc_wall = data_sol1.io_dict['bc_wall'] betaseries_list, nbeta_list, ab_coeff_list, bc_list = wallpl2( print_results = 0 ) data_sol1.wallpl = wallpl2 nn_beta_act = wallpl2.nbeta_d if data_sol1.io_dict['write_WallClass'] : #-------- write wall class instance in .pkl file---------------------- data_sol1.write_solve ( 1 ) print ('==================recalculation_procedure_only_ended==========================') sys.exit(0) wallpl2.calc_dict = data_sol1.calc_dict #---------- Set BC condition (n - Neuman, d - Dirichlet, m - Mixed or combibation)-------------------------------------- # wallpl2.bc_wall = data_sol1.calc_dict['bc_solve'] wallpl2.bc_wall = data_sol1.io_dict['bc_wall'] if data_sol1.calc_dict['filter_type'] == 'LSF' or data_sol1.calc_dict['filter_type'] == 'NO_F' : wallpl2.lsf_calc( alf_par = wallpl2.alf_steady, bc = calc_dict['bc_solve'] ) if data_sol1.calc_dict['filter_type'] == 'NO_F' : wallpl2.smoothing = 0 wallpl2.cut_fl = False wallpl2.lsf = False #--------Generate beta coefficinets and ab coefficients ---------------------------------------------------------------- betaseries_list, nbeta_list, ab_coeff_list, bc_list = wallpl2( print_results = 0 ) # sys.exit(0) data_sol1.wallpl = wallpl2 nn_beta_act = wallpl2.nbeta_d if data_sol1.io_dict['write_WallClass'] : #-------- write wall class instance in .pkl file---------------------- data_sol1.write_solve ( 1 ) else : #-------- read instance of wall class from .pkl file------------------ if Contact_Res_ana : wall_file_00 = data_sol1.io_dict['wall_file'][1] error_1 = [] error_2 = [] error_3 = [] for index, str_gap_name in enumerate ( str_gap_list ) : print ('----------------- index = ', index ) if index != 0 : data_sol1.io_dict['wall_file'][1] = wall_file_00 + '_contact_res_' + str_gap_name + position_res else: data_sol1.io_dict['wall_file'][1] = wall_file_00 + str_gap_name # print ('str_gap_name = ', str_gap_name) wallpl2 = data_sol1.write_solve ( 2 ) wallpl2.calc_dict = data_sol1.calc_dict data_sol1.wallpl = wallpl2 solution_data = data_sol1.read_solve ( 3 ) #----------------------------------------------------------------------------------------------------------------------- if index == 0 : print ('----------------------------------------------------------------------------------------------') print ('wallpl2 = \n' , wallpl2 ) #print ('nbeta_list', nbeta_list ) print ('----------------------------------------------------------------------------------------------') title = ' ' + data_sol1.calc_dict['mode_sol'] if plot_comp1.plot_dict['plot_xt'] == 1: title = title + ' Spatial distribution ' + position_res tq_01 = data_sol1.sol_dat[0][0][:, plot_comp1.plot_dict['nn_plots'][0] ] tq_02 = data_sol1.sol_dat[0][0][:, plot_comp1.plot_dict['nn_plots'][1] ] tq_03 = data_sol1.sol_dat[0][0][:, plot_comp1.plot_dict['nn_plots'][2] ] elif plot_comp1.plot_dict['plot_xt'] == 2: title = title + ' Temporal distribution ' + position_res tq_01 = data_sol1.sol_dat[0][0][plot_comp1.plot_dict['nn_plots'][0], 1441 : ] tq_02 = data_sol1.sol_dat[0][0][plot_comp1.plot_dict['nn_plots'][1], 1441 : ] tq_03 = data_sol1.sol_dat[0][0][plot_comp1.plot_dict['nn_plots'][2], 1441 : ] # print ('------------------------------------------------------------------------------------------') # print (tq_03.shape) # print ('------------------------------------------------------------------------------------------') # sys.exit(0) else: if plot_comp1.plot_dict['plot_xt'] == 1: tq_act_01 = data_sol1.sol_dat[0][0][:, plot_comp1.plot_dict['nn_plots'][0] ] tq_act_02 = data_sol1.sol_dat[0][0][:, plot_comp1.plot_dict['nn_plots'][1] ] tq_act_03 = data_sol1.sol_dat[0][0][:, plot_comp1.plot_dict['nn_plots'][2] ] elif plot_comp1.plot_dict['plot_xt'] == 2: tq_act_01 = data_sol1.sol_dat[0][0][plot_comp1.plot_dict['nn_plots'][0], 1441 : ] tq_act_02 = data_sol1.sol_dat[0][0][plot_comp1.plot_dict['nn_plots'][1], 1441 : ] tq_act_03 = data_sol1.sol_dat[0][0][plot_comp1.plot_dict['nn_plots'][2], 1441 : ] #----------------------------------------------------------------------------------------------------------------------- error_1.append( 100.0 * np.sum( np.abs ( tq_01 - tq_act_01 ) ) / np.sum( np.abs ( tq_01 ) ) ) error_2.append( 100.0 * np.sum( np.abs ( tq_02 - tq_act_02 ) ) / np.sum( np.abs ( tq_02 ) ) ) error_3.append( 100.0 * np.sum( np.abs ( tq_03 - tq_act_03 ) ) / np.sum( np.abs ( tq_03 ) ) ) print ('========================' + title + '=======================================') print ('------------------------------------------------------------------------------------------------------') print ('error_1 =' , error_1) print ('------------------------------------------------------------------------------------------------------') print ('error_2 =' , error_2) print ('------------------------------------------------------------------------------------------------------') print ('error_3 =' , error_3) print ('------------------------------------------------------------------------------------------------------') sys.exit(0) #----------------------------------------------------------------------------------------------------------------------- else : wallpl2 = data_sol1.write_solve ( 2 ) if SET_BETA_NN and NBETA_ACT_d [0] >= 0 : index_nbeta = 0 nn_beta_act = NBETA_ACT_d[ index_nbeta ] wallpl2.nbeta_d = nn_beta_act wallpl2.beta_coeff_d = wallpl2.beta_coeff_d [ : nn_beta_act ] wallpl2.ab_coeff_d = wallpl2.ab_coeff_d [: nn_beta_act , : ] #----------------------------------------------------------------------------------------------------------------------- wallpl2.d10_coeff_d = wallpl2.d10_coeff_d [ : nn_beta_act ] wallpl2.d01_coeff_d = wallpl2.d01_coeff_d [ : nn_beta_act ] #----------------------------------------------------------------------------------------------------------------------- wallpl2.dss10_coeff_d = wallpl2.dss10_coeff_d [ : nn_beta_act ] wallpl2.dss01_coeff_d = wallpl2.dss01_coeff_d [ : nn_beta_act ] #----------------------------------------------------------------------------------------------------------------------- else : nn_beta_act = wallpl2.nbeta_d # sys.exit(0) #----------------------------------------------------------------------------------------------------------------------- wallpl2.calc_dict = data_sol1.calc_dict data_sol1.wallpl = wallpl2 if data_sol1.calc_dict['filter_type'] == 'LSF' : wallpl2.lsf_calc( alf_par = wallpl2.alf_steady, bc = calc_dict['bc_solve'] ) # if calc_dict['new_calc'] : # print ('----------recalculate new Fourier coefficients!!!!!------') # wallpl2.smoothing = input_dictionary00['smoothing'] # wallpl2.cut_fl = input_dictionary00['cut_fl'] # wallpl2.fourier_coeff( bc = calc_dict['bc_solve'], fourier_type = 1 ) #alf_par = wallpl2.alf_steady, bc = calc_dict['bc_solve'] elif data_sol1.calc_dict['filter_type'] == 'NO_F' : wallpl2.smoothing = 0 wallpl2.cut_fl = False wallpl2.no_lsf_calc ( ) print ('--------------------------------------------------------------------------------------------------------------') print ('wallpl2 = \n' , wallpl2 ) #print ('nbeta_list', nbeta_list ) print ('--------------------------------------------------------------------------------------------------------------') #if NBETA_ACT >= 0 : # pass # print ('NBETA_ACT = ', NBETA_ACT ) # print ('wallpl2.nbeta_d = ', wallpl2.nbeta_d ) #sys.exit(0) #if data_sol1.calc_dict['filter_type'] == 'LSF' and not wallpl2.lsf : print ('--------------------------------------------------------------------------------------------------------------') print ('wallpl2.nbeta_d = ' , wallpl2.nbeta_d ) #print ('wallpl2.beta_coeff_d = ' , wallpl2.beta_coeff_d [0:10] ) #print ('wallpl2.beta_coeff_d = ' , wallpl2.beta_coeff_d [10:20] ) #print ('wallpl2.beta_coeff_d = ' , wallpl2.beta_coeff_d [20:30] ) #print ('wallpl2.beta_coeff_d = ' , wallpl2.beta_coeff_d [0:10], wallpl2.beta_coeff_d [-1] ) print ('--------------------------------------------------------------------------------------------------------------') #======================================================================================================================= #print ('wallpl2.cut_fl = ' , wallpl2.cut_fl ) #print ('wallpl2.smoothing = ' , wallpl2.smoothing ) #print('---------------------------------------------------------------------------------------------------------------') #print ( 'f1_lsf [0:10] [-10:-1] =' , wallpl2.f1_lsf[: 10] , wallpl2.f1_lsf [-10:-1] ) #print ( 'f1_lsf [0:10] [-10:-1] =' , wallpl2.f1_lsf[: 10] , wallpl2.f1_lsf [-10:-1] ) #print('---------------------------------------------------------------------------------------------------------------') #print ( 'f2_lsf [0:10] [-10:-1] =' , wallpl2.f2_lsf[: 10] , wallpl2.f2_lsf [-10:-1] ) #print ( 'f2_lsf [10:20] [-20:-10] =' , wallpl2.f2_lsf[10 : 20] , wallpl2.f2_lsf [-20:-10] ) #print('---------------------------------------------------------------------------------------------------------------') #print ( 'f1_lsf [120,240,360] =' , wallpl2.f1_lsf[120] , wallpl2.f1_lsf [240], wallpl2.f1_lsf [360] ) #print ( 'wallpl2.x_lsf1 [120,240,360] =' , wallpl2.x_lsf1[120] , wallpl2.x_lsf1[240] , wallpl2.x_lsf1[360] ) #print('---------------------------------------------------------------------------------------------------------------') #print ( 'f1_lsf [0,-1] =' , wallpl2.f1_lsf[0] , wallpl2.f1_lsf [-2], wallpl2.f1_lsf [-1] ) #print ( 'wallpl2.x_lsf1 [0,-1] =' , wallpl2.x_lsf1[0] , wallpl2.x_lsf1[-2], wallpl2.x_lsf1[-1] ) #print ( 'interp(0.02) =' , np.interp ( 0.02, wallpl2.x_lsf1, wallpl2.f1_lsf ) ) #print('---------------------------------------------------------------------------------------------------------------') #======================================================================================================================= #print ('wallpl2.beta_coeff_tq1.shape = ' , wallpl2.beta_coeff_tq1.shape) # sys.exit(0) time_start = time.process_time() test_beta = TestBeta() print ('==============================================================================================================') print ('wallpl2.uu_noalf = ', wallpl2.uu_noalf ) print ('==============================================================================================================') #sys.exit(0) if any ( ( which_test['ort_test_0'], which_test['ort_test_full'], which_test['matching_test'], which_test['uf12_test_fl'] ) ) : #======================================================================================================================= # perform ort_test_0 and/or ort_test_full and/or matching_test and/or uf12_test----------------------------------------- test_beta.do_test (wallpl2, which_test, test_data) #======================================================================================================================= #---------------------------------------------- run full garbage collection--------------------------------------------- gc.collect() #---------------------------------------------- run full garbage collection--------------------------------------------- #---------------------------------------------Plot intermediate results------------------------------------------------- # plot_comp1.test_dict['test_fun_plot'] = True if any ( ( data_sol1.calc_dict['write_eigen_data'], data_sol1.calc_dict['plot_eigen_fl'], calc_dict['write_f12_data'], calc_dict['plot_f12'] ) ) : plot_comp1.test_dict['test_fun_plot'] = False #----------------------------------------------------------------------------------------------------------------------- if data_sol1.calc_dict['write_eigen_data'] : i_fig0, eigen_data = plot_comp1 (data_sol1, i_fig0, plot_me = 103, dict1 = plot_comp1.eigen_dict, dict2 = plot_comp1.u_dict, dict3 = plot_comp1.steady_dict, dict4 = plot_comp1.test_dict, write_data = True ) #----------------------------------------------------------------------------------------------------------------------- eigen_io_dict = { } eigen_io_dict['line_2'] = 'x-cord [m] | fi1 , ... , fi9 \n' index = 0 iso_eigen_data = [ eigen_data[0] ] eigen_io_dict['line_0'] = 'Eigen Functions f1, ---, f9 \n' #----------------------------------------------------------------------------------------------------------------------- for i, eigen_act in enumerate (eigen_data [1::2]) : iso_eigen_data.append(eigen_act) eigen_name = 'eigen_value_file' data_sol1.write_solve ( 102, io_dict_loc_ext = eigen_io_dict, file_name_ext = eigen_name, write_data = iso_eigen_data ) #----------------------------------------------------------------------------------------------------------------------- if not data_sol1.calc_dict['write_eigen_data'] and data_sol1.calc_dict['plot_eigen_fl'] : i_fig0 = plot_comp1 (data_sol1, i_fig0, plot_me = 103, dict1 = plot_comp1.eigen_dict, dict2 = plot_comp1.u_dict, dict3 = plot_comp1.steady_dict, dict4 = plot_comp1.test_dict) #----------------------------------------------------------------------------------------------------------------------- #print ( 'wallpl2.x_lsf[-1] =' , wallpl2.x_lsf[-1] ) if calc_dict['write_f12_data'] : f12_data_list = [] # print ('check_00') # lancz_cut = [ [0, False, False ], [1, False, False ], [0, True, False ], [1, True, False ], [0, False, True ] ] # lancz_cut = [ [0, False, True ] ] # lancz_cut = [ [0, True, False ] ] # lancz_cut = [ [1, False, False ] ] # lancz_cut = [ [1, True, False ] ] # lancz_cut = [ [1, True, False ] ] # lancz_cut = [ [0, False, True ] ] lancz_cut = [ [0, False, False ] ] # title = [ 'No_Cut_&_No_Lanczos_Nolsf', 'No_Cut_&_Lanczos_Nolsf', # 'Cut_&_No_Lanczos_Nolsf', 'Cut_&_Lanczos_Nolsf', 'No_Cut_&_No_Lanczos_lsf' ] # title = [ 'Cut_&_No_Lanczos_Nolsf' ] # title = [ 'No_Cut_&_Lanczos_Nolsf' ] # lancz_cut = [[0, False]] # title = [ 'No_Cut_&_No_Lanczos_lsf' ] # title = [ 'Cut_&_Lanczos_no_lsf' ] # title = [ 'Cut_&_Lanczos_no_lsf' ] # title = [ 'No_Cut_&_No_Lanczos_lsf' ] title = [ 'No_Cut_&_No_Lanczos_Nolsf' ] dict2_ext = deepcopy ( plot_comp1.u_dict ) #----------------------------------------------------------------------------------------------------------------------- for i, lancz_cut_act in enumerate ( lancz_cut ): print ('==================================================================================================') print ('i , lancz_cut_act = ', i , lancz_cut_act) print ('==================================================================================================') # if i != 0 : #!"£$%^&*()_+ wallpl2.smoothing = lancz_cut_act[0] #!"£$%^&*()_+ wallpl2.cut_fl = lancz_cut_act[1] #!"£$%^&*()_+ wallpl2.lsf = lancz_cut_act[2] # print ('check_01') #!"£$%^&*()_+ wallpl2.fourier_coeff( bc = calc_dict['bc_solve'], fourier_type = 1 ) # print ('check_02') dict2_ext['cut_fl'] = wallpl2.cut_fl i_fig0, f12_data = plot_comp1 (data_sol1, i_fig0, plot_me = 104, dict1 = plot_comp1.eigen_dict, dict2 = dict2_ext, dict3 = plot_comp1.steady_dict, dict4 = plot_comp1.test_dict, write_data = True ) f12_data_list.append (f12_data) #----------------------------------------------------------------------------------------------------------------------- f12_io_dict = { } f12_io_dict['line_2'] = 'x-cord [m] | f12_functions | f12_series \n' index = 0 wallpl2.smoothing = 1 wallpl2.cut_fl = True # sys.exit(0) #----------------------------------------------------------------------------------------------------------------------- for i , f12_data_set in enumerate ( f12_data_list ) : f12_io_dict['line_0'] = 'functions f12 + f12_series ' + title[i] + ' \n' f12_data = [ f12_data_set [0] ] for j , f12_data_act in enumerate (f12_data_set [1::2]) : f12_data.append(f12_data_act) f12_name = 'f12_data' + title[i] data_sol1.write_solve ( 102, io_dict_loc_ext = f12_io_dict, file_name_ext = f12_name, write_data = f12_data ) # sys.exit(0) #----------------------------------------------------------------------------------------------------------------------- if not calc_dict['write_f12_data'] and calc_dict['plot_f12'] : dict2_ext = deepcopy ( plot_comp1.u_dict ) # wallpl2.smoothing = 0 # wallpl2.cut_fl = False wallpl2.fourier_coeff( bc = calc_dict['bc_solve'], fourier_type = 1 ) dict2_ext['cut_fl'] = wallpl2.cut_fl i_fig0 = plot_comp1 (data_sol1, i_fig0, plot_me = 104, dict1 = plot_comp1.eigen_dict, dict2 = dict2_ext, dict3 = plot_comp1.steady_dict, dict4 = plot_comp1.test_dict ) #----------------------------------------------------------------------------------------------------------------------- #sys.exit(0) #----------------------------------------------------------------------------------------------------------------------- #====================== T E S T I N G S O L U T I O N S U M S !!! ================================================== if sol_test_dict['test_fl'] : solve_test1 = SolutionTest (wallpl2, data_sol1 ) solve_test1.test_convol ( sol_test_dict['test_type'] ) # sys.exit(0) #====================== T E S T I N G S O L U T I O N S U M S !!! ================================================== #sys.exit(0) #==================== S O L U T I O N + F L U E N T C O M P A R I S O N!!! ========================================== if data_sol1.calc_dict['solve_fl'] : # print ('==========================================================================================================') # print (' read_DataSolveClass = ', data_sol1.io_dict['read_DataSolveClass']) # print ('==========================================================================================================') if not data_sol1.io_dict['read_DataSolveClass'] : #-------------- Generate Solution data in data_sol1 instance i.e. Generate analytical Solution for input data ---------- #----------------------------------------------------------------------------------------------------------------------- if data_sol1.calc_dict['no_LF'] == 1 : #------------------------------- OLD filter----------------------------------------------------------------------------- # print ('check_01') wallpl2.smoothing = 1 wallpl2.cut_fl = True wallpl2.lsf = False # wallpl2.fourier_coeff( alf_par = wallpl2.alf_steady, bc = calc_dict['bc_solve'], fourier_type = 3 ) wallpl2.fourier_coeff( bc = calc_dict['bc_solve'], fourier_type = 1 ) elif data_sol1.calc_dict['no_LF'] == 2 : #------------------------------- Up- Date Lanczos filter---------------------------------------------------------------- # print ('check_02') wallpl2.smoothing = 0 wallpl2.cut_fl = False wallpl2.lsf = True # wallpl2.fourier_coeff( alf_par = wallpl2.alf_steady, bc = calc_dict['bc_solve'], fourier_type = 3 ) wallpl2.fourier_coeff( bc = calc_dict['bc_solve'], fourier_type = 1 ) elif data_sol1.calc_dict['no_LF'] == 3 : #------------------------------- NO filter------------------------------------------------------------------------------ # print ('check_03') wallpl2.smoothing = 0 wallpl2.cut_fl = False wallpl2.lsf = False # wallpl2.fourier_coeff( alf_par = wallpl2.alf_steady, bc = calc_dict['bc_solve'], fourier_type = 3 ) wallpl2.fourier_coeff( bc = calc_dict['bc_solve'], fourier_type = 1 ) elif data_sol1.calc_dict['no_LF'] == 0 : #------------------------ Do noting use data from wall class ----------------------------------------------------------- # pass # wallpl2.smoothing = 0 # wallpl2.cut_fl = False # print ('check_00') #!"£$%^&*() wallpl2.fourier_coeff( alf_par = wallpl2.alf_steady, bc = calc_dict['bc_solve'], fourier_type = 3 ) if CONV_ANA and NBETA_ACT_d [0] >= 0 : beta_coeff_d_copy = wallpl2.beta_coeff_d ab_coeff_d_copy = wallpl2.ab_coeff_d d10_coeff_d_copy = wallpl2.d10_coeff_d d01_coeff_d_copy = wallpl2.d01_coeff_d dss10_coeff_d_copy = wallpl2.dss10_coeff_d dss01_coeff_d_copy = wallpl2.dss01_coeff_d error_in = [] error_out = [] print ('==================================================================================================') for ind, nn_beta_act in enumerate ( NBETA_ACT_d ) : print ( '---------------ind, nn_beta_act = ' , ind, nn_beta_act ) wallpl2.nbeta_d = nn_beta_act wallpl2.beta_coeff_d = beta_coeff_d_copy [ : nn_beta_act ] wallpl2.ab_coeff_d = ab_coeff_d_copy [: nn_beta_act , : ] #----------------------------------------------------------------------------------------------------------------------- wallpl2.d10_coeff_d = d10_coeff_d_copy [ : nn_beta_act ] wallpl2.d01_coeff_d = d01_coeff_d_copy [ : nn_beta_act ] #----------------------------------------------------------------------------------------------------------------------- wallpl2.dss10_coeff_d = dss10_coeff_d_copy [ : nn_beta_act ] wallpl2.dss01_coeff_d = dss01_coeff_d_copy [ : nn_beta_act ] #----------------------------------------------------------------------------------------------------------------------- data_sol1.wallpl = wallpl2 solution_data = data_sol1.read_solve ( 3 ) #----------------------------------------------------------------------------------------------------------------------- if ind == 0 : q_in_n = data_sol1.sol_dat[0][0][0] q_out_n = data_sol1.sol_dat[0][0][-1] else : q_in_nm = data_sol1.sol_dat[0][0][0] q_out_nm = data_sol1.sol_dat[0][0][-1] error_in.append( np.sum( np.abs ( q_in_nm - q_in_n ) ) / np.sum( np.abs ( q_in_nm ) ) ) error_out.append(np.sum( np.abs ( q_out_nm - q_out_n ) ) / np.sum( np.abs ( q_out_nm ) ) ) q_in_n = q_in_nm q_out_n = q_out_nm print ('==================================================================================================') print ('error_in = ' , error_in ) print ('error_out = ' , error_out ) print ('==================================================================================================') sys.exit(0) else : solution_data = data_sol1.read_solve ( 3 ) if data_sol1.io_dict['write_DataSolveClass'] : #-------------- Save data_sol1 instance -------------------------------------------------------------------------------- data_sol1.write_solve ( 3 ) # energy_initial - initial energy in system # energy_final - final energy in system # delta_energy - energy difference # temp_delta - temperature difference # flux_steady - steady state flux # temp1, temp2 - steady state temperatures else : #-------------- Read Solution data ------------------------------------------------------------------------------------- data_sol1 = data_sol1.write_solve ( 4 ) if estim_dict['new_estim'] : data_sol1.estim_dict = estim_dict data_sol1.io_dict = io_dict0 data_sol1.calc_dict = calc_dict data_sol1.input_file = input_data_files # print ('=================================================================================================') # print (data_sol1.estim_dict['estim_part']) # print ( estim_dict['estim_part'] ) # print ('=================================================================================================') solution_data = data_sol1.solution_data if data_sol1.io_dict['write_solve_data'] : #-------------- Save data_ --------------------------------------------------------------------------------------------- data_sol1.write_solve ( 5 ) if solution_data != [] : print( '====================== R E S U L T S =====================================' ) print( 'BC = ', data_sol1.calc_dict['bc_solve'], '| temp/flux = ', data_sol1.calc_dict['mode_sol'], '| test_case = ', data_sol1.calc_dict['test_case'] ) print( '------------------------------------------------------------------------------------------' ) # print( eval('wallpl2.beta_coeff_' + data_sol1.calc_dict['bc_solve'] + '[0:10]') ) for title_i, value_i in zip(solution_titles, solution_data[:-1]) : if value_i != None : print (title_i , value_i ) print( '------------------------------------------------------------------------------------------' ) if title_i == 'final energy =' : print ('Energy rel. error [%] = ', 100 * abs( solution_data[0] + solution_data[2] - solution_data[1] ) / solution_data[1] ) print( '------------------------------------------------------------------------------------------') print( '==========================================================================================' ) #=========================================== H E A T L O S S ======================================================== if data_sol1.calc_dict['heat_loss'] : if data_sol1.fluent_dict['test_fluent'] or data_sol1.fluent_dict['test_fluent_read'] : flux_1 = np.array ( [ data_sol1.fluent_dat[0][0] , data_sol1.fluent_dat[1][1] ] ) flux_2 = np.array ( [ data_sol1.fluent_dat[0][1] , data_sol1.fluent_dat[1][1] ] ) fluent_flux = np.array( [flux_1, flux_2 ] ) fluent_fl = data_sol1.heat_loss ( fluent_dat = fluent_flux) if data_sol1.calc_dict['plot_heat_loss'] : nn_plots_copy = deepcopy( plot_comp1.plot_dict ['nn_plots'] ) plot_comp1.plot_dict ['nn_plots'] = [0,-1] plot_loss_calc = [ [data_sol1.q_loss[0][0], data_sol1.q_loss[0][1]], [data_sol1.q_loss[0][0], data_sol1.q_loss[0][2]] ] plot_loss_meas = [ [data_sol1.q_loss[1][0], data_sol1.q_loss[1][1]], [data_sol1.q_loss[1][0], data_sol1.q_loss[1][2]] ] plot_loss_fluent = [ [data_sol1.q_loss_fluent[0][0], data_sol1.q_loss_fluent[0][1] ], [ data_sol1.q_loss_fluent[1][0], data_sol1.q_loss_fluent[1][1] ] ] l2_norm_in, madp_in, mae_in = error_calc ( vec_ref = plot_loss_meas[0][1], vec_calc = plot_loss_calc[0][1], error_type = 'all_errors' ) l2_norm_out, madp_out, mae_out = error_calc ( vec_ref = plot_loss_meas[1][1], vec_calc = plot_loss_calc[1][1], error_type = 'all_errors' ) if fluent_fl : flux_in_fl_rec = np.interp( data_sol1.q_loss[1][0], data_sol1.q_loss_fluent[0][0], data_sol1.q_loss_fluent[0][1]) flux_out_fl_rec = np.interp( data_sol1.q_loss[1][0], data_sol1.q_loss_fluent[1][0], data_sol1.q_loss_fluent[1][1]) l2_norm_fluent_in, madp_fluent_in, mae_fluent_in = error_calc ( vec_ref = plot_loss_meas[0][1], vec_calc = flux_in_fl_rec, error_type = 'all_errors' ) l2_norm_fluent_out, madp_fluent_out, mae_fluent_out = error_calc ( vec_ref = plot_loss_meas[1][1], vec_calc = flux_out_fl_rec, error_type = 'all_errors' ) print ('--------------------------------------------------------------------------------------------------') print ( 'l2_norm_in, madp_in, mae_in = ' , l2_norm_in, madp_in, mae_in ) print ( 'l2_norm_out, madp_out, mae_out = ' , l2_norm_out, madp_out, mae_out ) if fluent_fl : print ('*********************************FLUENT******************************************************') print ( 'l2_norm_in, madp_in, mae_in = ' , l2_norm_fluent_in, madp_fluent_in, mae_fluent_in ) print ( 'l2_norm_out, madp_out, mae_out = ' , l2_norm_fluent_out, madp_fluent_out, mae_fluent_out ) print ('----------------------------------------------------------------------------------------------') if plot_comp1.plot_dict['me_plot'][0] == 1 : i_fig0 = plot_comp1 (data_sol1, i_fig0, 1, plot_list_1 = plot_loss_calc, plot_list_2 = plot_loss_meas ) elif plot_comp1.plot_dict['me_plot'][0] == 2 or plot_comp1.plot_dict['me_plot'][0] == 3 : # diff_plot_ext = plot_comp1.plot_dict['me_plot'][0] diff_plot_ext = 0 i_fig0 = plot_comp1 (data_sol1, i_fig0, 2 , diff_plot = diff_plot_ext, plot_list_1 = plot_loss_calc, plot_list_2 = plot_loss_meas ) i_fig0 = plot_comp1 (data_sol1, i_fig0, 3 , diff_plot = diff_plot_ext, plot_list_1 = plot_loss_calc, plot_list_2 = plot_loss_meas ) if fluent_fl : i_fig0 = plot_comp1 (data_sol1, i_fig0, 2 , diff_plot = diff_plot_ext, plot_list_1 = plot_loss_fluent, plot_list_2 = plot_loss_meas ) i_fig0 = plot_comp1 (data_sol1, i_fig0, 3 , diff_plot = diff_plot_ext, plot_list_1 = plot_loss_fluent, plot_list_2 = plot_loss_meas ) plot_comp1.plot_dict ['nn_plots'] = nn_plots_copy if data_sol1.calc_dict['write_heat_loss'] : if fluent_fl : line_46 = 'line_6' else : line_46 = 'line_4' calc_io_dict = { } calc_io_dict['line_0'] = '---------Heat Loss calc_in&out + Measurements in&out + FLUENT in&out---- \n' calc_io_dict[line_46] = ' time_calc [sec] | heat_loss_calc_in | heat_loss_calc_out |' + \ ' time_measure [sec] | heat_loss_measure_in | heat_loss_measure_out |' + \ ' time_fluent [sec] | heat_loss_fluent_in | heat_loss_fluent_out | \n ' calc_file_name = 'heat_los_in_out_calc&measure' + '_' + data_sol1.calc_dict['raw_smooth'] if fluent_fl : calc_data = [ data_sol1.q_loss[0][0], data_sol1.q_loss[0][1], data_sol1.q_loss[0][2], data_sol1.q_loss[1][0], data_sol1.q_loss[1][1], data_sol1.q_loss[1][2], data_sol1.q_loss[1][0], flux_in_fl_rec, flux_out_fl_rec ] else : calc_data = [ data_sol1.q_loss[0][0], data_sol1.q_loss[0][1], data_sol1.q_loss[0][2], data_sol1.q_loss[1][0], data_sol1.q_loss[1][1], data_sol1.q_loss[1][2] ] calc_io_dict['line_2'] = 'l2_norm_in | madp_in | mae_in = ' + \ ' {0: 9.16f} {1: 9.16f} {2: 9.16f} '. format (l2_norm_in, madp_in, mae_in ) + '\n' calc_io_dict['line_3'] = 'l2_norm_out | madp_out | mae_out = ' + \ ' {0: 9.16f} {1: 9.16f} {2: 9.16f} '. format (l2_norm_out, madp_out, mae_out ) + '\n' if fluent_fl : calc_io_dict['line_4'] = 'FLUENT: l2_norm_in | madp_in | mae_in = ' + \ ' {0: 9.16f} {1: 9.16f} {2: 9.16f} '. format (l2_norm_fluent_in, madp_fluent_in, mae_fluent_in)+'\n' calc_io_dict['line_5'] = 'FLUENT: l2_norm_out | madp_out | mae_out = ' + \ ' {0: 9.16f} {1: 9.16f} {2: 9.16f} '. format (l2_norm_fluent_out,madp_fluent_out,mae_fluent_out)+'\n' data_sol1.write_solve ( 102, io_dict_loc_ext = calc_io_dict, file_name_ext = calc_file_name, write_data = calc_data ) #============================================== P L O T R E S U L T S ================================================ if data_sol1.calc_dict['plot_res_fl'] : me_fl = ( plot_comp1.plot_dict ['nn_plots'] == [0,-1] or plot_comp1.plot_dict ['nn_plots'] == [-1,0] ) and plot_comp1.plot_dict['plot_xt'] == 2 if plot_comp1.plot_dict['me_plot'][0] == 1 : i_fig0 = plot_comp1 (data_sol1, i_fig0, plot_comp1.plot_dict['me_plot'][0] ) elif plot_comp1.plot_dict['me_plot'][0] == 2 or plot_comp1.plot_dict['me_plot'][0] == 3 : # diff_plot_ext = plot_comp1.plot_dict['me_plot'][0] diff_plot_ext = 0 if data_sol1.calc_dict['write_calc_data'] : if plot_comp1.plot_dict['plot_xt'] == 1 : i_fig0, data_list_1 = plot_comp1 (data_sol1, i_fig0, 1 , diff_plot = diff_plot_ext, write_data = True, plot_raw_smooth = data_sol1.calc_dict['write_raw_smooth'] ) elif plot_comp1.plot_dict['plot_xt'] == 2 : if me_fl : #---------------------------------- Inside ----------------------------------------------------------------------------- i_fig0, data_list_1 = plot_comp1 (data_sol1, i_fig0, 2 , diff_plot = diff_plot_ext, write_data = True, plot_raw_smooth = data_sol1.calc_dict['write_raw_smooth'] ) #---------------------------------- Outside ---------------------------------------------------------------------------- i_fig0, data_list_2 = plot_comp1 (data_sol1, i_fig0, 3 , diff_plot = diff_plot_ext, write_data = True, plot_raw_smooth = data_sol1.calc_dict['write_raw_smooth'] ) else : i_fig0, data_list_1 = plot_comp1 (data_sol1, i_fig0, 1 , diff_plot = diff_plot_ext, write_data = True, plot_measure = False ) #----------------------------------------------------------------------------------------------------------------------- calc_io_dict = { } index = 0 calc_data = [ data_list_1[0] ] calc_data1 = [] calc_data2 = [] if plot_comp1.plot_dict['plot_xt'] == 2 : if fluent_fl_00 : line_00 = 'line_11' line_01 = 'line_10' else : line_00 = 'line_9' line_01 = 'line_8' if not data_sol1.calc_dict['write_raw_smooth'] and me_fl : calc_io_dict[line_00] = 'time [sec] | flux_calc_in | flux_me_in | flux_calc_out |' + \ ' flux_me_out \n' calc_io_dict['line_0'] = '----------Calc & Measured smooth in & ex Flux [W/m^2]---------\n' elif data_sol1.calc_dict['write_raw_smooth'] and me_fl : calc_io_dict[line_00] = 'time [sec] | flux_in calc | raw | smooth | flux_out calc | raw |' + \ ' smooth \n' calc_io_dict['line_0'] = '----------Calc & Measured raw&smooth in & ex Flux [W/m^2]-----' calc_io_dict['line_0'] = calc_io_dict['line_0'] + 'nn_beta = ' + str(nn_beta_act ) + '\n' elif not me_fl : if data_sol1.calc_dict['mode_sol'] == 'flux' : calc_io_dict['line_4'] = 'time [sec] | flux_calc (t, x = x1, x2, x3, ....) \n' calc_io_dict['line_0'] = '----------Calc Flux [W/m^2] Temporal Distribution --------\n' elif data_sol1.calc_dict['mode_sol'] == 'temp' : calc_io_dict['line_4'] = 'time [sec] | temp_calc (t, x = x1, x2, x3, ....) \n' calc_io_dict['line_0'] = '----------Calc Temp [C] Temporal Distribution --------\n' if data_sol1.calc_dict['error_type'] == 'all_errors' and data_sol1.calc_dict['write_raw_smooth'] \ and me_fl : start_ind = data_sol1.input_file ['start_sample_local'] l2_error_in_raw, madp_in_raw, mae_in_raw = error_calc ( vec_ref = data_list_1 [3] , vec_calc = data_list_1 [1] , start = start_ind, error_type = 'all_errors' ) l2_error_in_smooth, madp_in_smooth, mae_in_smooth = error_calc ( vec_ref = data_list_1 [5] , vec_calc = data_list_1 [1] , start = start_ind, error_type = 'all_errors' ) l2_error_out_raw, madp_out_raw, mae_out_raw = error_calc ( vec_ref = data_list_2 [3] , vec_calc = data_list_2 [1] , start = start_ind, error_type = 'all_errors' ) l2_error_out_smooth, madp_out_smooth, mae_out_smooth = error_calc ( vec_ref = data_list_2 [5], vec_calc = data_list_2 [1] , start = start_ind, error_type = 'all_errors' ) #----------------------------------------------------------------------------------------------------------------------- l2_error_in_raw_smooth, madp_in_raw_smooth, mae_in_raw_smooth = error_calc ( vec_ref = data_list_1 [3], vec_calc = data_list_1 [5] , start = start_ind, error_type = 'all_errors' ) l2_error_out_raw_smooth, madp_out_raw_smooth, mae_out_raw_smooth = error_calc ( vec_ref = data_list_2 [3], vec_calc = data_list_2 [5] , start = start_ind, error_type = 'all_errors' ) #----------------------------------------------------------------------------------------------------------------------- if fluent_fl_00 : fluent_in = np.interp( data_list_1[0], data_sol1.fluent_dat[1][1], data_sol1.fluent_dat[0][0] ) # print ( data_sol1.fluent_dat[1][1].shape, data_sol1.fluent_dat[1][0].shape ) fluent_out = np.interp( data_list_2[0], data_sol1.fluent_dat[1][1], data_sol1.fluent_dat[0][1]) l2_error_in_fluent, madp_in_fluent, mae_in_fluent = error_calc ( vec_ref = data_list_1 [1], vec_calc = fluent_in , start = start_ind, error_type = 'all_errors' ) l2_error_out_fluent, madp_out_fluent, mae_out_fluent = error_calc ( vec_ref = data_list_2 [3], vec_calc = fluent_out , start = start_ind, error_type = 'all_errors' ) # print ( 'l2_error_in_raw, madp_in_raw, mae_in_raw =', # l2_error_in_raw, madp_in_raw, mae_in_raw ) calc_io_dict['line_2'] = 'raw_data_in l2_error | madp_error | mae_error = ' + \ '{0: 9.16f} {1: 9.16f} {2: 9.16f} '. format ( l2_error_in_raw, madp_in_raw, mae_in_raw ) + '\n' # print ('l2_error_in_smooth, madp_in_smooth, mae_in_smooth =', # l2_error_in_smooth, madp_in_smooth, mae_in_smooth ) calc_io_dict['line_3'] = 'smooth_data_in l2_error | madp_error | mae_error = ' + \ '{0: 9.16f} {1: 9.16f} {2: 9.16f} '. format ( l2_error_in_smooth, madp_in_smooth, mae_in_smooth ) + '\n' # print ( 'l2_error_out_raw, madp_out_raw, mae_out_raw = ', # l2_error_out_raw, madp_out_raw, mae_out_raw ) calc_io_dict['line_4'] = 'raw_data_out l2_error | madp_error | mae_error = ' + \ '{0: 9.16f} {1: 9.16f} {2: 9.16f} '. format ( l2_error_out_raw, madp_out_raw, mae_out_raw ) + '\n' # print ('l2_error_out_smooth, madp_out_smooth, mae_out_smooth =', # l2_error_out_smooth, madp_out_smooth, mae_out_smooth ) calc_io_dict['line_5'] = 'smooth_data_out l2_error | madp_error | mae_error = ' + \ '{0: 9.16f} {1: 9.16f} {2: 9.16f} '. format ( l2_error_out_smooth, madp_out_smooth, mae_out_smooth ) + '\n' #----------------------------------------------------------------------------------------------------------------------- calc_io_dict['line_6'] = 'raw_smooth_in l2_error | madp_error | mae_error = ' + \ '{0: 9.16f} {1: 9.16f} {2: 9.16f} '. format ( l2_error_in_raw_smooth, madp_in_raw_smooth, mae_in_raw_smooth) + '\n' calc_io_dict['line_7'] = 'raw_smooth_out l2_error | madp_error | mae_error = ' + \ '{0: 9.16f} {1: 9.16f} {2: 9.16f} '. format ( l2_error_out_raw_smooth, madp_out_raw_smooth, mae_out_raw_smooth ) + '\n' if fluent_fl_00 : calc_io_dict['line_8'] = 'FLUENT in : l2_error | madp_error | mae_error = ' + \ '{0: 9.16f} {1: 9.16f} {2: 9.16f} '. format ( l2_error_in_fluent, madp_in_fluent, mae_in_fluent ) + '\n' calc_io_dict['line_9'] = 'FLUENT out : l2_error | madp_error | mae_error = ' + \ '{0: 9.16f} {1: 9.16f} {2: 9.16f} '. format ( l2_error_out_fluent, madp_out_fluent, mae_out_fluent ) + '\n' start_t = input_data_files['start_time'] / SEC_HOUR end_t = input_data_files['end_time'] / SEC_HOUR sample_no = input_data_files['start_sample_global'] g_buffer = input_data_files['green_buffer'] calc_io_dict[line_01] = 'global_start_time [h] | global_start_sample | buffer [h] | ' + \ 'global_end_time = ' + \ ' {0: 9.16f} {1: 10d} {2: 9.16f} {3: 9.16f} '. format ( start_t, sample_no, g_buffer, end_t ) + '\n' if me_fl : for i, (data_act1, data_act2) in enumerate (zip (data_list_1[1::2], data_list_2[1::2] ) ) : calc_data1.append(data_act1) calc_data2.append(data_act2) calc_data = calc_data + calc_data1 + calc_data2 if wallpl2.contact_res == 0 : calc_file_name = 'in_ext_calc_me_flux_contact_res_' + str (wallpl2.contact_res) \ + '_' + data_sol1.calc_dict['raw_smooth'] + '_nbeat_' + str( nn_beta_act ) elif wallpl2.contact_res == 1 or wallpl2.contact_res == 2 : calc_file_name = 'in_ext_calc_me_flux_contact_res_' + str (wallpl2.contact_res) + \ '_air_gap_' + str (wallpl2.layergap[0]) + '_mm_' + data_sol1.calc_dict['raw_smooth'] else : calc_io_dict['line_2'] = ' x1 | x2 | ... coordinates = ' calc_io_dict['line_3'] = ' x1 | x2 | ... samples = ' for xt_act, xt_index in zip ( start_sample['nn_plots_xt'], plot_comp1.plot_dict ['nn_plots'] ): calc_io_dict['line_2'] += ' {: 9.16f} '. format (xt_act ) calc_io_dict['line_3'] += ' {: 6d} '. format (xt_index ) calc_io_dict['line_2'] += '\n' calc_io_dict['line_3'] += '\n' for i, data_act1 in enumerate (data_list_1[1::2] ) : calc_data1.append(data_act1) calc_data = calc_data + calc_data1 calc_file_name = data_sol1.calc_dict['mode_sol'] + '_temporal_dist' + '_' \ + data_sol1.calc_dict['raw_smooth'] elif plot_comp1.plot_dict['plot_xt'] == 1 : if data_sol1.calc_dict['mode_sol'] == 'temp' : calc_io_dict['line_0'] = '----------Temperature (x) ----------------- \n' calc_io_dict['line_6'] = ' x [m] | temp(t1, x) | temp(t2, x) | temp(t3, x) | temp(t4, x) | \n ' elif data_sol1.calc_dict['mode_sol'] == 'flux' : calc_io_dict['line_0'] = '----------Flux (x) ----------------- \n' calc_io_dict['line_6'] = ' x [m] | flux(t1, x) | flux(t2, x) | flux(t3, x) | flux(t4, x) | \n ' #----------------------------------------------------------------------------------------------------------------------- time_loc1 = start_sample['x_plot_time1'] time_loc2 = start_sample['x_plot_time2'] time_loc3 = start_sample['x_plot_time3'] time_loc4 = start_sample['x_plot_time4'] #----------------------------------------------------------------------------------------------------------------------- time_glob1 = start_sample['x_global_time1'] time_glob2 = start_sample['x_global_time2'] time_glob3 = start_sample['x_global_time3'] time_glob4 = start_sample['x_global_time4'] #----------------------------------------------------------------------------------------------------------------------- sample1 = start_sample['x_plot_sample1'] sample2 = start_sample['x_plot_sample2'] sample3 = start_sample['x_plot_sample3'] sample4 = start_sample['x_plot_sample4'] #----------------------------------------------------------------------------------------------------------------------- global_sample1 = start_sample['x_global_sample1'] global_sample2 = start_sample['x_global_sample2'] global_sample3 = start_sample['x_global_sample3'] global_sample4 = start_sample['x_global_sample4'] #----------------------------------------------------------------------------------------------------------------------- calc_io_dict['line_2'] = 'starting local times | t1 | t2 | t3 | t4 | [h] = ' + \ '{0: 9.16f} {1: 9.16f} {2: 9.16f} {3: 9.16f} '. format ( time_loc1, time_loc2, time_loc3, time_loc4) + '\n' calc_io_dict['line_3'] = 'starting global times | t1 | t2 | t3 | t4 | [h] = ' + \ '{0: 9.16f} {1: 9.16f} {2: 9.16f} {3: 9.16f} '. format ( time_glob1, time_glob2, time_glob3, time_glob4) + '\n' calc_io_dict['line_4'] = 'starting local samples | t1 | t2 | t3 | t4 | [sample_NO] = ' + \ '{0: 10d} {1: 10d} {2: 10d} {3: 10d} '. format ( sample1, sample2, sample3, sample4 ) + '\n' calc_io_dict['line_5'] = 'starting global samples | t1 | t2 | t3 | t4 | [sample_NO] = ' + \ '{0: 10d} {1: 10d} {2: 10d} {3: 10d} '. format ( global_sample1, global_sample2, global_sample3, global_sample4) + '\n' #----------------------------------------------------------------------------------------------------------------------- for i, data_act1 in enumerate ( data_list_1[1::2] ) : calc_data1.append(data_act1) calc_data = calc_data + calc_data1 calc_file_name = data_sol1.calc_dict['mode_sol'] + '_spatial_dist_set_' + \ str ( start_sample['set_dist'] ) + '_' + data_sol1.calc_dict['raw_smooth'] #----------------------------------------------------------------------------------------------------------------------- # print ( '============================================================================================' ) # print ( 'calc_io_dict, calc_file_name = ', calc_io_dict, calc_file_name ) # print ( '============================================================================================' ) data_sol1.write_solve ( 102, io_dict_loc_ext = calc_io_dict, file_name_ext = calc_file_name, write_data = calc_data ) else : if plot_comp1.plot_dict['plot_xt'] == 1 : i_fig0 = plot_comp1 (data_sol1, i_fig0, 1 , diff_plot = diff_plot_ext, plot_raw_smooth = data_sol1.calc_dict['write_raw_smooth'] ) elif plot_comp1.plot_dict['plot_xt'] == 2 : if me_fl : i_fig0 = plot_comp1 (data_sol1, i_fig0, 2 , diff_plot = diff_plot_ext, plot_raw_smooth = data_sol1.calc_dict['write_raw_smooth'] ) i_fig0 = plot_comp1 (data_sol1, i_fig0, 3 , diff_plot = diff_plot_ext, plot_raw_smooth = data_sol1.calc_dict['write_raw_smooth'] ) else : i_fig0 = plot_comp1 (data_sol1, i_fig0, 1 , diff_plot = diff_plot_ext, plot_measure = False ) #============================================== P L O T R E S U L T S ================================================ #sys.exit(0) #======================= DO ESTIMATION, GREEN FUNCTIONS & P L O T R E S U L T S !!! ================================== if data_sol1.calc_dict['do_estimate'] or data_sol1.calc_dict['impuls_green'] or data_sol1.calc_dict['ana_green'] or \ data_sol1.calc_dict['do_prediction'] : #-----------LsEstim - instance------------------------------------------------------------------------------------------ # LsEstim class do all necessery work rleated to Green function identification, predictions & estimations--------------- estimate_1 = LsEstim ( estim_dict, data_sol1.measure_dat, data_sol1.sol_dat, data_sol1.io_dict, data_sol1.data_path, data_sol1.calc_dict, data_sol1.test_dict, data_sol1.ana_green1, data_sol1.ana_green2, data_sol1.input_file, wallpl = data_sol1.wallpl ) # ----------------- do_estimate or do_prediction generate in_out data for estimation & prediction----------------------- if data_sol1.calc_dict['do_estimate'] or data_sol1.calc_dict['do_prediction'] : if not estimate_1.estim_dict['read_LsEstimClass'] : #------Prepare I/O data ----- estimate_1.in_out_esti ( ) #---------------------------------------Recalculate Analytical_Green if necessary -------------------------------------- if estimate_1.estim_dict['green_only'] : data_sol1.estim_dict['green_only'] = True data_sol1.estim_dict['exact_green_dict']['ana_time_step'] = \ estimate_1.estim_dict['exact_green_dict']['ana_time_step'] # print ('estimate_1.ana_time_step = ', estimate_1.estim_dict['exact_green_dict']['ana_time_step'] ) data_sol1.sum_solv ( ) estimate_1.ana_green1 = data_sol1.ana_green1 estimate_1.ana_green2 = data_sol1.ana_green2 data_sol1.estim_dict['green_only'] = False estimate_1.estim_dict['green_only'] = False #----------- Do estimation---------------------------------------------------------------------------------------------- estimate_1 ( ) if estimate_1.estim_dict['write_LsEstimClass'] : data_sol1.write_solve ( 33, estimate_class = estimate_1 ) else : estimate_1 = data_sol1.write_solve ( 44 ) if estim_dict['new_predict'] : estimate_1.estim_dict = estim_dict estimate_1.io_dict = io_dict0 estimate_1.calc_dict = calc_dict estimate_1.input_file = data_sol1.input_file estimate_1.wallpl = data_sol1.wallpl if estim_dict['new_ana_green'] : estimate_1.ana_green1 = data_sol1.ana_green1 estimate_1.ana_green2 = data_sol1.ana_green2 if estim_dict['new_predict'] and data_sol1.calc_dict['do_prediction'] : estimate_1.in_out_esti ( ) estimate_1.do_prediction ( ) estimate_1.do_heat_acum ( ) estimate_1.do_heat_acum ( ) if estimate_1.estim_dict['do_picard_test'] : estimate_1.do_picard_test ( ) sigma_mean = estimate_1.sigma_predict () print ( '==============================================================================================' ) print ( ' sigma_mean = ', sigma_mean ) print ( ' relative_Error = ', sigma_mean[2] / sigma_mean[0] , sigma_mean[3] / sigma_mean[1] ) print ( '==============================================================================================' ) if estimate_1.estim_dict['uu_test'] and estimate_1.estim_dict['estim_green1'] and\ estimate_1.estim_dict['estim_green2'] : if ( data_sol1.calc_dict['do_estimate'] or data_sol1.calc_dict['do_prediction'] ) \ and not estim_dict['new_ana_green'] : which_uu_set = 22 else : which_uu_set = 20 if which_uu_set == 12 : u_check1, u_check2, ana_u1, ana_u2 = estimate_1.do_utest ( which_uu = which_uu_set ) print ('==============================================================================================') print ('u_check1, u_check2, ana_u1, ana_u2 =', u_check1, u_check2, ana_u1, ana_u2 ) print ('==============================================================================================') elif which_uu_set == 22 or which_uu_set == 20: print ('check_3********************') u_check, u_check_ana, ana_error, noise_level, signal_level, lag_time = \ estimate_1.do_utest ( which_uu = which_uu_set ) print ('==============================================================================================') # print ('u_check1,2, ana_u1,2 =', u_check[0], u_check[1]) # ana_u1 print ('==============================================================================================') print ('u_check11, 12, 21, 22 =', u_check[2], u_check[3], u_check[4], u_check[5] ) print ('==============================================================================================') print ('ana_u11, 12, 21, 22 =', u_check_ana[0], u_check_ana[1], u_check_ana[2], u_check_ana[3] ) print ('==============================================================================================') # print ('ana_error11, 12, 21, 22 =', ana_error ) print ('==============================================================================================') print ('noise_level 11, 12, 21, 22 =', noise_level ) print ('signal_level 11, 12, 21, 22 =', signal_level ) print ('==============================================================================================') if which_uu_set != 20: print ('lag_time =', lag_time[0] / 3600.0, lag_time[1] / 3600.0, lag_time[2] / 3600.0, lag_time[3] / 3600.0 ) print ('==============================================================================================') print ('estimate_1.index_start_predict_calc = ', estimate_1.index_start_predict_calc ) print ('==============================================================================================') # estimate_1.predict_calc1 [estimate_1.index_start_predict_calc : : 5 ] # estimate_1.predict_calc2 [estimate_1.index_start_predict_calc : : 5 ] # estimate_1.predict_output1 [ estimate_1.index_start_predict_measure :: 5 ] # estimate_1.predict_output2 [ estimate_1.index_start_predict_measure :: 5 ] # flux_raw_data = [ estimate_1.predict_output1 [ estimate_1.index_start_predict_measure :: 5 ], # estimate_1.predict_output2 [ estimate_1.index_start_predict_measure :: 5 ] ] # flux_calc_data = [ estimate_1.predict_calc1 [estimate_1.index_start_predict_calc : : 5 ], # estimate_1.predict_calc2 [estimate_1.index_start_predict_calc : : 5 ]] # flux_raw_io_dict = { } # flux_calc_io_dict = { } # flux_raw_io_dict['line_2'] = 'flux_raw_inside | flux_raw_outside \n' # flux_calc_io_dict['line_2'] = 'flux_calc_inside | flux_calc_outside \n' # index = 0 # flux_raw_io_dict ['line_0'] = 'Flux_in_out_raw \n' # flux_calc_io_dict['line_0'] = 'Flux_in_out_calc \n' # flux_raw_name = 'Flux_in_out_raw' # flux_calc_name = 'Flux_in_out_calc' # estimate_1.write_solve ( 102, io_dict_loc_ext = flux_raw_io_dict, file_name_ext = flux_raw_name, # write_data = flux_raw_data ) # estimate_1.write_solve ( 102, io_dict_loc_ext = flux_calc_io_dict, file_name_ext = flux_calc_name, # write_data = flux_calc_data ) if estimate_1.calc_dict['do_fourier'] : diff_plot_ext = 0 for green_nm in range ( 4 ) : ana_plot_ff = [ [estimate_1.freq_vec[0], estimate_1.abs_ana_ff[green_nm]], [estimate_1.freq_vec[0], estimate_1.arg_ana_ff[green_nm] ] ] plot_ff = [[estimate_1.freq_vec[0] , estimate_1.abs_ff[green_nm]] , [estimate_1.freq_vec[0] , estimate_1.arg_ff[green_nm]] ] i_fig0 = plot_comp1 (data_sol1, i_fig0, 2 , diff_plot = diff_plot_ext, plot_list_1 = ana_plot_ff, plot_list_2 = plot_ff ) i_fig0 = plot_comp1 (data_sol1, i_fig0, 3 , diff_plot = diff_plot_ext, plot_list_1 = ana_plot_ff, plot_list_2 = plot_ff ) #====================================================================================================================== for plot_data, ana_plot_data in zip(estimate_1.dyn_par[3:5], estimate_1.ana_dyn_par[3:5] ) : plot_ff = [ [ estimate_1.freq_vec[0] , plot_data ] ] ana_plot_ff = [ [ estimate_1.freq_vec[0] , ana_plot_data ] ] i_fig0 = plot_comp1 (data_sol1, i_fig0, 2 , diff_plot = diff_plot_ext, plot_list_1 = ana_plot_ff, plot_list_2 = plot_ff ) if estimate_1.estim_dict['write_ff'] : ff_io_dict = { } ana_ff_io_dict = { } ff_io_dict['line_2'] = 'Frequency [1/day] | Module | Argument \n' ana_ff_io_dict['line_2'] = ff_io_dict['line_2'] prefix_list = ['11', '12', '21', '22' ] for i, prefix_act in enumerate ( prefix_list ) : if i == 1 or 2 : index = 0 elif i == 0 or 3 : index = 1 ff_data = [estimate_1.freq_vec[index], estimate_1.abs_ff[i] , estimate_1.arg_ff[i] ] ana_ff_data = [estimate_1.freq_vec[index], estimate_1.abs_ana_ff[i], estimate_1.arg_ana_ff[i] ] ff_io_dict['line_0'] = 'FF_Trasform_' + 'calc Green function_' + prefix_act + '\n' ana_ff_io_dict['line_0'] = 'FF_Trasform_' + 'ana Green function_' + prefix_act + '\n' ff_file_name = 'ff_calc_'+ prefix_act ana_ff_file_name = 'ana_ff_' + prefix_act estimate_1.write_solve ( 102, io_dict_loc_ext = ff_io_dict, file_name_ext = ff_file_name, write_data = ff_data ) estimate_1.write_solve ( 102, io_dict_loc_ext = ana_ff_io_dict, file_name_ext = ana_ff_file_name, write_data = ana_ff_data ) #======================================================================================================================= # ff_io_dict = { } k1_io_dict = { } k2_io_dict = { } k1_io_dict['line_2'] = 'Frequency [1/day] | k1_estim | k1_iso \n' k2_io_dict['line_2'] = 'Frequency [1/day] | k2_estim | k2_iso \n' # ana_ff_io_dict['line_2'] = ff_io_dict['line_2'] index = 0 iso_k1_data = [estimate_1.freq_vec[index], estimate_1.dyn_par[3] , estimate_1.ana_dyn_par[3] ] iso_k2_data = [estimate_1.freq_vec[index], estimate_1.dyn_par[4] , estimate_1.ana_dyn_par[4] ] # estimate_1.dyn_par[3:5], estimate_1.ana_dyn_par[3:5] k1_io_dict['line_0'] = 'Internal_areal_heat_capacity_k1 calc + ISO \n' k2_io_dict['line_0'] = 'Internal_areal_heat_capacity_k2 calc + ISO \n' # ana_ff_io_dict['line_0'] = 'FF_Trasform_' + 'ana Green function_' + '\n' ff_file_name1 = 'int_areal_heat_cap_1' ff_file_name2 = 'int_areal_heat_cap_2' # ana_ff_file_name = 'ana_ff_' + prefix_act estimate_1.write_solve ( 102, io_dict_loc_ext = k1_io_dict, file_name_ext = ff_file_name1, write_data = iso_k1_data ) estimate_1.write_solve ( 102, io_dict_loc_ext = k2_io_dict, file_name_ext = ff_file_name2, write_data = iso_k2_data ) elif which_uu_set == 2 : ana_u1, ana_u2, ana_u11, ana_u12, ana_u21, ana_u22 = estimate_1.do_utest ( which_uu = which_uu_set ) print ('==============================================================================================') print ('ana_u1, ana_u2, ana_u11, ana_u12, ana_u21, ana_u22 =', ana_u1, ana_u2, ana_u11, ana_u12, ana_u21, ana_u22 ) print ('==============================================================================================') # elif which_uu_set == 20 : # ana_u11, ana_u12, ana_u21, ana_u22 = estimate_1.do_utest ( which_uu = which_uu_set ) # print ('==============================================================================================') # print ('ana_u11, ana_u12, ana_u21, ana_u22 =', ana_u11, ana_u12, ana_u21, ana_u22 ) # print ('==============================================================================================') # print ('Error_11 =' , np.abs ( wallpl2.uu_noalf - ana_u11 ) / wallpl2.uu_noalf ) # print ('Error_12 =' , np.abs ( wallpl2.uu_noalf - ana_u12 ) / wallpl2.uu_noalf ) # print ('Error_21 =' , np.abs ( wallpl2.uu_noalf - ana_u21 ) / wallpl2.uu_noalf ) # print ('Error_22 =' , np.abs ( wallpl2.uu_noalf - ana_u22 ) / wallpl2.uu_noalf ) # print ('==============================================================================================') # ----------------- calculate Green function from impulse response----------------------- if data_sol1.calc_dict['impuls_green'] : estimate_1.impuls_green_calc ( ) # ----------------- Plot only Estimated Green function; no Analytical Green -------------------------------------------- if estimate_1.estim_dict['plot_estimate'] and data_sol1.calc_dict['do_estimate'] and \ ( not data_sol1.calc_dict['ana_green'] or ( data_sol1.calc_dict['ana_green'] and not estimate_1.estim_dict['exact_green_dict']['ana_green_plot'] ) ) : i_fig0 = plot_comp1 ( data_sol1, i_fig0, plot_me = 101, xylist_ext = estimate_1.estim_green, dict1 = estimate_1.estim_dict ) all_green = estimate_1.estim_dict['estim_green1'] and estimate_1.estim_dict['estim_green2'] # if data_sol1.calc_dict['do_dft'] : # data_sol1.dft ( estim_green = estimate_1.estim_green, uu_vect = estimate_1.uu_vect ) # sys.exit(0) if estimate_1.estim_dict['green_plot'] or ( data_sol1.calc_dict['ana_green'] and estimate_1.estim_dict['exact_green_dict']['ana_green_plot'] ) : #--------Plot Estimated + Analytival Green functions-------------------------------------------------------------------- dist_plot = False plot_list_ext = [None] if estimate_1.estim_dict['estim_green1'] and not estimate_1.estim_dict['estim_green2'] : start = 0 end = 2 elif not estimate_1.estim_dict['estim_green1'] and estimate_1.estim_dict['estim_green2'] : start = 2 end = 4 elif estimate_1.estim_dict['estim_green1'] and estimate_1.estim_dict['estim_green2'] : start = 0 end = 4 elif not estimate_1.estim_dict['estim_green1'] and not estimate_1.estim_dict['estim_green2'] and \ data_sol1.calc_dict['ana_green'] and estimate_1.estim_dict['exact_green_dict']['ana_green_plot'] : start = 0 end = 2 dist_plot = True if estimate_1.estim_dict['exact_green_dict']['green_plot_xt'] == 1 : plot_list_ext = [ estimate_1.estim_dict['exact_green_dict']['ana_t_list1'], estimate_1.estim_dict['exact_green_dict']['ana_t_list1'] ] abs_xt_coord = 'time_coordinates = ' abs_xt_index = 'time_index = ' calc_io_dict = { } calc_io_dict['line_0'] = '-------------------Green_function (x, t = t1,2,3,...)-------------- \n' calc_io_dict['line_4'] = ' x [m] | green (x, t1) | green (x, t1) | .... \n ' green_file_name0 = 'Ana_Green_x_dist_Exit_' elif estimate_1.estim_dict['exact_green_dict']['green_plot_xt'] == 2 : plot_list_ext = [ estimate_1.estim_dict['exact_green_dict']['ana_x_list1'], estimate_1.estim_dict['exact_green_dict']['ana_x_list1'] ] abs_xt_coord = 'x_coordinates = ' abs_xt_index = 'x_index = ' calc_io_dict = { } calc_io_dict['line_0'] = '-------------------Green_function (t, x = x1,2,3,...)------------- \n' calc_io_dict['line_4'] = ' time [sec] | green (t, x1) | green (t, x1) | .... \n ' green_file_name0 = 'Ana_Green_t_dist_Exit_' #----------------------------------------------------------------------------------------------------------------------- for i in range( start , end ) : if not dist_plot : plot_green_fl, xylist = estimate_1.plot_green ( i + 1 ) else : plot_green_fl, xylist, xt_coord , position_list = estimate_1.plot_green ( i + 1, ana_green_dist = dist_plot, plot_list = plot_list_ext[i] ) #----------------------------------------------------------------------------------------------------------------------- if data_sol1.calc_dict['write_green'] : # index = 0 calc_data = [xylist[0] ] calc_data1 = [ ] calc_io_dict['line_2'] = abs_xt_coord calc_io_dict['line_3'] = abs_xt_index for xt_act, xt_index in zip ( xt_coord, position_list ) : calc_io_dict['line_2'] += ' {: 9.16f} '. format (xt_act ) calc_io_dict['line_3'] += ' {: 6d} '. format (xt_index ) calc_io_dict['line_2'] += '\n' calc_io_dict['line_3'] += '\n' for data_act1 in xylist[1::2] : calc_data1.append(data_act1) calc_data = calc_data + calc_data1 calc_file_name = green_file_name0 + str( i + 1) data_sol1.write_solve ( 102, io_dict_loc_ext = calc_io_dict, file_name_ext = calc_file_name, write_data = calc_data ) #----------------------------------------------------------------------------------------------------------------------- if plot_green_fl : i_fig0 = plot_comp1 ( data_sol1, i_fig0, plot_me = 102, xylist_ext = xylist, dict4 = estimate_1.estim_dict['exact_green_dict'] ) if estimate_1.estim_dict['noise_green_plot'] : plot_green_fl, xylist = estimate_1.plot_green ( i + 1, noise = True ) if plot_green_fl : i_fig0 = plot_comp1 ( data_sol1, i_fig0, plot_me = 102, xylist_ext = xylist, dict4 = estimate_1.estim_dict['exact_green_dict'] ) #-----------------Plot predicetd quantities using analytical or estimated Green functions------------------------------- # sys.exit(0) if data_sol1.calc_dict['do_prediction'] and estimate_1.estim_dict['predict_dict']['predict_calc'] == 'all' and \ all_green : if estimate_1.estim_dict['estim_calc'] != 'no_calc' : #------------- Plot Input: inside & outside temperatures -------------------------------------------------------------- plot_green_fl, xylist = estimate_1.plot_green ( 55 ) if plot_green_fl : i_fig0 = plot_comp1 ( data_sol1, i_fig0, plot_me = 102, xylist_ext = xylist, dict4 = estimate_1.estim_dict['predict_dict'] ) #------------- Plot Output: inside & outside flux --------------------------------------------------------------------- plot_green_fl, xylist = estimate_1.plot_green ( 5 ) if plot_green_fl : i_fig0 = plot_comp1 ( data_sol1, i_fig0, plot_me = 102, xylist_ext = xylist, dict4 = estimate_1.estim_dict['predict_dict'] ) #------------- Plot Acumulated Heat : Q_inside, Q_outside, de_Q_outside ---------------------------------------------- plot_green_fl, xylist = estimate_1.plot_green ( 555 ) if plot_green_fl : i_fig0 = plot_comp1 ( data_sol1, i_fig0, plot_me = 102, xylist_ext = xylist, dict4 = estimate_1.estim_dict['predict_dict'] ) if estimate_1.estim_dict['plot_picard'] and estimate_1.estim_dict['do_picard_test'] : #------------- Plot Picard Conditions -------------------------------------------------------------------------------- plot_green_fl, xylist1, xylist2 = estimate_1.plot_green ( 51 ) if plot_green_fl : quant_1 , quant_2 , quant_3 = estimate_1.estim_dict['predict_dict']['label_function1'] estimate_1.estim_dict['predict_dict']['label_function1'] = [ quant_1 , quant_2 ] i_fig0 = plot_comp1 ( data_sol1, i_fig0, plot_me = 102, xylist_ext = xylist1, dict4 = estimate_1.estim_dict['predict_dict'] ) estimate_1.estim_dict['predict_dict']['label_function1'] = [ quant_3 ] i_fig0 = plot_comp1 ( data_sol1, i_fig0, plot_me = 102, xylist_ext = xylist2, dict4 = estimate_1.estim_dict['predict_dict'] ) plot_green_fl, xylist1, xylist2 = estimate_1.plot_green ( 52 ) if plot_green_fl : quant_1 , quant_2 , quant_3 = estimate_1.estim_dict['predict_dict']['label_function1'] estimate_1.estim_dict['predict_dict']['label_function1'] = [ quant_1 , quant_2 ] i_fig0 = plot_comp1 ( data_sol1, i_fig0, plot_me = 102, xylist_ext = xylist1, dict4 = estimate_1.estim_dict['predict_dict'] ) estimate_1.estim_dict['predict_dict']['label_function1'] = [ quant_3 ] i_fig0 = plot_comp1 ( data_sol1, i_fig0, plot_me = 102, xylist_ext = xylist2, dict4 = estimate_1.estim_dict['predict_dict'] ) #-----------------Plot L-curves----------------------------------------------------------------------------------------- if estimate_1.estim_dict['l_curve_dict']['l_plot'][0] and estimate_1.estim_dict['regularization'] != None and \ not estimate_1.estim_dict['super_test'] and data_sol1.calc_dict['do_prediction'] and \ data_sol1.estim_dict['reg_par'] == 1 and all_green: for i in range ( 2 ) : if estimate_1.estim_dict['l_curve_dict']['l_plot'][1] : #---------------------------- 6, 7, 8, 9 plot eta(ro)------------------------------------------------------------------- plot_l_curve, xylist = estimate_1.plot_green ( i + 6 ) if plot_l_curve : i_fig0 = plot_comp1 ( data_sol1, i_fig0, plot_me = 102, xylist_ext = xylist, dict4 = estimate_1.estim_dict['l_curve_dict'] ) if estimate_1.estim_dict['l_curve_dict']['l_plot'][2] : #---------------------------- 10, 11, 12, 13 plor curvature (lambda)---------------------------------------------------- # plot_l_curve, xylist = estimate_1.plot_green ( i + 10 ) plot_l_curve, xylist = estimate_1.plot_green ( i + 8 ) if plot_l_curve : i_fig0 = plot_comp1 ( data_sol1, i_fig0, plot_me = 102, xylist_ext = xylist, dict4 = estimate_1.estim_dict['l_curve_dict'] ) if estimate_1.estim_dict['l_curve_dict']['l_plot'][3] : #---------------------------- 14, 15, 16, 17 plot eta(lambda) & ro(lambda)---------------------------------------------- # plot_l_curve, xylist1, xylist2 = estimate_1.plot_green ( i + 14 ) plot_l_curve, xylist1, xylist2 = estimate_1.plot_green ( i + 10 ) if plot_l_curve : i_fig0 = plot_comp1 ( data_sol1, i_fig0, plot_me = 102, xylist_ext = xylist1, dict4 = estimate_1.estim_dict['l_curve_dict'] ) estimate_1.estim_dict['l_curve_dict']['label_function1'] = \ estimate_1.estim_dict['l_curve_dict']['label_function2'] if estimate_1.estim_dict['lambda_reg'][4][3] and i == 0: estimate_1.estim_dict['l_curve_dict']['ylabel_fig'] = 'log( ||L*x|| )' else : estimate_1.estim_dict['l_curve_dict']['ylabel_fig'] = '||L*x|| ' i_fig0 = plot_comp1 ( data_sol1, i_fig0, plot_me = 102, xylist_ext = xylist2, dict4 = estimate_1.estim_dict['l_curve_dict'] ) if estimate_1.estim_dict['predict_dict']['predict_calc'] == 'one' and data_sol1.calc_dict['do_prediction'] \ and all_green : print ( '-----------------------------------------------------------------------------------------------------') print ( 'predict_time =' , estimate_1.predict_time[estimate_1.predict_index_time]) print ( 'self.predict_calc1 =' , estimate_1.predict_calc1 ) print ( 'self.predict_calc2 =' , estimate_1.predict_calc2 ) print ( 'estimated_flux_1 = ' , estimate_1.predict_output1[estimate_1.predict_index_time] ) print ( 'estimated_flux_2 = ' , estimate_1.predict_output2[estimate_1.predict_index_time] ) # if not estimate_1.estim_dict['read_LsEstimClass'] : if estimate_1.estim_dict['write_estim_green'] and data_sol1.calc_dict['do_estimate'] and all_green : estimate_1.write_solve ( 6 , green_file = True ) print ( estimate_1.io_dict['noise_green_data'] ) if estimate_1.estim_dict['write_noise_green'] : estimate_1.write_solve ( 61 , green_file = True ) if estimate_1.estim_dict['exact_green_dict']['write_ana_green'] and all_green : estimate_1.write_solve ( 7 , green_file = True ) if estimate_1.estim_dict['predict_dict']['write_prediction'] : # print ('======================================================================================================') # print ('*********estim_part = ' , estimate_1.estim_dict['estim_part']) # print ('======================================================================================================') estimate_1.write_solve ( 51 ) estimate_1.write_solve ( 52 ) estimate_1.write_solve ( 53 ) estimate_1.write_solve ( 54 ) if estimate_1.estim_dict['do_picard_test'] : estimate_1.write_solve ( 55 ) # estimate_1.write_solve ( 55 ) time_end = time.process_time() print('**************************************************************************************************************',) print('Time start - end = ', time_end - time_start) print('**************************************************************************************************************',) #---------------------------------------------- run full garbage collection--------------------------------------------- gc.collect() #---------------------------------------------- run full garbage collection---------------------------------------------