def testFlowsMeasuring3D_1(self): vel = Kratos.Array3() vel[0] = 0.0 vel[1] = 0.0 vel[2] = 1.0 node = self.fluid_model_part.CreateNewNode(1, 0.0, 0.0, 0.0) node.SetSolutionStepValue(Kratos.VELOCITY, vel) node = self.fluid_model_part.CreateNewNode(2, 1.0, 0.0, 0.0) node.SetSolutionStepValue(Kratos.VELOCITY, vel) node = self.fluid_model_part.CreateNewNode(3, 0.0, 1.0, 0.0) node.SetSolutionStepValue(Kratos.VELOCITY, vel) node = self.fluid_model_part.CreateNewNode(4, 1.0, 1.0, 0.0) node.SetSolutionStepValue(Kratos.VELOCITY, vel) vel[0] = 1.0 vel[1] = 0.0 vel[2] = 0.0 node = self.fluid_model_part.CreateNewNode(5, 2.0, 0.0, 0.0) node.SetSolutionStepValue(Kratos.VELOCITY, vel) node = self.fluid_model_part.CreateNewNode(6, 2.0, 0.0, 1.0) node.SetSolutionStepValue(Kratos.VELOCITY, vel) node = self.fluid_model_part.CreateNewNode(7, 2.0, 1.0, 0.0) node.SetSolutionStepValue(Kratos.VELOCITY, vel) condition_name = "SurfaceCondition3D3N" self.fluid_model_part.CreateNewCondition( condition_name, 1, [1, 2, 3], self.fluid_model_part.GetProperties()[0]) self.fluid_model_part.CreateNewCondition( condition_name, 2, [3, 2, 4], self.fluid_model_part.GetProperties()[0]) self.fluid_model_part.CreateNewCondition( condition_name, 3, [5, 6, 7], self.fluid_model_part.GetProperties()[0]) first_smp = self.fluid_model_part.CreateSubModelPart("first") first_smp.AddConditions([1, 2]) second_smp = self.fluid_model_part.CreateSubModelPart("second") second_smp.AddConditions([3]) flow_value_first = Fluid.FluidPostProcessUtilities().CalculateFlow( first_smp) flow_value_second = Fluid.FluidPostProcessUtilities().CalculateFlow( second_smp) self.assertAlmostEqual(flow_value_first, 1.0) self.assertAlmostEqual(flow_value_second, -0.5)
def CalculateFlow(self, model_part): flow_value = KratosCFD.FluidPostProcessUtilities().CalculateFlow( model_part) return flow_value