-
Notifications
You must be signed in to change notification settings - Fork 247
Python Script Tutorial: Getting Started
In order to write a python script with Kratos the first step would be to "Obtain" the KratosMultiphysics
module and then "add" it as an external module to the Python.
There are two ways to "Obtain" the module:
- Download the latest release of Kratos from Kratos' release page
- Getting the Kratos and its GUI from GiD internet retrieve.
A simple way would be to add the KratosMultiphysics
module path to the PYTHONPATH
environment variable.
In Linux you can set the python path to the Kratos root directory using export
command in terminal:
export PYTHONPATH=/path/to/Kratos
For a release version extracted your home directory
export PYTHONPATH=$HOME/Kratos
In case of having a GiD installed in GiDx64/GiD14.0.0
subfolder of home:
export PYTHONPATH=$HOME/GiDx64/GiD14.0.0/problemtypes/kratos.gid/exec/Kratos
To create the path on Windows 10 and having installed Kratos through GiD or either downloaded manually, follow these steps:
-
In the search bar type
system
and selectSystem (Control Panel)
-
In the left menu, click the
Advanced system settings
link. -
Click Environment Variables Button at the bottom. In the section System Variables, find the
PYTHONPATH
andPYTHONHOME
environment variables and select them. Edit both of them. If thePYTHONHOME
orPYTHONPATH
environment variable do not exist, click New and create them.-
If you have installed Kratos using GiD: Go to the GiD folder. For example, it could be in
C:\Program Files\GiD
Inside the GiD folder, you should follow\problemtypes\kratos.gid\exec\Kratos
. There are many subfolders here and can be confusing. The correct one is just when you can see the KratosMultiphysics folder. Copy the current path and paste it as variable name. -
If you have downloaded yourself or you have compiled Kratos in your own computer, copy the Kratos path, for example
C:\Kratos
-
-
Click
Accept
. Now you can go to the next tutorial.
Next Hello Kratos
- Getting Kratos (Last compiled Release)
- Compiling Kratos
- Running an example from GiD
- Kratos input files and I/O
- Data management
- Solving strategies
- Manipulating solution values
- Multiphysics
- Video tutorials
- Style Guide
- Authorship of Kratos files
- Configure .gitignore
- How to configure clang-format
- How to use smart pointer in Kratos
- How to define adjoint elements and response functions
- Visibility and Exposure
- Namespaces and Static Classes
Kratos structure
Conventions
Solvers
Debugging, profiling and testing
- Compiling Kratos in debug mode
- Debugging Kratos using GDB
- Cross-debugging Kratos under Windows
- Debugging Kratos C++ under Windows
- Checking memory usage with Valgind
- Profiling Kratos with MAQAO
- Creating unitary tests
- Using ThreadSanitizer to detect OMP data race bugs
- Debugging Memory with ASAN
HOW TOs
- How to create applications
- Python Tutorials
- Kratos For Dummies (I)
- List of classes and variables accessible via python
- How to use Logger
- How to Create a New Application using cmake
- How to write a JSON configuration file
- How to Access DataBase
- How to use quaternions in Kratos
- How to do Mapping between nonmatching meshes
- How to use Clang-Tidy to automatically correct code
- How to use the Constitutive Law class
- How to use Serialization
- How to use GlobalPointerCommunicator
- How to use PointerMapCommunicator
- How to use the Geometry
- How to use processes for BCs
- How to use Parallel Utilities in futureproofing the code
- Porting to Pybind11 (LEGACY CODE)
- Porting to AMatrix
- How to use Cotire
- Applications: Python-modules
- How to run multiple cases using PyCOMPSs
- How to apply a function to a list of variables
- How to use Kratos Native sparse linear algebra
Utilities
Kratos API
Kratos Structural Mechanics API