def main(folder, solver, solver_name, dt): gb, domain = problem_data.create_grid(from_file=False, generate_network=True) data = {"domain": domain, "t_max": 5000} data["time_step"] = dt problem_data.add_data(gb, data, solver_name) solver(gb, folder) outflow_upper, outflow_lower = outlet_fluxes(gb) mean = mean_inlet_pressure(gb, solver_name) # to store the results for the current problem results = np.empty(8, dtype=np.object) # save basic informations results[0] = "UiB-" + solver_name.upper() results[1] = np.sum([g.num_cells for g in gb.grids_of_dimension(3)]) results[2] = np.sum([g.num_cells for g in gb.grids_of_dimension(2)]) results[3] = np.sum([g.num_cells for g in gb.grids_of_dimension(1)]) results[4] = np.sum([g.num_cells for g in gb.grids_of_dimension(0)]) results[5] = outflow_upper results[6] = outflow_lower results[7] = mean file_name = folder + "/info.txt" with open(file_name, "w") as f: f.write(", ".join(map(str, results))) T, outflow, A, b, block_dof, full_dof = solvers.transport( gb, data, solver_name, folder, callback=report_concentrations, save_every=1 )
def main(grid_file, folder, solver, solver_name, dt): gb, domain = problem_data.create_grid(grid_file) data = {"domain": domain, "t_max": 1} data["dt"] = dt problem_data.add_data(gb, data, solver_name) solver(gb, folder) outflow_upper, outflow_lower = outlet_fluxes(gb) mean = mean_inlet_pressure(gb, solver_name) # to store the results for the current problem results = np.empty(8, dtype=np.object) # save basic informations results[0] = "UiB-" + solver_name.upper() results[1] = np.sum([g.num_cells for g in gb.grids_of_dimension(3)]) results[2] = np.sum([g.num_cells for g in gb.grids_of_dimension(2)]) results[3] = np.sum([g.num_cells for g in gb.grids_of_dimension(1)]) results[4] = np.sum([g.num_cells for g in gb.grids_of_dimension(0)]) results[5] = outflow_upper results[6] = outflow_lower results[7] = mean file_name = folder + "/info.txt" with open(file_name, "w") as f: f.write(", ".join(map(str, results))) solvers.transport( gb, data, solver_name, folder, problem_data.AdvectiveDataAssigner, callback=report_concentrations, )