Skip to content

This repository contains the PythonWrapperApplication source files for KratosMultiphysics

License

Notifications You must be signed in to change notification settings

loumalouomega/KratosPythonWrapperApplication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 

Repository files navigation

KratosPythonWrapperApplication

This repository contains the PythonWrapperApplication source files for KratosMultiphysics

How to use

his now allows to directly import from python, so I added the code of a "Main" that uses the analysis stage. Now we can run the simulation (without any additional modification) directly from C++. I added a main equivalent to the one of the structural, so:

(The interface on python in only for testing, can be removed, the final objective is to run everything from C++)

import KratosMultiphysics
import KratosMultiphysics.PythonWrapperApplication as PWA
PWA.PythonObjectCppWrapperUtility.RunStructuralAnalysisStage("ProjectParameters.json")

is equal to:

import KratosMultiphysics
from KratosMultiphysics.StructuralMechanicsApplication.structural_mechanics_analysis import StructuralMechanicsAnalysis

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

if __name__ == "__main__":

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

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

An example:

test_wrapper

Installation

Add the following lines to your configure.sh:

add_app "/this_folder/KratosPythonWrapperApplication/PythonWrapperApplication"  \

About

This repository contains the PythonWrapperApplication source files for KratosMultiphysics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published