示例#1
0
    def ExecuteFinalizeSolutionStep(self):

        current_time = self.model_part.ProcessInfo[KratosMultiphysics.TIME]

        if ((current_time >= self.interval[0])
                and (current_time < self.interval[1])):
            # Compute the drag force
            drag_force = KratosFluid.DragUtilities().CalculateBodyFittedDrag(
                self.model_part)

            # Write the drag force values
            if (self.model_part.GetCommunicator().MyPID() == 0):
                if (self.print_drag_to_screen):
                    print("DRAG RESULTS:")
                    print("Current time: " + str(current_time) + " x-drag: " +
                          str(drag_force[0]) + " y-drag: " +
                          str(drag_force[1]) + " z-drag: " +
                          str(drag_force[2]))

                if (self.write_drag_output_file):
                    with open(self.drag_filename, 'a') as file:
                        file.write(
                            str(current_time) + "   " + str(drag_force[0]) +
                            "   " + str(drag_force[1]) + "   " +
                            str(drag_force[2]) + "\n")
                        file.close()
    def ExecuteFinalizeSolutionStep(self):

        current_time = self.fluid_model_part.ProcessInfo[
            KratosMultiphysics.TIME]

        if ((current_time >= self.interval[0])
                and (current_time < self.interval[1])):

            # Integrate the drag over the model part elements
            drag_force = KratosCFD.DragUtilities().CalculateEmbeddedDrag(
                self.fluid_model_part)

            # Print drag values to screen
            if (self.print_drag_to_screen) and (
                    self.fluid_model_part.GetCommunicator().MyPID() == 0):
                print("DRAG VALUES:")
                print("Current time: " + str(current_time) + " x-drag: " +
                      str(drag_force[0]) + " y-drag: " + str(drag_force[1]) +
                      " z-drag: " + str(drag_force[2]))

            # Print drag values to file
            if (self.write_drag_output_file) and (
                    self.fluid_model_part.GetCommunicator().MyPID() == 0):
                with open(self.drag_filename, 'a') as file:
                    file.write(
                        str(current_time) + "   " + str(drag_force[0]) +
                        "   " + str(drag_force[1]) + "   " +
                        str(drag_force[2]) + "\n")
                    file.close()
示例#3
0
 def _GetCorrespondingDragForce(self):
     return KratosCFD.DragUtilities().CalculateEmbeddedDrag(self.model_part)