Esempio n. 1
0
    def ExecuteInitializeSolutionStep(self):
        """ This method is executed in order to initialize the current step

        Keyword arguments:
        self -- It signifies an instance of a class.
        """

        if not self.initial_remeshing:
            # We need to check if the model part has been modified recently
            if self.model_part.Is(KratosMultiphysics.MODIFIED):
                self.model_part.Set(KratosMultiphysics.MODIFIED, False)
                self.step = 0  # Reset (just to be sure)
            else:
                self.step += 1
                if self.step_frequency > 0:
                    if self.step >= self.step_frequency:
                        if self.model_part.ProcessInfo[
                                KratosMultiphysics.STEP] >= self.initial_step:
                            if self.settings[
                                    "blocking_threshold_size"].GetBool():
                                MeshingApplication.BlockThresholdSizeElements(
                                    self.model_part,
                                    self.settings["threshold_sizes"])
                            self._ExecuteRefinement()
                            self.step = 0  # Reset
Esempio n. 2
0
    def ExecuteInitializeSolutionStep(self):
        """ This method is executed in order to initialize the current step

        Keyword arguments:
        self -- It signifies an instance of a class.
        """

        # If not previous remesh
        if not self.remesh_executed:
            if not self.initial_remeshing:
                # We need to check if the model part has been modified recently
                if self.main_model_part.Is(KratosMultiphysics.MODIFIED):
                    self.main_model_part.Set(KratosMultiphysics.MODIFIED, False)
                    self.step = 0  # Reset (just to be sure)
                    self.time = 0.0  # Reset (just to be sure)
                else:
                    current_time = self.main_model_part.ProcessInfo[KratosMultiphysics.TIME]
                    if self.interval.IsInInterval(current_time):
                        # We remesh if needed
                        if self.__execute_remesh():
                            if self.strategy == "Hessian" or self.strategy == "LevelSet":
                                if self.settings["blocking_threshold_size"].GetBool():
                                    MeshingApplication.BlockThresholdSizeElements(self.main_model_part, self.settings["threshold_sizes"])
                                self._ExecuteRefinement()
                                self.initial_step_done = True
                                self.step = 0  # Reset
                                self.time = 0.0  # Reset