Skip to content

Manipulating solution values

Aditya Ghantasala edited this page Mar 23, 2019 · 25 revisions

Manipulating solution values

1. Introduction

This tutorial session is intended to illustrate how the Kratos' data structure, when accessed form Python, can be used to manipulate and set custom boundary conditions, solutions over the computational domain in a given problem. The following explanation builds upon the previous sessions of Data management and Solving strategies.

Here the CFD problem described in the first tutorial of Running an example from GiD is used as the working example. The setup files (mdpa, MainKratos.py and the JSON) of this problem can be downloaded from here. Please extract the zip file and make it ready for the next task.

2. The CFD example

As the first step of this tutorial, we understand the CFD example problem setup and run the simulation to observe the initial result. The CFD problem setup is illustrated below

As illustrated, a no slip condition is applied on the top and bottom walls of the 2D fluid domain. A uniform and constant velocity inlet is applied on the left hand side and a pressure outlet (0 pressure) is applied on the right hand side of the domain. These boundary condition are defined in the ProjectParameters.json. The following lines from the ProjectPrameters.json reflect the same

       "boundary_conditions_process_list" : [{
            "python_module" : "apply_inlet_process",
            "kratos_module" : "KratosMultiphysics.FluidDynamicsApplication",
            "Parameters"    : {
                "model_part_name" : "FluidModelPart.AutomaticInlet2D_Inlet",
                "variable_name"   : "VELOCITY",
                "modulus"         : "25.0",
                "direction"       : "automatic_inwards_normal",
                "interval"        : [0,10.0]
            }
        },{
            "python_module" : "apply_inlet_process",
            "kratos_module" : "KratosMultiphysics.FluidDynamicsApplication",
            "Parameters"    : {
                "model_part_name" : "FluidModelPart.AutomaticInlet2D_Inlet",
                "variable_name"   : "VELOCITY",
                "modulus"         : 25.0,
                "direction"       : "automatic_inwards_normal",
                "interval"        : [10.0,"End"]
            }
        },{
            "python_module" : "apply_outlet_process",
            "kratos_module" : "KratosMultiphysics.FluidDynamicsApplication",
            "Parameters"    : {
                "model_part_name"    : "FluidModelPart.Outlet2D_Outlet",
                "variable_name"      : "PRESSURE",
                "constrained"        : true,
                "value"              : 0.0,
                "hydrostatic_outlet" : false,
                "h_top"              : 0.0
            }
        },{
            "python_module" : "apply_noslip_process",
            "kratos_module" : "KratosMultiphysics.FluidDynamicsApplication",
            "Parameters"    : {
                "model_part_name" : "FluidModelPart.NoSlip2D_InterfaceFluid"
            }
        },{
            "python_module" : "apply_slip_process",
            "kratos_module" : "KratosMultiphysics.FluidDynamicsApplication",
            "process_name"  : "ApplySlipProcess",
            "Parameters"    : {
                "model_part_name" : "FluidModelPart.Slip2D"
            }
        }]

Please run the example by using the method described in the previous tutorials. That is by using the runkratos executable. Once the simulation is finished (should take about 4 minutes) we load the result (.bin) file into GiD to view the following result

3. The MainKratos.py Script

As illustrated in the previous tutorial

Project information

Getting Started

Tutorials

Developers

Kratos structure

Conventions

Solvers

Debugging, profiling and testing

HOW TOs

Utilities

Kratos API

Kratos Structural Mechanics API

Clone this wiki locally