예제 #1
0
 def __CreateDistanceModificationProcess(self):
     # Set the distance modification settings according to the level set type
     # Note that the distance modification process is applied to the volume model part
     distance_modification_settings = self.settings["distance_modification_settings"]
     distance_modification_settings.ValidateAndAssignDefaults(self.__GetDistanceModificationDefaultSettings(self.level_set_type))
     distance_modification_settings["model_part_name"].SetString(self.settings["volume_model_part_name"].GetString())
     return KratosCFD.DistanceModificationProcess(self.model, distance_modification_settings)
예제 #2
0
    def __init__(self, Model, settings):

        msg = "The python distance modification process is deprecated.\n"
        msg += "Please use (or implement) the \'distance_modification_settings\' in the \'solver_settings\'.\n"
        KratosMultiphysics.Logger.PrintWarning(
            "ApplyDistanceModificationProcess", msg)

        KratosMultiphysics.Process.__init__(self)

        default_parameters = KratosMultiphysics.Parameters("""
        {
            "model_part_name"                        : "CHOOSE_FLUID_MODELPART_NAME",
            "distance_threshold"                     : 0.01,
            "continuous_distance"                    : true,
            "check_at_each_time_step"                : false,
            "avoid_almost_empty_elements"            : true,
            "deactivate_full_negative_elements"      : true,
            "recover_original_distance_at_each_step" : false
        }  """)

        settings.ValidateAndAssignDefaults(default_parameters)

        self.fluid_model_part = Model[settings["model_part_name"].GetString()]
        self.DistanceModificationProcess = KratosFluid.DistanceModificationProcess(
            self.fluid_model_part, settings)
    def __CreateDistanceModificationProcess(self):
        # Set the distance modification settings according to the level set type
        if (self.level_set_type == "continuous"):
            distance_modification_settings = KratosMultiphysics.Parameters(
                r'''{
                "model_part_name": "",
                "distance_threshold": 1e-3,
                "continuous_distance": true,
                "check_at_each_time_step": true,
                "avoid_almost_empty_elements": true,
                "deactivate_full_negative_elements": true
            }''')
        elif (self.level_set_type == "discontinuous"):
            distance_modification_settings = KratosMultiphysics.Parameters(
                r'''{
                "model_part_name": "",
                "distance_threshold": 1e-4,
                "continuous_distance": false,
                "check_at_each_time_step": true,
                "avoid_almost_empty_elements": false,
                "deactivate_full_negative_elements": false
            }''')
        else:
            err_msg = 'Level set type is: \'' + self.level_set_type + '\'. Expected \'continuous\' or \'discontinuous\'.'
            raise Exception(err_msg)

        # Set the volume model part name in which the distance modification is applied to
        volume_model_part_name = self.settings["fluid_solver_settings"][
            "volume_model_part_name"].GetString()
        distance_modification_settings["model_part_name"].SetString(
            volume_model_part_name)

        # Construct and return the distance modification process
        return KratosFluid.DistanceModificationProcess(
            self.model, distance_modification_settings)
    def __CreateDistanceModificationProcess(self):
        # Set suitable distance correction settings for free-surface problems
        # Note that the distance modification process is applied to the computing model part
        distance_modification_settings = self.settings["distance_modification_settings"]
        distance_modification_settings.ValidateAndAssignDefaults(self.GetDefaultParameters()["distance_modification_settings"])
        distance_modification_settings["model_part_name"].SetString(self.GetComputingModelPart().FullName())

        # Check user provided settings
        if not distance_modification_settings["continuous_distance"].GetBool():
            distance_modification_settings["continuous_distance"].SetBool(True)
            KratosMultiphysics.Logger.PrintWarning("Provided distance correction \'continuous_distance\' is \'False\'. Setting to \'True\'.")
        if not distance_modification_settings["check_at_each_time_step"].GetBool():
            distance_modification_settings["check_at_each_time_step"].SetBool(True)
            KratosMultiphysics.Logger.PrintWarning("Provided distance correction \'check_at_each_time_step\' is \'False\'. Setting to \'True\'.")
        if distance_modification_settings["avoid_almost_empty_elements"].GetBool():
            distance_modification_settings["avoid_almost_empty_elements"].SetBool(False)
            KratosMultiphysics.Logger.PrintWarning("Provided distance correction \'avoid_almost_empty_elements\' is \'True\'. Setting to \'False\' to avoid modifying the distance sign.")
        if distance_modification_settings["deactivate_full_negative_elements"].GetBool():
            distance_modification_settings["deactivate_full_negative_elements"].SetBool(False)
            KratosMultiphysics.Logger.PrintWarning("Provided distance correction \'deactivate_full_negative_elements\' is \'True\'. Setting to \'False\' to avoid deactivating the negative volume (e.g. water).")

        # Create and return the distance correction process
        return KratosCFD.DistanceModificationProcess(
            self.model,
            distance_modification_settings)
예제 #5
0
    def __init__(self, Model, settings):

        KratosMultiphysics.Process.__init__(self)

        default_parameters = KratosMultiphysics.Parameters("""
        {
            "mesh_id"                                   : 0,
            "model_part_name"                           : "CHOOSE_FLUID_MODELPART_NAME",
            "check_at_each_time_step"                   : false,
            "deactivate_full_negative_elements"         : true,
            "recover_original_distance_at_each_step"    : false
        }  """)

        settings.ValidateAndAssignDefaults(default_parameters)

        self.fluid_model_part = Model[settings["model_part_name"].GetString()]
        self.DistanceModificationProcess = KratosFluid.DistanceModificationProcess(
            self.fluid_model_part, settings)