KratosMultiphysics / Kratos

Kratos Multiphysics (A.K.A Kratos) is a framework for building parallel multi-disciplinary simulation software. Modularity, extensibility and HPC are the main objectives. Kratos has BSD license and is written in C++ with extensive Python interface.
https://kratosmultiphysics.github.io/Kratos/
Other
1.04k stars 246 forks source link

Running Kratos #12428

Open polenalit opened 5 months ago

polenalit commented 5 months ago

Dear all,

I am completely new to Kratos, so I have some very basic questions.

I was able to compile Kratos in the debug mode. However, I don't know how to run it. I always get an error :

import KratosMultiphysics ModuleNotFoundError: No module named 'KratosMultiphysics'

I found that I should add Kratos to the python path and lib folder to the system path. However, I am not sure which folder I should add to the python path and I don't have any kratos/lib folder.

Is there any documentation which explains the theory behind the implementation? I am particularly interested in large strain shell elements and contact formulation.

Best, Polen

mcgicjn2 commented 5 months ago

PythonPath = '.../.../bin/debug' Path = '../../bin/debug/libs'

Hope this helps you

polenalit commented 5 months ago

Thank you for the help. It is running now. However, I am getting some errors. I tried some examples with contact such as Examples-master/contact_structural_mechanics/validation/shallow_ironing_3D I run it as python3 MainKratos.py and I get /Kratos/bin/Debug/KratosMultiphysics/StructuralMechanicsApplication/structural_mechanics_solver.py", line 365, in import_constitutive_laws KratosMultiphysics.ReadMaterialsUtility(material_settings, self.model) RuntimeError: Error: Kratos components missing "HyperElastic3DLaw" Am I doing something wrong?

rubenzorrilla commented 5 months ago

Most probably you did not compile the ConstitutiveLawsApplication.

polenalit commented 5 months ago

Thank, I recompiled with ConstitutiveLawsApplication. However, I got the following error -- Trying to install python stub files to enable python hinting support for cpp libraries in IDEs... Traceback (most recent call last): File "/Kratos/scripts/post_install/stub_generation.py", line 218, in Main() File "/Kratos/scripts/post_install/stub_generation.py", line 202, in Main MoveKratosModuleStubFilesToPythonModule(kratos_library_path, list_of_cpp_libs) File "/Kratos/scripts/post_install/stub_generation.py", line 106, in MoveKratosModuleStubFilesToPythonModule shutil.copytree(stub_source_file_name, stub_dest_file_name, dirs_exist_ok=True) File "/usr/lib/python3.10/shutil.py", line 557, in copytree with os.scandir(src) as itr: FileNotFoundError: [Errno 2] No such file or directory: '/Kratos/bin/Release/libs/KratosStructuralMechanicsApplication' Traceback (most recent call last): File "/Kratos/scripts/post_install/stub_generation.py", line 216, in subprocess.run([sys.executable] + args, stdout = subprocess.PIPE, stderr = sys.stderr, check=True) File "/usr/lib/python3.10/subprocess.py", line 526, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['/usr/bin/python3', '/Kratos/scripts/post_install/stub_generation.py', '/Kratos/bin/Release']' returned non-zero exit status 1.

Anyway, it seems it is running fine, so I don't understand it.

rubenzorrilla commented 5 months ago

It seems to be some minor issue with the Python stubs @sunethwarna. In principle, you should be able to run cases. You can either disable the Python stubs generation or leave it as it is while we fix it.