Exemple #1
0
    def _run_test(self):
        model = KratosMultiphysics.Model()
        with open(self.file_name + "_parameters.json", 'r') as parameter_file:
            ProjectParameters = KratosMultiphysics.Parameters(
                parameter_file.read())

        if self.print_output:
            ProjectParameters.AddValue(
                "output_processes",
                KratosMultiphysics.Parameters(r'''{
                "gid_output" : [{
                    "python_module" : "gid_output_process",
                    "kratos_module" : "KratosMultiphysics",
                    "process_name"  : "GiDOutputProcess",
                    "help"          : "This process writes postprocessing files for GiD",
                    "Parameters"    : {
                        "model_part_name"        : "MainModelPart",
                        "output_name"            : "naca0012",
                        "postprocess_parameters" : {
                            "result_file_configuration" : {
                                "gidpost_flags"       : {
                                    "GiDPostMode"           : "GiD_PostBinary",
                                    "WriteDeformedMeshFlag" : "WriteDeformed",
                                    "WriteConditionsFlag"   : "WriteConditions",
                                    "MultiFileFlag"         : "SingleFile"
                                },
                                "file_label"          : "step",
                                "output_control_type" : "step",
                                "output_frequency"    : 1,
                                "body_output"         : true,
                                "node_output"         : false,
                                "skin_output"         : false,
                                "plane_output"        : [],
                                "nodal_results"       : ["VELOCITY_POTENTIAL","AUXILIARY_VELOCITY_POTENTIAL","DISTANCE","UPPER_WAKE","LOWER_WAKE","POTENTIAL_JUMP","AIRFOIL","TRAILING_EDGE","KUTTA"],
                                "gauss_point_results" : ["PRESSURE","VELOCITY","VELOCITY_LOWER","PRESSURE_LOWER","WAKE","TRAILING_EDGE","ELEMENTAL_DISTANCES","KUTTA","DISTANCE"]
                            },
                            "point_data_configuration"  : []
                        }
                    }
                }]
            }'''))

        potential_flow_analysis = PotentialFlowAnalysis(
            model, ProjectParameters)
        potential_flow_analysis.Run()
Exemple #2
0
    def _runTest(self, settings_file_name):
        model = KratosMultiphysics.Model()
        with open(settings_file_name, 'r') as settings_file:
            settings = KratosMultiphysics.Parameters(settings_file.read())

        if self.print_output:
            if settings_file_name == "naca0012_small_sensitivities_adjoint_parameters.json":
                settings.AddValue(
                    "output_processes",
                    KratosMultiphysics.Parameters(r'''{
                    "gid_output" : [{
                        "python_module" : "gid_output_process",
                        "kratos_module" : "KratosMultiphysics",
                        "process_name"  : "GiDOutputProcess",
                        "help"          : "This process writes postprocessing files for GiD",
                        "Parameters"    : {
                            "model_part_name"        : "MainModelPart",
                            "output_name"            : "naca0012_adjoint",
                            "postprocess_parameters" : {
                                "result_file_configuration" : {
                                    "gidpost_flags"       : {
                                        "GiDPostMode"           : "GiD_PostBinary",
                                        "WriteDeformedMeshFlag" : "WriteDeformed",
                                        "WriteConditionsFlag"   : "WriteConditions",
                                        "MultiFileFlag"         : "SingleFile"
                                    },
                                    "file_label"          : "step",
                                    "output_control_type" : "step",
                                    "output_frequency"    : 1,
                                    "body_output"         : true,
                                    "node_output"         : false,
                                    "skin_output"         : false,
                                    "plane_output"        : [],
                                    "nodal_results"       : ["SHAPE_SENSITIVITY","ADJOINT_VELOCITY_POTENTIAL", "ADJOINT_AUXILIARY_VELOCITY_POTENTIAL"],
                                    "nodal_nonhistorical_results": [],
                                    "elemental_conditional_flags_results": [],
                                    "gauss_point_results" : []
                                },
                                "point_data_configuration"  : []
                            }
                        }
                    }]
                }'''))
            else:
                settings.AddValue(
                    "output_processes",
                    KratosMultiphysics.Parameters(r'''{
                    "gid_output" : [{
                        "python_module" : "gid_output_process",
                        "kratos_module" : "KratosMultiphysics",
                        "process_name"  : "GiDOutputProcess",
                        "help"          : "This process writes postprocessing files for GiD",
                        "Parameters"    : {
                            "model_part_name"        : "MainModelPart",
                            "output_name"            : "naca0012",
                            "postprocess_parameters" : {
                                "result_file_configuration" : {
                                    "gidpost_flags"       : {
                                        "GiDPostMode"           : "GiD_PostBinary",
                                        "WriteDeformedMeshFlag" : "WriteDeformed",
                                        "WriteConditionsFlag"   : "WriteConditions",
                                        "MultiFileFlag"         : "SingleFile"
                                    },
                                    "file_label"          : "step",
                                    "output_control_type" : "step",
                                    "output_frequency"    : 1,
                                    "body_output"         : true,
                                    "node_output"         : false,
                                    "skin_output"         : false,
                                    "plane_output"        : [],
                                    "nodal_results"       : ["VELOCITY_POTENTIAL","AUXILIARY_VELOCITY_POTENTIAL"],
                                    "nodal_nonhistorical_results": ["TRAILING_EDGE","WAKE_DISTANCE"],
                                    "elemental_conditional_flags_results": ["STRUCTURE"],
                                    "gauss_point_results" : ["PRESSURE_COEFFICIENT","VELOCITY","WAKE","WAKE_ELEMENTAL_DISTANCES","KUTTA"]
                                },
                                "point_data_configuration"  : []
                            }
                        }
                    }]
                }'''))

        potential_flow_analysis = PotentialFlowAnalysis(model, settings)
        potential_flow_analysis.Run()
        self.main_model_part = model.GetModelPart(
            settings["solver_settings"]["model_part_name"].GetString())
Exemple #3
0
 def _CreateAnalysisStage(self):
     return PotentialFlowAnalysis(self.model, self.project_parameters)
Exemple #4
0
from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7

import KratosMultiphysics

from KratosMultiphysics.CompressiblePotentialFlowApplication.potential_flow_analysis import PotentialFlowAnalysis

"""
For user-scripting it is intended that a new class is derived
from PotentialFlowAnalysis to do modifications
"""

if __name__ == "__main__":

    with open("ProjectParameters.json",'r') as parameter_file:
        parameters = KratosMultiphysics.Parameters(parameter_file.read())

    model = KratosMultiphysics.Model()
    simulation = PotentialFlowAnalysis(model,parameters)
    simulation.Run()