def __init__(s, config_file, polynomial_degree): s.parameters = Parameters(config_file) s.parameters.process_steady() s.__config = configparser.ConfigParser() s.__config.read(config_file) s.polynomial_degree = int(polynomial_degree) s.n_time_points = len(s.parameters.steady.index) s.props = Props(config_file) s.G_fact = np.array(s.parameters.steady['Qoutlet, st. m3/s']).copy() s.G_fact *= s.props.a_dens * 1.E+5 + s.props.b_dens s.G_calc = None s.G_rel_err = None s.G_theta_der = None s.A_leastsq = None s.F_leastsq = None s.theta = None s.theta_path = list() s.theta_perm_file = s.__config.get('Matching', 'theta_perm_file')
def __init__(s, config_file, polynomial_degree, theta_ini): s.__config = configparser.ConfigParser() s.__config.read(config_file) s.polynomial_degree = polynomial_degree s.props = Props(config_file) props_array = s.props.get_props_array() theta_files_array = s.props.get_theta_files_array() s.theta_ini = theta_ini s.theta = None s.theta_file = s.__config.get('Matching', 'theta_poro_file') s.parameters = Parameters(config_file) s.parameters.process_transient() time = s.parameters.transient.index.to_numpy() press_in = s.parameters.transient['Pinlet, Pa'].to_numpy() press_out = s.parameters.transient['Poutlet, Pa'].to_numpy() consumption = s.parameters.transient['Qoutlet, st. m3/s'].to_numpy() consumption *= s.props.a_dens * 1.E+5 + s.props.b_dens s.transient = Transient(props_array, theta_files_array, time, press_in, press_out, consumption) s.transient.load_theta_perm()
# from numerical import PropsPNMCpp from numerical import EquationPNM from numerical import Aggregator from input import Props from input import Network_Data_Fpnm from output import plot_x_y from output import plot_x_ymult from matplotlib import rc rc('text', usetex=True) plt.rcParams["font.family"] = "Times New Roman" # Reading properties in config file props = Props(config_file=sys.argv[1]) # Getting diffusion properties props_diff_vector = props.get_diff_props_array() time = props_diff_vector[0] time_step = props_diff_vector[1] thr_length = props_diff_vector[2] radius = props_diff_vector[3] eff_radius = props_diff_vector[4] grid_block_n = int(props_diff_vector[5]) conc_fracture_wall = props_diff_vector[6] diffusivity = props_diff_vector[7] it_accuracy = props_diff_vector[8] params_diffusion = { 'time': float(time),
dp.append(pressure_list[value[0]] - pressure_list[value[1]]) print('ic', inlet_conns) print('\n') print('dp', dp) flow_rates = matrix_coeff[0:len(inlet_conns)] * dp flow_rates = np.array(flow_rates) return np.sum(flow_rates) if __name__ == '__main__': t_start = perf_counter() props = Props(config_file=sys.argv[1]) network_data = Network_Data_Python(config_file=sys.argv[1]) network_data.process_throats() network_data.process_pores() network_data.process_pore_conns() network_data.get_all_conns() network_data.get_boundary_pores(network_data.pores['x_coord']) matrix_portrait = Matrix_Portrait(props, network_data) matrix_portrait.get_matrix_coeff() matrix_portrait.get_matrix_row() matrix_portrait.get_matrix_col() matrix_portrait.get_matrix_val()
import sys import os import numpy as np import pandas as pd import matplotlib.pyplot as plt current_path = os.path.dirname(os.path.abspath(__file__)) sys.path.append(os.path.join(current_path, '../')) from numerical import Steady, Transient from input import Props, Parameters props = Props(config_file=sys.argv[1]) props_array = props.get_props_array() theta_files_array = props.get_theta_files_array() parameters = Parameters(config_file=sys.argv[1]) # parameters.process_steady() # time = parameters.steady.index.to_numpy() # press_in = parameters.steady['Pinlet, Pa'].to_numpy() # press_out = parameters.steady['Poutlet, Pa'].to_numpy() # consumption = parameters.steady['Qoutlet, st. m3/s'].copy().to_numpy() # consumption *= props.a_dens * 1.E+5 + props.b_dens # steady = Steady(props_array, theta_files_array, # time, press_in, press_out, consumption) # # # theta_perm = np.loadtxt(props.theta_perm_file, dtype=float) # # empirical_risk = steady.calculate_empirical_risk(theta_perm) # # steady.load_theta_perm()