def setUp(self): with controlledExecutionScope(self.path): print(os.getcwd()) with open(self.file_name + "_parameters.json", 'r') as parameter_file: parameters = KratosMultiphysics.Parameters( parameter_file.read()) # To avoid many prints if (parameters["problem_data"]["echo_level"].GetInt() == 0): KratosMultiphysics.Logger.GetDefaultOutput().SetSeverity( KratosMultiphysics.Logger.Severity.WARNING) self.problem_name = parameters["problem_data"][ "problem_name"].GetString() model_part = KratosMultiphysics.ModelPart(self.problem_name) self.response_function = structural_response_function_factory.CreateResponseFunction( "dummy", parameters["kratos_response_settings"], model_part) # import model part model_part_io = KratosMultiphysics.ModelPartIO( parameters["problem_data"]["problem_name"].GetString()) model_part.ProcessInfo.SetValue(KratosMultiphysics.DOMAIN_SIZE, 3) model_part_io.ReadModelPart(model_part) # call response function self.response_function.Initialize()
def __CreateAndAddGivenResponse( self, response_id, response_settings ): response_type = response_settings["response_type"].GetString() if response_type in ["strain_energy", "mass", "eigenfrequency"]: model = Model() model.AddModelPart(self.optimization_model_part) self.list_of_response_functions[response_id] = structural_response_function_factory.CreateResponseFunction(response_id, response_settings, model) else: raise NameError("The following response function is not available for optimization: " + response_id)
def setUp(self): with controlledExecutionScope(_get_test_working_dir()): with open(self.file_name + "_parameters.json",'r') as parameter_file: parameters = KratosMultiphysics.Parameters( parameter_file.read()) # To avoid many prints if (parameters["problem_data"]["echo_level"].GetInt() == 0): KratosMultiphysics.Logger.GetDefaultOutput().SetSeverity(KratosMultiphysics.Logger.Severity.WARNING) self.problem_name = parameters["problem_data"]["problem_name"].GetString() model = KratosMultiphysics.Model() self.response_function = structural_response_function_factory.CreateResponseFunction("dummy", parameters["kratos_response_settings"], model) # call response function self.response_function.Initialize()