def CheckHistoricalNonUniformValues(model_part, variable, file_name, output_reference_solution=False): if output_reference_solution: OutputReferenceSolution(model_part, variable, file_name) else: full_model_part_name = GetFullModelPartName(model_part) check_parameters = KM.Parameters("""{ "check_variables" : [], "input_file_name" : "", "model_part_name" : "", "tolerance" : 1e-6, "relative_tolerance" : 1e-9, "time_frequency" : 0.00, "check_only_local_entities" : true }""") # TODO check all entities, requires some syncronization though! check_parameters["check_variables"].Append(variable.Name()) check_parameters["input_file_name"].SetString(file_name + ".json") check_parameters["model_part_name"].SetString(full_model_part_name) check_proc = from_json_check_result_process.FromJsonCheckResultProcess( model_part.GetModel(), check_parameters) check_proc.ExecuteInitialize() check_proc.ExecuteFinalizeSolutionStep()
def _normal_check_process_tests(self, input_filename, custom_submodel_part=""): KM.Logger.GetDefaultOutput().SetSeverity(KM.Logger.Severity.WARNING) self.model = KM.Model() self.main_model_part = self.model.CreateModelPart("Main", 2) self.main_model_part.AddNodalSolutionStepVariable(KM.NORMAL) self.main_model_part.CloneTimeStep(1.01) KM.ModelPartIO(input_filename).ReadModelPart(self.main_model_part) if custom_submodel_part == "": KM.VariableUtils().SetFlag( KM.INTERFACE, True, self.main_model_part.GetSubModelPart( "CONTACT_Contact_slave_Auto1").Nodes) KM.VariableUtils().SetFlag( KM.INTERFACE, True, self.main_model_part.GetSubModelPart( "CONTACT_Contact_master_Auto1").Nodes) else: KM.VariableUtils().SetFlag( KM.INTERFACE, True, self.main_model_part.GetSubModelPart( custom_submodel_part).Nodes) ## DEBUG #KM.ComputeNodesMeanNormalModelPart(self.main_model_part, True) # Check normals check_process = CSMA.NormalCheckProcess(self.main_model_part) check_process.Execute() ## DEBUG #self.__post_process() check_parameters = KM.Parameters(""" { "check_variables" : ["NORMAL"], "input_file_name" : "", "model_part_name" : "Main", "check_for_flag" : "INTERFACE", "historical_value" : true, "time_frequency" : 0.0 } """) check_parameters["input_file_name"].SetString(input_filename + "_check_normal.json") check = from_json_check_result_process.FromJsonCheckResultProcess( self.model, check_parameters) check.ExecuteInitialize() check.ExecuteBeforeSolutionLoop() check.ExecuteFinalizeSolutionStep()
def _mapper_tests(self, input_filename, num_nodes, master_num_nodes, pure_implicit=False, inverted=False, discontinuous=False, origin_are_conditions=True, destination_are_conditions=True, consider_tessellation=False, tolerance_factor=1.0): self.__base_test_mapping(input_filename, num_nodes, master_num_nodes, pure_implicit, inverted, discontinuous, origin_are_conditions, destination_are_conditions, consider_tessellation) self.mortar_mapping_double.Execute() self.mortar_mapping_vector.Execute() # Debug postprocess file #self.__post_process() check_parameters = KratosMultiphysics.Parameters(""" { "check_variables" : ["TEMPERATURE","DISPLACEMENT"], "input_file_name" : "", "model_part_name" : "Main", "sub_model_part_name" : "Parts_Parts_Auto1", "tolerance" : 1e-3, "relative_tolerance" : 1e-6 } """) check_parameters["tolerance"].SetDouble( tolerance_factor * check_parameters["tolerance"].GetDouble()) check_parameters["relative_tolerance"].SetDouble( tolerance_factor * check_parameters["relative_tolerance"].GetDouble()) if inverted: check_parameters["input_file_name"].SetString(input_filename + "_inverted.json") else: check_parameters["input_file_name"].SetString(input_filename + ".json") check = from_json_check_result_process.FromJsonCheckResultProcess( self.model, check_parameters) check.ExecuteInitialize() check.ExecuteBeforeSolutionLoop() check.ExecuteFinalizeSolutionStep()
def test_remesh_rectangle_hessian(self): KratosMultiphysics.Logger.GetDefaultOutput().SetSeverity( KratosMultiphysics.Logger.Severity.WARNING) # We create the model part current_model = KratosMultiphysics.Model() main_model_part = current_model.CreateModelPart("MainModelPart", 2) main_model_part.ProcessInfo.SetValue(KratosMultiphysics.DOMAIN_SIZE, 2) main_model_part.ProcessInfo.SetValue(KratosMultiphysics.TIME, 0.0) main_model_part.ProcessInfo.SetValue(KratosMultiphysics.DELTA_TIME, 1.0) #main_model_part.ProcessInfo.SetValue(KratosMultiphysics.STEP, 1) # We add the variables needed main_model_part.AddNodalSolutionStepVariable( KratosMultiphysics.DISTANCE) # We import the model main_model_part file_path = os.path.dirname(os.path.realpath(__file__)) KratosMultiphysics.ModelPartIO(file_path + "/mmg_lagrangian_test/remesh_rectangle" ).ReadModelPart(main_model_part) # We calculate the gradient of the distance variable find_nodal_h = KratosMultiphysics.FindNodalHNonHistoricalProcess( main_model_part) find_nodal_h.Execute() KratosMultiphysics.VariableUtils().SetNonHistoricalVariable( KratosMultiphysics.NODAL_AREA, 0.0, main_model_part.Nodes) main_model_part.Nodes[1].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 9.86358e-08) main_model_part.Nodes[2].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 4.88117e-07) main_model_part.Nodes[3].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 8.21649e-07) main_model_part.Nodes[4].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 2.98426e-06) main_model_part.Nodes[5].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 1.9462e-06) main_model_part.Nodes[6].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 3.20072e-06) main_model_part.Nodes[7].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 8.13038e-07) main_model_part.Nodes[8].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 1.74975e-06) main_model_part.Nodes[9].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 8.66819e-06) main_model_part.Nodes[10].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 6.24329e-06) main_model_part.Nodes[11].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 1.10461e-05) main_model_part.Nodes[12].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 7.01043e-07) main_model_part.Nodes[13].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 1.90256e-05) main_model_part.Nodes[14].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 2.51694e-06) main_model_part.Nodes[15].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 1.51568e-05) main_model_part.Nodes[16].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 3.0177e-05) main_model_part.Nodes[17].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 8.48471e-06) main_model_part.Nodes[18].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 8.37749e-08) main_model_part.Nodes[19].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 4.64653e-07) main_model_part.Nodes[20].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 2.64854e-05) main_model_part.Nodes[21].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 3.71692e-05) main_model_part.Nodes[22].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 3.28506e-06) main_model_part.Nodes[23].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 1.97626e-05) main_model_part.Nodes[24].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 6.49145e-05) main_model_part.Nodes[25].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 1, 20e-02) main_model_part.Nodes[26].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 4.05303e-05) main_model_part.Nodes[27].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 6.49053e-05) main_model_part.Nodes[28].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 3.71567e-05) main_model_part.Nodes[29].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 3.01782e-05) main_model_part.Nodes[30].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000118602) main_model_part.Nodes[31].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 5.74756e-05) main_model_part.Nodes[32].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 6.26979e-05) main_model_part.Nodes[33].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 6.33597e-05) main_model_part.Nodes[34].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000101589) main_model_part.Nodes[35].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000192486) main_model_part.Nodes[36].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 9.93803e-05) main_model_part.Nodes[37].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000116324) main_model_part.Nodes[38].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 7.68763e-05) main_model_part.Nodes[39].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000149051) main_model_part.Nodes[40].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000289484) main_model_part.Nodes[41].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000192959) main_model_part.Nodes[42].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000145925) main_model_part.Nodes[43].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 9.79472e-05) main_model_part.Nodes[44].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000201518) main_model_part.Nodes[45].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000401176) main_model_part.Nodes[46].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000291243) main_model_part.Nodes[47].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000205528) main_model_part.Nodes[48].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000119595) main_model_part.Nodes[49].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000262135) main_model_part.Nodes[50].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000415149) main_model_part.Nodes[51].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.00053798) main_model_part.Nodes[52].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000268931) main_model_part.Nodes[53].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000139653) main_model_part.Nodes[54].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000331001) main_model_part.Nodes[55].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000546243) main_model_part.Nodes[56].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000675476) main_model_part.Nodes[57].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000327043) main_model_part.Nodes[58].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000158685) main_model_part.Nodes[59].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.00039571) main_model_part.Nodes[60].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000651727) main_model_part.Nodes[61].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000370579) main_model_part.Nodes[62].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000809699) main_model_part.Nodes[63].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000170989) main_model_part.Nodes[64].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000445764) main_model_part.Nodes[65].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000784852) main_model_part.Nodes[66].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000433683) main_model_part.Nodes[67].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000914023) main_model_part.Nodes[68].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000179197) main_model_part.Nodes[69].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.00047077) main_model_part.Nodes[70].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000904417) main_model_part.Nodes[71].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000464902) main_model_part.Nodes[72].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000994274) main_model_part.Nodes[73].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000173952) main_model_part.Nodes[74].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000466276) main_model_part.Nodes[75].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000971188) main_model_part.Nodes[76].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000474027) main_model_part.Nodes[77].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000946149) main_model_part.Nodes[78].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000160469) main_model_part.Nodes[79].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000397979) main_model_part.Nodes[80].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000996743) main_model_part.Nodes[81].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000455294) main_model_part.Nodes[82].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000925016) main_model_part.Nodes[83].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000132904) main_model_part.Nodes[84].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000373155) main_model_part.Nodes[85].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000963824) main_model_part.Nodes[86].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000386671) main_model_part.Nodes[87].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000858186) main_model_part.Nodes[88].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 9.47787e-05) main_model_part.Nodes[89].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000851174) main_model_part.Nodes[90].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000282759) main_model_part.Nodes[91].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000285314) main_model_part.Nodes[92].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000688848) main_model_part.Nodes[93].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 4.35228e-05) main_model_part.Nodes[94].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000686866) main_model_part.Nodes[95].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000179265) main_model_part.Nodes[96].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000175715) main_model_part.Nodes[97].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000386179) main_model_part.Nodes[98].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 1.59849e-05) main_model_part.Nodes[99].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 1.7304e-05) main_model_part.Nodes[100].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0.000382607) main_model_part.Nodes[101].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0) main_model_part.Nodes[102].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0) main_model_part.Nodes[103].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0) main_model_part.Nodes[104].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0) main_model_part.Nodes[105].SetSolutionStepValue( KratosMultiphysics.DISTANCE, 0) # We set to zero the metric ZeroVector = KratosMultiphysics.Vector(3) ZeroVector[0] = 0.0 ZeroVector[1] = 0.0 ZeroVector[2] = 0.0 for node in main_model_part.Nodes: node.SetValue(MeshingApplication.METRIC_TENSOR_2D, ZeroVector) # We define a metric using the ComputeLevelSetSolMetricProcess MetricParameters = KratosMultiphysics.Parameters(""" { "hessian_strategy_parameters" :{ "estimate_interpolation_error" : false, "interpolation_error" : 1.0e-6, "mesh_dependent_constant" : 0.28125 }, "minimal_size" : 0.015, "maximal_size" : 0.5, "sizing_parameters": { "boundary_layer_max_distance" : 1.0, "interpolation" : "constant" }, "enforce_current" : false, "anisotropy_remeshing" : false, "enforce_anisotropy_relative_variable" : false } """) metric_process = MeshingApplication.ComputeHessianSolMetricProcess( main_model_part, KratosMultiphysics.DISTANCE, MetricParameters) metric_process.Execute() mmg_parameters = KratosMultiphysics.Parameters(""" { "filename" : "mmg_lagrangian_test/remesh_rectangle", "save_external_files" : true, "echo_level" : 0 } """) # We create the remeshing utility mmg_parameters["filename"].SetString( file_path + "/" + mmg_parameters["filename"].GetString()) mmg_process = MeshingApplication.MmgProcess2D(main_model_part, mmg_parameters) # We remesh mmg_process.Execute() ## Finally we export to GiD #from gid_output_process import GiDOutputProcess #gid_output = GiDOutputProcess(main_model_part, #"gid_output", #KratosMultiphysics.Parameters(""" #{ #"result_file_configuration" : { #"gidpost_flags": { #"GiDPostMode": "GiD_PostBinary", #"WriteDeformedMeshFlag": "WriteUndeformed", #"WriteConditionsFlag": "WriteConditions", #"MultiFileFlag": "SingleFile" #}, #"nodal_results" : ["DISTANCE"], #"nodal_nonhistorical_results": ["METRIC_TENSOR_2D","AUXILIAR_GRADIENT","AUXILIAR_HESSIAN"] #} #} #""") #) #gid_output.ExecuteInitialize() #gid_output.ExecuteBeforeSolutionLoop() #gid_output.ExecuteInitializeSolutionStep() #gid_output.PrintOutput() #gid_output.ExecuteFinalizeSolutionStep() #gid_output.ExecuteFinalize() import KratosMultiphysics.from_json_check_result_process as from_json_check_result_process json_check_parameters = KratosMultiphysics.Parameters(""" { "check_variables" : ["METRIC_TENSOR_2D"], "input_file_name" : "mmg_lagrangian_test/remesh_rectangle_post_metric.json", "model_part_name" : "MainModelPart", "historical_value" : false, "time_frequency" : 0.0 } """) json_check_parameters["input_file_name"].SetString( file_path + "/" + json_check_parameters["input_file_name"].GetString()) json_check = from_json_check_result_process.FromJsonCheckResultProcess( current_model, json_check_parameters) json_check.ExecuteInitialize() json_check.ExecuteFinalizeSolutionStep() # We check the solution check_parameters = KratosMultiphysics.Parameters(""" { "reference_file_name" : "mmg_lagrangian_test/remesh_rectangle_result.sol", "output_file_name" : "mmg_lagrangian_test/remesh_rectangle_step=0.sol", "dimension" : 2, "comparison_type" : "sol_file" } """) check_parameters["reference_file_name"].SetString( file_path + "/" + check_parameters["reference_file_name"].GetString()) check_parameters["output_file_name"].SetString( file_path + "/" + check_parameters["output_file_name"].GetString()) check_files = CompareTwoFilesCheckProcess(check_parameters) check_files.ExecuteInitialize() check_files.ExecuteBeforeSolutionLoop() check_files.ExecuteInitializeSolutionStep() check_files.ExecuteFinalizeSolutionStep() check_files.ExecuteFinalize()
def _dynamic_search_tests(self, input_filename, num_nodes): KM.Logger.GetDefaultOutput().SetSeverity(KM.Logger.Severity.WARNING) self.model = KM.Model() self.main_model_part = self.model.CreateModelPart("Structure", 2) self.main_model_part.AddNodalSolutionStepVariable(KM.DISPLACEMENT) self.main_model_part.AddNodalSolutionStepVariable(KM.VELOCITY) self.main_model_part.AddNodalSolutionStepVariable(KM.ACCELERATION) self.main_model_part.AddNodalSolutionStepVariable( KM.VOLUME_ACCELERATION) self.main_model_part.AddNodalSolutionStepVariable(KM.REACTION) self.main_model_part.AddNodalSolutionStepVariable(KM.NORMAL) self.main_model_part.AddNodalSolutionStepVariable( CSMA.LAGRANGE_MULTIPLIER_CONTACT_PRESSURE) self.main_model_part.AddNodalSolutionStepVariable(CSMA.WEIGHTED_GAP) self.main_model_part.AddNodalSolutionStepVariable(KM.NODAL_H) self.main_model_part.CloneTimeStep(1.01) KM.ModelPartIO(input_filename).ReadModelPart(self.main_model_part) KM.VariableUtils().AddDof(KM.DISPLACEMENT_X, KM.REACTION_X, self.main_model_part) KM.VariableUtils().AddDof(KM.DISPLACEMENT_Y, KM.REACTION_Y, self.main_model_part) KM.VariableUtils().AddDof(KM.DISPLACEMENT_Z, KM.REACTION_Z, self.main_model_part) KM.VariableUtils().AddDof(CSMA.LAGRANGE_MULTIPLIER_CONTACT_PRESSURE, CSMA.WEIGHTED_GAP, self.main_model_part) if self.main_model_part.HasSubModelPart("Contact"): interface_model_part = self.main_model_part.GetSubModelPart( "Contact") else: interface_model_part = self.main_model_part.CreateSubModelPart( "Contact") self.contact_model_part = self.main_model_part.GetSubModelPart( "DISPLACEMENT_Displacement_Auto2") model_part_slave = self.main_model_part.GetSubModelPart( "Parts_Parts_Auto1") #model_part_master = self.main_model_part.GetSubModelPart("Parts_Parts_Auto2") KM.VariableUtils().SetFlag(KM.SLAVE, False, self.contact_model_part.Nodes) KM.VariableUtils().SetFlag(KM.MASTER, True, self.contact_model_part.Nodes) KM.VariableUtils().SetFlag(KM.SLAVE, True, model_part_slave.Nodes) KM.VariableUtils().SetFlag(KM.MASTER, False, model_part_slave.Nodes) for node in model_part_slave.Nodes: # DEBUG #node.X -= 9.81 / 32.0 #node.SetSolutionStepValue(KM.DISPLACEMENT_X, -9.81 / 32.0) node.SetSolutionStepValue(KM.ACCELERATION_X, 1, -9.81) self.main_model_part.ProcessInfo[KM.STEP] = 1 self.main_model_part.ProcessInfo[KM.DELTA_TIME] = 0.5 for prop in self.main_model_part.GetProperties(): prop[CSMA.INTEGRATION_ORDER_CONTACT] = 3 self.main_model_part.ProcessInfo[CSMA.ACTIVE_CHECK_FACTOR] = 3.0e-1 KM.VariableUtils().SetFlag(KM.INTERFACE, True, self.contact_model_part.Nodes) pre_process = CSMA.InterfacePreprocessCondition(self.main_model_part) interface_parameters = KM.Parameters( """{"simplify_geometry": false}""") pre_process.GenerateInterfacePart(self.contact_model_part, interface_parameters) # We copy the conditions to the ContactSubModelPart for cond in self.contact_model_part.Conditions: interface_model_part.AddCondition(cond) for node in self.contact_model_part.Nodes: interface_model_part.AddNode(node, 0) # We compute NODAL_H that can be used in the search and some values computation self.find_nodal_h = KM.FindNodalHProcess(self.contact_model_part) self.find_nodal_h.Execute() # We initialize the conditions alm_init_var = CSMA.ALMFastInit(self.contact_model_part) alm_init_var.Execute() search_parameters = KM.Parameters(""" { "dynamic_search" : true, "simple_search" : false, "normal_orientation_threshold" : 0.0 } """) contact_search = CSMA.ContactSearchProcess(self.main_model_part, search_parameters) # We initialize the search utility contact_search.ExecuteInitialize() contact_search.ExecuteInitializeSolutionStep() ## DEBUG #self.__post_process() check_parameters = KM.Parameters(""" { "check_variables" : ["NORMAL_GAP"], "input_file_name" : "", "model_part_name" : "Structure", "historical_value" : false, "time_frequency" : 0.0, "sub_model_part_name" : "Parts_Parts_Auto1" } """) check_parameters["input_file_name"].SetString(input_filename + "_dynamic_search.json") check = from_json_check_result_process.FromJsonCheckResultProcess( self.model, check_parameters) check.ExecuteInitialize() check.ExecuteBeforeSolutionLoop() check.ExecuteFinalizeSolutionStep()