def RunTwoFacesTestCase(self, set_fluid_data, set_solid_data, check_fluid_results, check_solid_results): with WorkFolderScope(self.work_folder): # Problem set up self.SetUpProblem() # Set the interface flag in the fluid and solid interfaces self.GenerateTwoFacesInterface() # Construct the mapper object self.mapper = NonConformant_OneSideMap.NonConformantTwoFaces_OneSideMap( self.fluid_main_model_part.GetSubModelPart( self.fluid_positive_interface_name), self.fluid_main_model_part.GetSubModelPart( self.fluid_negative_interface_name), self.solid_main_model_part.GetSubModelPart( self.solid_interface_name), self.search_radius_factor, self.mapper_max_iterations, self.mapper_tolerance) # Set the data to be mapped set_fluid_data() set_solid_data() # Map information between fluid and solid domains self.PerformTwoFacesMapping() # If required, print output if self.print_output: self.InitializeOutput() self.PrintOutput() self.FinalizeOutput() # Check the mapped results check_fluid_results() check_solid_results()
def _SetUpMapper(self): # Recall, to set the INTERFACE flag in both the fluid and solid interface before the mapper construction search_radius_factor = 2.0 mapper_max_iterations = 200 mapper_tolerance = 1e-12 mappers_settings = self.settings["coupling_settings"]["mapper_settings"] if (mappers_settings.size() == 1): fluid_submodelpart_name = mappers_settings[0]["fluid_interface_submodelpart_name"].GetString() structure_submodelpart_name = mappers_settings[0]["structure_interface_submodelpart_name"].GetString() fluid_submodelpart = self.fluid_solver.main_model_part.GetSubModelPart(fluid_submodelpart_name) structure_submodelpart = self.structure_solver.main_model_part.GetSubModelPart(structure_submodelpart_name) self.interface_mapper = NonConformant_OneSideMap.NonConformant_OneSideMap(fluid_submodelpart, structure_submodelpart, search_radius_factor, mapper_max_iterations, mapper_tolerance) self.double_faced_structure = False elif (mappers_settings.size() == 2): # Get the fluid interface faces submodelpart names for mapper_id in range(2): if (mappers_settings[mapper_id]["mapper_face"].GetString() == "Positive"): pos_face_submodelpart_name = mappers_settings[mapper_id]["fluid_interface_submodelpart_name"].GetString() elif (mappers_settings[mapper_id]["mapper_face"].GetString() == "Negative"): neg_face_submodelpart_name = mappers_settings[mapper_id]["fluid_interface_submodelpart_name"].GetString() else: raise Exception("Unique mapper flag has been set but more than one mapper exist in mapper_settings.") # Get the structure submodelpart name structure_submodelpart_name = mappers_settings[0]["structure_interface_submodelpart_name"].GetString() # Grab the interface submodelparts pos_fluid_submodelpart = self.fluid_solver.main_model_part.GetSubModelPart(pos_face_submodelpart_name) neg_fluid_submodelpart = self.fluid_solver.main_model_part.GetSubModelPart(neg_face_submodelpart_name) structure_submodelpart = self.structure_solver.main_model_part.GetSubModelPart(structure_submodelpart_name) self.interface_mapper = NonConformant_OneSideMap.NonConformantTwoFaces_OneSideMap(pos_fluid_submodelpart, neg_fluid_submodelpart, structure_submodelpart, search_radius_factor, mapper_max_iterations, mapper_tolerance) self.double_faced_structure = True else: raise Exception("Case with more than 2 mappers has not been implemented yet.\n \ Please, in case you are using single faced immersed bodies, set the skin entities in a unique submodelpart.\n \ In case you are considering double faced immersed bodies (shells or membranes), set all the positive faces \ in a unique submodelpart and all the negative ones in another submodelpart.")