def ExecuteBasicVTKoutputProcessCheck(file_format="ascii", setup="2D"): KratosMultiphysics.Logger.GetDefaultOutput().SetSeverity( KratosMultiphysics.Logger.Severity.WARNING) current_model = KratosMultiphysics.Model() model_part_name = "Main" model_part = current_model.CreateModelPart(model_part_name) if setup == "2D": SetupModelPart2D(model_part) elif setup == "3D": SetupModelPart3D(model_part) else: SetupModelPartQuadratic3D(model_part) vtk_output_parameters = KratosMultiphysics.Parameters("""{ "Parameters" : { "model_part_name" : "Main", "file_format" : "ascii", "output_precision" : 8, "output_frequency" : 2, "output_sub_model_parts" : true, "folder_name" : "test_vtk_output", "nodal_solution_step_data_variables" : ["PRESSURE","DISPLACEMENT", "VELOCITY"], "nodal_flags" : ["BOUNDARY"], "element_data_value_variables" : ["DETERMINANT"], "condition_data_value_variables" : ["DENSITY", "YOUNG_MODULUS"], "condition_flags" : ["BOUNDARY"] } }""") vtk_output_parameters["Parameters"]["model_part_name"].SetString( model_part_name) vtk_output_parameters["Parameters"]["file_format"].SetString(file_format) vtk_output_process = SetupVtkOutputProcess(current_model, vtk_output_parameters) time = 0.0 dt = 0.2 step = 0 end_time = 1.0 vtk_output_process.ExecuteInitialize() while (time <= end_time): time = time + dt step = step + 1 model_part.ProcessInfo[KratosMultiphysics.STEP] += 1 SetSolution(model_part) vtk_output_process.ExecuteInitializeSolutionStep() model_part.CloneTimeStep(time) vtk_output_process.ExecuteFinalizeSolutionStep() if vtk_output_process.IsOutputStep(): vtk_output_process.PrintOutput() Check(os.path.join("test_vtk_output","Main_0_" + str(step)+".vtk"),\ os.path.join("auxiliar_files_for_python_unnitest", "vtk_output_process_ref_files", file_format + setup, "Main_0_"+str(step)+".vtk"), file_format) Check(os.path.join("test_vtk_output","Main_FixedEdgeNodes_0_" + str(step)+".vtk"),\ os.path.join("auxiliar_files_for_python_unnitest", "vtk_output_process_ref_files", file_format + setup, "Main_FixedEdgeNodes_0_"+str(step)+".vtk"), file_format) Check(os.path.join("test_vtk_output","Main_MovingNodes_0_"+str(step)+".vtk"),\ os.path.join("auxiliar_files_for_python_unnitest", "vtk_output_process_ref_files", file_format + setup, "Main_MovingNodes_0_"+str(step)+".vtk"), file_format)
def ExecuteBasicVTKoutputProcessCheck(file_format): current_model = KratosMultiphysics.Model() model_part_name = "Main" model_part = current_model.CreateModelPart(model_part_name) SetupModelPart(model_part) vtk_output_parameters = KratosMultiphysics.Parameters("""{ "Parameters" : { "model_part_name" : \"""" + model_part_name + """\", "file_format" : \"""" + file_format + """\", "output_precision" : 8, "output_frequency" : 2, "folder_name" : "test_vtk_output", "nodal_solution_step_data_variables" : ["PRESSURE","DISPLACEMENT", "VELOCITY"], "element_data_value_variables" : ["DETERMINANT"], "condition_data_value_variables" : ["DENSITY", "YOUNG_MODULUS"] } }""") vtk_output_process = SetupVtkOutputProcess(current_model, vtk_output_parameters) time = 0.0 dt = 0.2 step = 0 end_time = 1.0 vtk_output_process.ExecuteInitialize() while (time <= end_time): time = time + dt step = step + 1 model_part.ProcessInfo[KratosMultiphysics.STEP] += 1 #print("STEP :: ", step, ", TIME :: ", time) SetSolution(model_part) vtk_output_process.ExecuteInitializeSolutionStep() model_part.CloneTimeStep(time) vtk_output_process.ExecuteFinalizeSolutionStep() if vtk_output_process.IsOutputStep(): vtk_output_process.PrintOutput() Check(os.path.join("test_vtk_output","Main_0_" + str(step)+".vtk"),\ os.path.join("vtk_output_process_ref_files", file_format, "Main_0_"+str(step)+".vtk")) Check(os.path.join("test_vtk_output","Main_FixedEdgeNodes_0_" + str(step)+".vtk"),\ os.path.join("vtk_output_process_ref_files", file_format, "Main_FixedEdgeNodes_0_"+str(step)+".vtk")) Check(os.path.join("test_vtk_output","Main_MovingNodes_0_"+str(step)+".vtk"),\ os.path.join("vtk_output_process_ref_files", file_format, "Main_MovingNodes_0_"+str(step)+".vtk"))