def SetRefiningParameters(self): #no refine in the contact domain # Create RefiningParameters self.RefiningParameters = KratosDelaunay.RefiningParameters() self.RefiningParameters.Initialize() # parameters self.RefiningParameters.SetAlphaParameter( self.settings["alpha_shape"].GetDouble())
def SetRefiningParameters(self): # Create RefiningParameters self.RefiningParameters = KratosDelaunay.RefiningParameters() self.RefiningParameters.Initialize() # parameters self.RefiningParameters.SetAlphaParameter(self.settings["alpha_shape"].GetDouble()) # set mesh refinement in box size = self.dimension refining_box = self.settings["spatial_refining_box"] if(refining_box["use_refining_box"].GetBool()): self.MeshingParameters.SetUseRefiningBox(True) self.MeshingParameters.SetRefiningBoxMinimumPoint(refining_box["lower_point"][0].GetDouble(),refining_box["lower_point"][1].GetDouble(),refining_box["lower_point"][2].GetDouble()) self.MeshingParameters.SetRefiningBoxMaximumPoint(refining_box["upper_point"][0].GetDouble(),refining_box["upper_point"][1].GetDouble(),refining_box["upper_point"][2].GetDouble()) self.MeshingParameters.SetRefiningBoxTimeInterval(refining_box["initial_time"].GetDouble(),refining_box["final_time"].GetDouble()) self.MeshingParameters.SetRefiningBoxMeshSize(refining_box["mesh_size"].GetDouble()) removing_options = KratosMultiphysics.Flags() #remove nodes removing_options.Set(KratosDelaunay.MesherUtilities.REMOVE_NODES, True) removing_options.Set(KratosDelaunay.MesherUtilities.REMOVE_NODES_ON_DISTANCE, True) removing_options.Set(KratosDelaunay.MesherUtilities.REMOVE_NODES_ON_ERROR, False) removing_options.Set(KratosDelaunay.MesherUtilities.REMOVE_NODES_ON_THRESHOLD, False) #remove boundary removing_options.Set(KratosDelaunay.MesherUtilities.REMOVE_BOUNDARY_NODES, False) removing_options.Set(KratosDelaunay.MesherUtilities.REMOVE_BOUNDARY_NODES_ON_DISTANCE, False) removing_options.Set(KratosDelaunay.MesherUtilities.REMOVE_BOUNDARY_NODES_ON_ERROR, False) removing_options.Set(KratosDelaunay.MesherUtilities.REMOVE_BOUNDARY_NODES_ON_THRESHOLD, False) refining_options = KratosMultiphysics.Flags() refining_options.Set(KratosDelaunay.MesherUtilities.REFINE, self.settings["meshing_strategy"]["refine"].GetBool()) #refine elements refining_options.Set(KratosDelaunay.MesherUtilities.REFINE_ELEMENTS, False) refining_options.Set(KratosDelaunay.MesherUtilities.REFINE_ELEMENTS_ON_DISTANCE, False) refining_options.Set(KratosDelaunay.MesherUtilities.REFINE_ELEMENTS_ON_ERROR, False) refining_options.Set(KratosDelaunay.MesherUtilities.REFINE_ELEMENTS_ON_THRESHOLD, False) #refine boundary refining_options.Set(KratosDelaunay.MesherUtilities.REFINE_BOUNDARY, False) refining_options.Set(KratosDelaunay.MesherUtilities.REFINE_BOUNDARY_ON_DISTANCE, False) refining_options.Set(KratosDelaunay.MesherUtilities.REFINE_BOUNDARY_ON_ERROR, False) refining_options.Set(KratosDelaunay.MesherUtilities.REFINE_BOUNDARY_ON_THRESHOLD, False) self.RefiningParameters.SetRefiningOptions(refining_options) self.RefiningParameters.SetRemovingOptions(removing_options)
def SetRefiningParameters(self): # Create RefiningParameters self.RefiningParameters = KratosDelaunay.RefiningParameters() self.RefiningParameters.Initialize() # parameters self.RefiningParameters.SetAlphaParameter( self.settings["alpha_shape"].GetDouble()) # custom set of the mesh size from settings from initial mesh or other parts self.SetMeshSizeValues() # set mesh refinement in box size = self.dimension refining_box = self.settings["refining_parameters"]["refining_box"] if (refining_box["refine_in_box_only"].GetBool()): radius = refining_box["radius"].GetDouble() center = Vector(size) velocity = Vector(size) for i in range(0, size): center[i] = refining_box["center"][i].GetDouble() velocity[i] = refining_box["velocity"][i].GetDouble() refining_box = KratosDelaunay.SpatialBoundingBox( center, radius, velocity) self.RefiningParameters.SetRefiningBox(refining_box) self.RefiningParameters.SetThresholdVariable( KratosMultiphysics.KratosGlobals.GetVariable( self.settings["refining_parameters"] ["threshold_variable"].GetString())) self.RefiningParameters.SetReferenceThreshold( self.settings["refining_parameters"] ["reference_threshold"].GetDouble()) self.RefiningParameters.SetErrorVariable( KratosMultiphysics.KratosGlobals.GetVariable( self.settings["refining_parameters"] ["error_variable"].GetString())) self.RefiningParameters.SetReferenceError( self.settings["refining_parameters"] ["reference_error"].GetDouble()) removing_options = KratosMultiphysics.Flags() #remove nodes remove_nodes = self.settings["refining_parameters"]["remove_nodes"] removing_options.Set(KratosDelaunay.MesherUtilities.REMOVE_NODES, remove_nodes["apply_removal"].GetBool()) removing_options.Set( KratosDelaunay.MesherUtilities.REMOVE_NODES_ON_DISTANCE, remove_nodes["on_distance"].GetBool()) removing_options.Set( KratosDelaunay.MesherUtilities.REMOVE_NODES_ON_ERROR, remove_nodes["on_error"].GetBool()) removing_options.Set( KratosDelaunay.MesherUtilities.REMOVE_NODES_ON_THRESHOLD, remove_nodes["on_threshold"].GetBool()) #remove boundary remove_boundary = self.settings["refining_parameters"][ "remove_boundary"] removing_options.Set( KratosDelaunay.MesherUtilities.REMOVE_BOUNDARY_NODES, remove_boundary["apply_removal"].GetBool()) removing_options.Set( KratosDelaunay.MesherUtilities.REMOVE_BOUNDARY_NODES_ON_DISTANCE, remove_boundary["on_distance"].GetBool()) removing_options.Set( KratosDelaunay.MesherUtilities.REMOVE_BOUNDARY_NODES_ON_ERROR, remove_boundary["on_error"].GetBool()) removing_options.Set( KratosDelaunay.MesherUtilities.REMOVE_BOUNDARY_NODES_ON_THRESHOLD, remove_boundary["on_threshold"].GetBool()) refining_options = KratosMultiphysics.Flags() refining_options.Set( KratosDelaunay.MesherUtilities.REFINE, self.settings["meshing_strategy"]["refine"].GetBool()) refining_options.Set( KratosDelaunay.MesherUtilities.REFINE_ADD_NODES, self.settings["refining_parameters"]["add_nodes"].GetBool()) refining_options.Set( KratosDelaunay.MesherUtilities.REFINE_INSERT_NODES, self.settings["refining_parameters"]["insert_nodes"].GetBool()) #refine elements refine_elements = self.settings["refining_parameters"][ "refine_elements"] refining_options.Set(KratosDelaunay.MesherUtilities.REFINE_ELEMENTS, refine_elements["apply_refinement"].GetBool()) refining_options.Set( KratosDelaunay.MesherUtilities.REFINE_ELEMENTS_ON_DISTANCE, refine_elements["on_distance"].GetBool()) refining_options.Set( KratosDelaunay.MesherUtilities.REFINE_ELEMENTS_ON_ERROR, refine_elements["on_error"].GetBool()) refining_options.Set( KratosDelaunay.MesherUtilities.REFINE_ELEMENTS_ON_THRESHOLD, refine_elements["on_threshold"].GetBool()) #refine boundary refine_boundary = self.settings["refining_parameters"][ "refine_boundary"] refining_options.Set(KratosDelaunay.MesherUtilities.REFINE_BOUNDARY, refine_boundary["apply_refinement"].GetBool()) refining_options.Set( KratosDelaunay.MesherUtilities.REFINE_BOUNDARY_ON_DISTANCE, refine_boundary["on_distance"].GetBool()) refining_options.Set( KratosDelaunay.MesherUtilities.REFINE_BOUNDARY_ON_ERROR, refine_boundary["on_error"].GetBool()) refining_options.Set( KratosDelaunay.MesherUtilities.REFINE_BOUNDARY_ON_THRESHOLD, refine_boundary["on_threshold"].GetBool()) self.RefiningParameters.SetRefiningOptions(refining_options) self.RefiningParameters.SetRemovingOptions(removing_options)