Author Topic: Kratos For Dummies  (Read 703 times)

Daobing

  • Newbie
  • *
  • Posts: 5
Kratos For Dummies
« on: August 30, 2016, 07:18:38 PM »
Hi,
I am a beginner of Kratos. When I study the Kratos for Dummies, I met a error as follows:
daobing@xwing10:~/Desktop/kratos$ python example.py
 |  /           |             
 ' /   __| _` | __|  _ \   __|
 . \  |   (   | |   (   |\__ \
_|\_\_|  \__,_|\__|\___/ ____/
           Multi-Physics 5.0.16721
Traceback (most recent call last):
  File "example.py", line 9, in <module>
    from KratosMultiphysics.PureDiffusionApplication import *        #and now our application. note that we can import as many as we need to solve our specific problem
  File "/lordvader/doctorands/daobing/Desktop/kratos/KratosMultiphysics/PureDiffusionApplication.py", line 1, in <module>
    from KratosPureDiffusionApplication import *
ImportError: No module named KratosPureDiffusionApplication

Can you tell me how to fix it?
Thank you very much.

Best,
Daobing

Miguel Angel Celigueta

  • Administrator
  • Newbie
  • *****
  • Posts: 38
Re: Kratos For Dummies
« Reply #1 on: August 30, 2016, 07:26:21 PM »
Hi Daobing,
Did you compile the PureDiffusionApplication? It must be ON in the configure file.
Regards,
Miguel

Daobing

  • Newbie
  • *
  • Posts: 5
Re: Kratos For Dummies
« Reply #2 on: August 31, 2016, 09:29:17 AM »
Hi Miguel,

I add "-DPUREDIFFUSION_APPLICATION=ON     \" in the file  configure.sh, and compiled the modfied file using the command "sh configure.sh", but I cannot find the KratosMultiphysics/PureDiffusionApplication.py in the following outputs.

Install the project...
-- Install configuration: "Release"
-- Up-to-date: /lordvader/daobing/Desktop/kratos/KratosMultiphysics/__init__.py
-- Up-to-date: /lordvader/daobing/Desktop/kratos/KratosMultiphysics/kratos_utilities.py
-- Up-to-date: /lordvader/daobing/Desktop/kratos/KratosMultiphysics/kratos_globals.py
-- Up-to-date: /lordvader/daobing/Desktop/kratos/KratosMultiphysics/application_importer.py
-- Up-to-date: /lordvader/daobing/Desktop/kratos/KratosMultiphysics/KratosUnittest.py
-- Up-to-date: /lordvader/daobing/Desktop/kratos/libs/libboost_python.so.1.57.0
-- Up-to-date: /lordvader/daobing/Desktop/kratos/libs/libz.so.1.2.8
-- Up-to-date: /lordvader/daobing/Desktop/kratos/libs/libz.so.1
-- Up-to-date: /lordvader/daobing/Desktop/kratos/libs/libz.so
-- Up-to-date: /lordvader/daobing/Desktop/kratos/libs/libz.a
-- Up-to-date: /lordvader/daobing/Desktop/kratos/libs/libKratosCore.so
-- Up-to-date: /lordvader/daobing/Desktop/kratos/libs/Kratos.so
-- Up-to-date: /lordvader/daobing/Desktop/kratos/libs/KratosIncompressibleFluidApplication.so
-- Up-to-date: /lordvader/daobing/Desktop/kratos/KratosMultiphysics/IncompressibleFluidApplication.py
-- Up-to-date: /lordvader/daobing/Desktop/kratos/libs/KratosMeshingApplication.so
-- Up-to-date: /lordvader/daobing/Desktop/kratos/KratosMultiphysics/MeshingApplication.py
-- Up-to-date: /lordvader/daobing/Desktop/kratos/libs/KratosConvectionDiffusionApplication.so
-- Up-to-date: /lordvader/daobing/Desktop/kratos/KratosMultiphysics/ConvectionDiffusionApplication.py
-- Up-to-date: /lordvader/daobing/Desktop/kratos/libs/KratosFluidDynamicsApplication.so
-- Up-to-date: /lordvader/daobing/Desktop/kratos/KratosMultiphysics/FluidDynamicsApplication.py
-- Up-to-date: /lordvader/daobing/Desktop/kratos/libs/KratosSolidMechanicsApplication.so
-- Up-to-date: /lordvader/daobing/Desktop/kratos/KratosMultiphysics/SolidMechanicsApplication.py


Best,
Daobing

Josep Maria

  • Global Moderator
  • Jr. Member
  • *****
  • Posts: 50
Re: Kratos For Dummies
« Reply #3 on: August 31, 2016, 11:01:26 AM »
Hi Daobing,
Taking a look in Kratos for Dummies documentation,  there is an explanation of how to create an application using the classical way.
Right now, exists also a new and simplier way to do it using the application generator located in  the global repository : https://svn.cimne.upc.edu/p/kratos/kratos/kratos/python_scripts/application_generator

Once the application is created with all ingredients needed ( programed properly )  and inserted as a new application in your kratos local directory. Then,  you  will be able to compile it and you can use the python script to run the example.

I don't know if there is any link to the already programed application in the wiki....

If the application is not created and included in Kratos (as it is the case)  it does not exist  and can not be compiled and called from python.

To know twhich applications are avaliable,  you can take a look in you kratos/applications  local folder (in the global repository: https://svn.cimne.upc.edu/p/kratos/kratos/applications).  There is a CMakeList.txt file and an applications_interface.py file.  Inside them,  you can find out which applications can be activated in the compilation and which applications are exported to python, respectively.

I hope it helps to clarify what is happening.

 Good luck

Josep Maria
« Last Edit: August 31, 2016, 11:06:37 AM by Josep Maria »

Daobing

  • Newbie
  • *
  • Posts: 5
Re: Kratos For Dummies
« Reply #4 on: August 31, 2016, 11:10:52 AM »
Dear Josep,

Thank you so much. It will be very useful for me to learn the example.

Best,
Daobing

Daobing

  • Newbie
  • *
  • Posts: 5
Re: Kratos For Dummies
« Reply #5 on: August 31, 2016, 06:07:42 PM »
Hi Josep,

When I compile the files, some error happens as follows:

[  5%] Built target zlib
[  6%] Built target example
[  6%] Built target example64
[  6%] Built target minigzip
[  7%] Built target minigzip64
[ 13%] Built target zlibstatic
[ 15%] Built target gidpost
[ 25%] Built target KratosCore
[ 42%] Built target Kratos
[ 43%] Building CXX object applications/purediffusion_application/CMakeFiles/KratosPureDiffusionApplication.dir/purediffusion_application.cpp.o
In file included from /lordvader/daobing/Desktop/kratos/applications/purediffusion_application/purediffusion_application.cpp:16:0:
/lordvader/daobing/Desktop/kratos/applications/purediffusion_application/purediffusion_application.h:23:77: fatal error: custom_elements/poisson_2d.h: No such file or directory
 #include "custom_elements/poisson_2d.h" //including the file for the element
                                                                             ^
compilation terminated.
make[2]: *** [applications/purediffusion_application/CMakeFiles/KratosPureDiffusionApplication.dir/purediffusion_application.cpp.o] Error 1
make[1]: *** [applications/purediffusion_application/CMakeFiles/KratosPureDiffusionApplication.dir/all] Error 2
make: *** [all] Error 2

I already put the poisson_2d.h and poisson_2d.cpp in the /custom_elements/, but there is still an error.
Can you help me?

Best,
Daobing

Josep Maria

  • Global Moderator
  • Jr. Member
  • *****
  • Posts: 50
Re: Kratos For Dummies
« Reply #6 on: August 31, 2016, 09:58:16 PM »
Hi Daobing,

  You also have to include the cpp file in the CMakeList.txt  of your application.
I recommend you to take a look  to other applications to detect the errors.
 For example search the include of a particular element along an application.
(i.e. SolidMechanicsApplication or the FluidDynamicsApplication)

Regards

Josep Maria


Daobing

  • Newbie
  • *
  • Posts: 5
Re: Kratos For Dummies
« Reply #7 on: August 31, 2016, 10:18:58 PM »
Dear Josep,

Thanks for your reply. I already put the cpp file into the CMakeList.txt  of purediffusion application. But It does not work.
I will have a look to other applications to detect the error according to your suggestions.

Best,
Daobing