def create_err_paths(mainDir,temperature_dict,flow_velocity_dict): ''' @description generate the paths to the folders containing the maximum of the error in time ''' main_err_dirs = os.path.join(mainDir) err_dirs = [] for temperature in [0.95,0.99,0.995,0.999]: # add a new array to store the flow velocity entries # at this temperature err_dirs.append([]) T_i = temperature_dict[str(temperature)] for flow_velocity in [0.05,0.1,0.25,0.5]: # add a new array to store the md_threshold entries # at this flow velocity err_dirs[T_i].append([]) v_i = flow_velocity_dict[str(flow_velocity)] for md_threshold in [0,0.05,0.1,0.2,0.3]: dir_name = get_simulation_dir(temperature,flow_velocity,md_threshold=md_threshold) err_dir = os.path.join(main_err_dirs,dir_name,'error','error_max.nc') err_dirs[T_i][v_i].append(err_dir) return err_dirs
def get_paths_lg_simulations(main_lg_dirs, temperature_array, flow_velocity_array, temperature_dict, flow_velocity_dict): ''' @description create the paths to the results of the large domain ''' lg_dirs = [] lg_dirs.append([]) for temperature in temperature_array: for flow_velocity in flow_velocity_array: dir_name = get_simulation_dir(temperature,flow_velocity) lg_dir = os.path.join(main_lg_dirs,dir_name,'lg_domain','tr_files') lg_dirs[temperature_dict[str(temperature)]].append(lg_dir) lg_dirs.append([]) return lg_dirs
data = [] legendParam = [] graphPties = [] for temperature in temperature_array: data_error = [] data_error.append([]) data_error.append([]) for dct_distance in dctDistance_array: # get the path for the error file dir_name = get_simulation_dir(temperature, flow_velocity, dct_distance=dct_distance) errorPath = os.path.join(mainDir,dir_name,'error','error_max.nc') if(os.path.isfile(errorPath)): # extract the error data [time_rescaled,error] = extract_max_error_in_time(errorPath) # stored the error data for the graph data.append([time_rescaled,error]) #set the legend properties legendParam.append(dct_distance)
def generate_simulation_error_files( main_sm_dirs, main_lg_dirs, temperature_dict, flow_velocity_dict, lg_dirs, temperature_array, flow_velocity_array, dct_distance_array=[4], md_threshold_array=[0], ic_perturbation_array=[0], li_perturbation_array=[0], bc_perturbation_T0_array=[0], bc_perturbation_vx0_array=[0], bc_perturbation_vy0_array=[0] ): ''' @description generate the error files for the results ''' for bc_perturbation_T0 in bc_perturbation_T0_array: for bc_perturbation_vx0 in bc_perturbation_vx0_array: for bc_perturbation_vy0 in bc_perturbation_vy0_array: for li_perturbation in li_perturbation_array: for ic_perturbation in ic_perturbation_array: for md_threshold in md_threshold_array: for dct_distance in dct_distance_array: for flow_velocity in flow_velocity_array: for temperature in temperature_array: #print the parameters for which the error files are generated print 'temperature : '+str(temperature) print 'velocity : '+str(flow_velocity) print 'threshold : '+str(md_threshold) print 'ic_perturbation : '+str(ic_perturbation) print 'li_pertrubation : '+str(li_perturbation) print 'bc_perturbation_vy0: '+str(bc_perturbation_vy0) print 'bc_perturbation_vx0: '+str(bc_perturbation_vx0) print 'bc_perturbation_T0 : '+str(bc_perturbation_T0) print '------------------------------------------------------------' #small domain simulation results dir_name = get_simulation_dir(temperature, flow_velocity, dct_distance=dct_distance, md_threshold=md_threshold, ic_perturbation_amp=ic_perturbation, li_perturbation_amp=li_perturbation, bc_perturbation_T0_amp=bc_perturbation_T0*temperature, bc_perturbation_vx0_amp=bc_perturbation_vx0, bc_perturbation_vy0_amp=bc_perturbation_vy0*flow_velocity) dataDir_sm_domain = os.path.join(main_sm_dirs, dir_name, 'sm_domain') #large domain simulation results T_i = temperature_dict[str(temperature)] v_i = flow_velocity_dict[str(flow_velocity)] dataDir_lg_domain = lg_dirs[T_i][v_i] if(not li_perturbation==0): dataDir_lg_domain = os.path.join(main_lg_dirs, dir_name, 'lg_domain', 'tr_files') #check whether the sm_domain path exists sm_domain_exists = os.path.isdir(dataDir_sm_domain) if(not sm_domain_exists): print 'sm_domain_path: ', dataDir_sm_domain print '**** path does not exist ****' #check whether the lg_domain path exists lg_domain_exists = os.path.isdir(dataDir_lg_domain) if(not lg_domain_exists): print 'lg_domain_path: ', dataDir_lg_domain print '**** path does not exist ****' #generate the error files by comparing the #two simulations if(sm_domain_exists and lg_domain_exists): generate_error_files( dataDir_sm_domain, dataDir_lg_domain)