def RunCase(varying_parameters): import sys import ProjectParameters as pp import DEM_explicit_solver_var as DEM_parameters import marine_rain_algorithm with marine_rain_algorithm.Algorithm(varying_parameters) as algorithm: try: test = script.Solution(algorithm) test.alg.Run() except: error = sys.exc_info() print(error) del pp del DEM_parameters del marine_rain_algorithm del sys
def RunCase(self, parameters, simulation_id, identification_text=''): self.simulation_id = simulation_id self.identification_text = identification_text self.SayStartMessage() try: with script.Solution(self.algorithm, parameters) as test: test.Run() error = None message_start = 'Successfully finished running simulation number ' + str( simulation_id) self.FinishAndSayEndMessage(message_start) except Exception: error = sys.exc_info() message_start = 'Finished running simulation number ' + str( simulation_id) self.FinishAndSayEndMessage(message_start) Say('The simulation crashed.') os.chdir(self.main_path) return error
import ProjectParameters as pp import DEM_explicit_solver_var as DEM_parameters import json varying_parameters = dict() combinations_that_failed = [] errors = [] varying_parameters["fluid_already_calculated"] = False varying_parameters["do_search_neighbours"] = False varying_parameters["full_particle_history_watcher"] = 'ParticlesHistoryWatcher' varying_parameters["stationary_problem_option"] = True parameters = Parameters(json.dumps(varying_parameters)) import t_junction_algorithm with t_junction_algorithm.Algorithm(parameters) as algorithm: try: test = script.Solution(algorithm, parameters) test.alg.Run() except: error = sys.exc_info() errors.append(error) combinations_that_failed.append( 'Combination: fluid_already_calculated = False') print() print('****************************************') if len(combinations_that_failed): print('The following combinations produced an error:') print() for combination, error in zip(combinations_that_failed, errors): print(combination)
print(error_message) tolerance = 1e-4 errors = [] error_names = [] varying_parameters = dict() varying_parameters['simulation_time'] = 1 varying_parameters['Nq'] = 1 varying_parameters['m'] = 10 varying_parameters['number_of_quadrature_steps_in_window'] = 10 varying_parameters['basset_force_type'] = 0 # No history force benchmark import candelier_algorithm test = script.Solution(candelier_algorithm.Algorithm(varying_parameters), varying_parameters) error_names.append('No history force, Daitche') errors.append(test.alg.Run()) varying_parameters['basset_force_type'] = 2 # Second-order accurate Daitche benchmark test = script.Solution(candelier_algorithm.Algorithm(varying_parameters), varying_parameters) error_names.append('All forces, Daitche') errors.append(test.alg.Run()) # Output print() print('-----------------------') print('Candelier tests results') print('-----------------------')
varying_parameters["print_MATERIAL_ACCELERATION_option"] = False varying_parameters["print_MATERIAL_FLUID_ACCEL_PROJECTED_option"] = True varying_parameters["print_BASSET_FORCE_option"] = True varying_parameters["print_VORTICITY_option"] = False varying_parameters["print_VELOCITY_GRADIENT_option"] = False varying_parameters["initial_averaging_time"] = 0.005 varying_parameters["stationary_start_time"] = 0.0 varying_parameters["interaction_start_time"] = 0.006 varying_parameters["steps_per_average_step"] = 1 varying_parameters["rotated_stationary_flow_option"] = False varying_parameters["averaging_has_already_been_done"] = False varying_parameters["do_write_results_to_hdf5"] = False varying_parameters["time_steps_per_analytic_processing_step"] = 1000 parameters = Parameters(json.dumps(varying_parameters)) with script.Solution(rotating_ale_algorithm, parameters) as test: test.Run() print('\n****************************************') if len(combinations_that_failed): print('The following combinations produced an error:\n') for combination, error in zip(combinations_that_failed, errors): print(combination) print(error) else: print('All combinations run without errors') print('****************************************\n')
def RunCase(varying_parameters, name): parameters = Parameters(json.dumps(varying_parameters)) with script.Solution(candelier_algorithm, parameters) as test: error_names.append(name) errors.append(test.Run())
import KratosSwimmingDEM as script import colloids_algorithm test = script.Solution(colloids_algorithm) test.Run()
import os import sys sys.path.append(os.getcwd()) import json import fileinput from KratosMultiphysics import * import KratosSwimmingDEM as script import swimming_DEM_algorithm for i in range(10): test = script.Solution() test.Run()
irregular_mesh_sizes = set() #{0.1, 0.2, 0.4} regular_mesh_n_points = [10, 20, 40] derivatives_types = [6] combinations_that_failed = [] errors = [] for size in irregular_mesh_sizes.union(regular_mesh_n_points): varying_parameters['size_parameter'] = size for derivatives_type in derivatives_types: varying_parameters[ 'material_acceleration_calculation_type'] = derivatives_type varying_parameters['laplacian_calculation_type'] = derivatives_type import ethier_benchmark_algorithm with ethier_benchmark_algorithm.Algorithm( varying_parameters) as algorithm: try: test = script.Solution(algorithm, varying_parameters) test.alg.Run() except: error = sys.exc_info() errors.append(error) combinations_that_failed.append({ 'size': size, 'type': derivatives_type }) print() print('****************************************') if len(combinations_that_failed): print('The following combinations produced an error:') print()
import KratosSwimmingDEM as script import os import pre_calculated_fluid_algorithm test = script.Solution(pre_calculated_fluid_algorithm) test.Run()
result = line sys.stdout.write(result) # outer_globals = ['gc', 'parameters', 'fileinput', 'json', 'sys', 'os', 'material_acceleration_calculation_type', 'radius', 'varying_parameters', 'combinations_that_failed', 'errors', 'set_of_material_acceleration_calculation_types', 'L', 'set_of_inlet_radii', 'ReplaceInletMDPAMeanRadiusValue', 'outer_globals'] print('problems\n', objgraph.show_growth(limit=1000)) for radius in set_of_inlet_radii: # ReplaceInletMDPAMeanRadiusValue(radius) for material_acceleration_calculation_type in set_of_material_acceleration_calculation_types: varying_parameters[ "material_acceleration_calculation_type"] = material_acceleration_calculation_type parameters = Parameters(json.dumps(varying_parameters)) with script.Solution(pre_calculated_fluid_analysis, parameters) as test: test.Run() # try: # test = script.Solution(algorithm, parameters) # test.Run() # del test # del script # except: # error = sys.exc_info() # errors.append(error) # combinations_that_failed.append('Combination: fluid_already_calculated = False') print('problems\n', objgraph.show_growth(limit=1000)) objgraph.show_backrefs(objgraph.by_type('Algorithm'), filename='chain.png')
result = line sys.stdout.write(result) # outer_globals = ['gc', 'parameters', 'fileinput', 'json', 'sys', 'os', 'material_acceleration_calculation_type', 'radius', 'varying_parameters', 'combinations_that_failed', 'errors', 'set_of_material_acceleration_calculation_types', 'L', 'set_of_inlet_radii', 'ReplaceInletMDPAMeanRadiusValue', 'outer_globals'] print('problems\n', objgraph.show_growth(limit=1000)) for radius in set_of_inlet_radii: # ReplaceInletMDPAMeanRadiusValue(radius) for material_acceleration_calculation_type in set_of_material_acceleration_calculation_types: varying_parameters[ "material_acceleration_calculation_type"] = material_acceleration_calculation_type parameters = Parameters(json.dumps(varying_parameters)) with script.Solution(pre_calculated_fluid_algorithm, parameters) as test: test.Run() # try: # test = script.Solution(algorithm, parameters) # test.Run() # del test # del script # except: # error = sys.exc_info() # errors.append(error) # combinations_that_failed.append('Combination: fluid_already_calculated = False') print('problems\n', objgraph.show_growth(limit=1000)) objgraph.show_backrefs(objgraph.by_type('Algorithm'), filename='chain.png')
varying_parameters = dict() irregular_mesh_sizes = [] #[0.1, 0.2, 0.4] regular_mesh_n_points = [10, 20, 40] derivatives_types = [1, 3, 4, 5, 6, 7] combinations_that_failed = [] errors = [] for size in irregular_mesh_sizes + regular_mesh_n_points: varying_parameters['size_parameter'] = size for derivatives_type in derivatives_types: varying_parameters[ 'material_acceleration_calculation_type'] = derivatives_type varying_parameters['laplacian_calculation_type'] = derivatives_type parameters = Parameters(json.dumps(varying_parameters)) import ethier_benchmark_algorithm with script.Solution(ethier_benchmark_algorithm, parameters) as test: try: test.Run() except: error = sys.exc_info() errors.append(error) combinations_that_failed.append({ 'size': size, 'type': derivatives_type }) print() print('****************************************') if len(combinations_that_failed): print('The following combinations produced an error:')