コード例 #1
0
    def __TestMethod(self, settings):
        factory = KratosProcessFactory(self.current_model)
        self.process_list = factory.ConstructListOfProcesses(settings)
        InitializeProcesses(self)

        for step in range(0, 12, 2):
            self.model_part.CloneTimeStep(step)
            self.model_part.ProcessInfo[Kratos.STEP] = step
            InitializeModelPartVariables(self.model_part, False)
            ExecuteProcessFinalizeSolutionStep(self)

        for process in self.process_list:
            process.ExecuteFinalize()
コード例 #2
0
    def RunTemporalStatisticsTest(self, norm_type, container_name):

        settings = TemporalMaxMethodHelperClass.__GetDefaultParameters(
            norm_type, container_name)
        input_method = TemporalMaxMethodHelperClass.GetInputMethod(
            container_name)
        output_method = TemporalMaxMethodHelperClass.GetOutputMethod(
            container_name)
        container = self.GetContainer(container_name)

        factory = KratosProcessFactory(self.GetModel())
        self.process_list = factory.ConstructListOfProcesses(settings)
        InitializeProcesses(self)

        scalar_list, vec_3d_list, vec_list, mat_list = InitializeContainerArrays(
            container)
        step_list = []
        for step in range(0, 12, 2):
            self.model_part.CloneTimeStep(step)
            InitializeModelPartVariables(self.GetModelPart())
            ExecuteProcessFinalizeSolutionStep(self)

            step_list.append(step)
            for index, item in enumerate(container):
                current_scalar = input_method(item, Kratos.PRESSURE)
                current_vector_3d = input_method(item, Kratos.VELOCITY)
                current_vector = input_method(item, Kratos.LOAD_MESHES)
                current_matrix = input_method(
                    item, Kratos.GREEN_LAGRANGE_STRAIN_TENSOR)

                if (step >= 0):
                    scalar_list[index].append(current_scalar)
                    vec_3d_list[index].append(current_vector_3d)
                    vec_list[index].append(current_vector)
                    mat_list[index].append(current_matrix)

                analytical_method_scalar = TemporalMaxMethodHelperClass.__AnalyticalMethod(
                    norm_type, Kratos.PRESSURE, scalar_list[index], step_list)
                analytical_method_vec_3d = TemporalMaxMethodHelperClass.__AnalyticalMethod(
                    norm_type, Kratos.VELOCITY, vec_3d_list[index], step_list)
                analytical_method_vec = TemporalMaxMethodHelperClass.__AnalyticalMethod(
                    norm_type, Kratos.LOAD_MESHES, vec_list[index], step_list)
                analytical_method_mat = TemporalMaxMethodHelperClass.__AnalyticalMethod(
                    norm_type, Kratos.GREEN_LAGRANGE_STRAIN_TENSOR,
                    mat_list[index], step_list)

                mean_method_scalar = output_method(item,
                                                   KratosStats.SCALAR_NORM)
                mean_method_vec_3d = output_method(item,
                                                   KratosStats.VECTOR_3D_NORM)
                mean_method_vec = output_method(item, Kratos.DENSITY)
                mean_method_mat = output_method(item, Kratos.VISCOSITY)
                variance_method_scalar = output_method(item,
                                                       Kratos.YIELD_STRESS)
                variance_method_vec_3d = output_method(item,
                                                       Kratos.CUTTED_AREA)
                variance_method_vec = output_method(item,
                                                    Kratos.NET_INPUT_MATERIAL)
                variance_method_mat = output_method(item, Kratos.WET_VOLUME)

                CheckValues(self, analytical_method_scalar[0],
                            mean_method_scalar, 8)
                CheckValues(self, analytical_method_vec_3d[0],
                            mean_method_vec_3d, 8)
                CheckValues(self, analytical_method_vec[0], mean_method_vec, 8)
                CheckValues(self, analytical_method_mat[0], mean_method_mat, 8)
                CheckValues(self, analytical_method_scalar[1],
                            variance_method_scalar, 8)
                CheckValues(self, analytical_method_vec_3d[1],
                            variance_method_vec_3d, 8)
                CheckValues(self, analytical_method_vec[1],
                            variance_method_vec, 8)
                CheckValues(self, analytical_method_mat[1],
                            variance_method_mat, 8)
コード例 #3
0
    def RunTemporalStatisticsTest(self, norm_type, container_name):

        settings = TemporalSumMethodHelperClass.__GetDefaultParameters(
            norm_type, container_name)
        input_method = TemporalSumMethodHelperClass.GetInputMethod(
            container_name)
        output_method = TemporalSumMethodHelperClass.GetOutputMethod(
            container_name)
        container = self.GetContainer(container_name)

        factory = KratosProcessFactory(self.GetModel())
        self.process_list = factory.ConstructListOfProcesses(settings)
        InitializeProcesses(self)

        scalar_list, vec_3d_list, vec_list, mat_list = InitializeContainerArrays(
            container)

        for step in range(0, 12, 2):
            self.model_part.CloneTimeStep(step)
            InitializeModelPartVariables(self.GetModelPart())
            ExecuteProcessFinalizeSolutionStep(self)

            for index, item in enumerate(container):
                current_scalar = input_method(item, Kratos.PRESSURE)
                current_vector_3d = input_method(item, Kratos.VELOCITY)
                current_vector = input_method(item, Kratos.LOAD_MESHES)
                current_matrix = input_method(
                    item, Kratos.GREEN_LAGRANGE_STRAIN_TENSOR)

                if (step >= 4):
                    scalar_list[index].append(current_scalar)
                    vec_3d_list[index].append(current_vector_3d)
                    vec_list[index].append(current_vector)
                    mat_list[index].append(current_matrix)

                analytical_method_scalar = TemporalSumMethodHelperClass.__AnalyticalMethod(
                    norm_type, Kratos.PRESSURE, scalar_list[index])
                analytical_method_vec_3d = TemporalSumMethodHelperClass.__AnalyticalMethod(
                    norm_type, Kratos.VELOCITY, vec_3d_list[index])
                analytical_method_vec = TemporalSumMethodHelperClass.__AnalyticalMethod(
                    norm_type, Kratos.LOAD_MESHES, vec_list[index])
                analytical_method_mat = TemporalSumMethodHelperClass.__AnalyticalMethod(
                    norm_type, Kratos.GREEN_LAGRANGE_STRAIN_TENSOR,
                    mat_list[index])

                if (norm_type == "none"):
                    method_scalar = output_method(item,
                                                  KratosStats.SCALAR_MEAN)
                    method_vec_3d = output_method(item,
                                                  KratosStats.VECTOR_3D_MEAN)
                    method_vec = output_method(item,
                                               Kratos.MATERIAL_PARAMETERS)
                    method_mat = output_method(item,
                                               Kratos.CAUCHY_STRESS_TENSOR)
                else:
                    method_scalar = output_method(item,
                                                  KratosStats.SCALAR_NORM)
                    method_vec_3d = output_method(item,
                                                  KratosStats.VECTOR_3D_NORM)
                    method_vec = output_method(item, Kratos.DENSITY)
                    method_mat = output_method(item, Kratos.VISCOSITY)

                CheckValues(self, analytical_method_scalar, method_scalar, 8)
                CheckValues(self, analytical_method_vec_3d, method_vec_3d, 8)
                CheckValues(self, analytical_method_vec, method_vec, 16)
                CheckValues(self, analytical_method_mat, method_mat, 8)