KratosMultiphysics / Examples

All benchmarks, examples and applications cases to be run by Kratos. Note that unit tests are in Kratos repository and NOT here
https://kratosmultiphysics.github.io/Examples/
43 stars 38 forks source link

fsi_turek_FSI2 #114

Closed damar261 closed 1 year ago

damar261 commented 2 years ago

I downloaded the Kratos binaries (KratosRelease) for Linux and successfully used install.sh to create the alias kratos. I was then able to run the example _cylinder_cooling_Re100Pr2 with kratos MainKratos.py

However, I then tried to run _fsi_turekFSI2 and I get this error:

Importing  KratosFSIApplication 
Initializing KratosFSIApplication...
Traceback (most recent call last):
  File "MainKratos.py", line 44, in <module>
    analysis_stage_module, analysis_stage_class_name)
AttributeError: 'module' object has no attribute 'FsiAnalysis'
KRATOS TERMINATED WITH ERROR

What can I do to correct this error?

Thank you

rubenzorrilla commented 1 year ago

I downloaded the Kratos binaries (KratosRelease) for Linux and successfully used install.sh to create the alias kratos. I was then able to run the example _cylinder_cooling_Re100Pr2 with kratos MainKratos.py

However, I then tried to run _fsi_turekFSI2 and I get this error:

Importing  KratosFSIApplication 
Initializing KratosFSIApplication...
Traceback (most recent call last):
  File "MainKratos.py", line 44, in <module>
    analysis_stage_module, analysis_stage_class_name)
AttributeError: 'module' object has no attribute 'FsiAnalysis'
KRATOS TERMINATED WITH ERROR

What can I do to correct this error?

Thank you

Hi @damar261! Thanks for reporting. I think this comes from this one. It should be fixed in past week release. Alternatively, can you try changing FsiAnalysis by FSIAnalysis in line 44 of your MainKratos.py?

damar261 commented 1 year ago

Thank you for the reply. However, I found no FsiAnalysis in MainKratos.py. Line 44 is

        analysis_stage_module, analysis_stage_class_name)

In fact, the example's directory makes no reference to FsiAnalysis:

(08:16:28) [asti]:fsi_turek_FSI2> pwd
/home/mefpp_dmartin/Examples/fluid_structure_interaction/validation/fsi_turek_FSI2
(08:16:36) [asti]:fsi_turek_FSI2> grep -ri FsiAnalysis

I looked in the modules too and the only references I found were with uppercases:

(08:18:04) [asti]:KratosRelease> pwd
/home/mefpp_dmartin/KratosRelease
(08:18:11) [asti]:KratosRelease> grep -ri FsiAnalysis
applications/FSIapplication/python_scripts/fsi_analysis.py:class FSIAnalysis(AnalysisStage):
applications/FSIapplication/python_scripts/fsi_analysis.py:        #     Kratos.Logger.PrintInfo("FSIAnalysis", "Using the old way to pass the echo_level, this will be removed!")
applications/FSIapplication/python_scripts/fsi_analysis.py:        super(FSIAnalysis, self).OutputSolutionStep()
applications/FSIapplication/python_scripts/fsi_analysis.py:    simulation = FSIAnalysis(model, parameters)
Binary file applications/FSIapplication/python_scripts/__pycache__/fsi_analysis.cpython-34.pyc matches
applications/FSIapplication/tests/mok_benchmark_test.py:            fsi_analysis.FSIAnalysis(model, project_parameters).Run()

I also tried changing the JSON files by replacing "analysis_stage" : "KratosMultiphysics.FSIApplication.fsi_analysis" with

without success.

rubenzorrilla commented 1 year ago

Thank you for the reply. However, I found no FsiAnalysis in MainKratos.py. Line 44 is

        analysis_stage_module, analysis_stage_class_name)

In fact, the example's directory makes no reference to FsiAnalysis:

(08:16:28) [asti]:fsi_turek_FSI2> pwd
/home/mefpp_dmartin/Examples/fluid_structure_interaction/validation/fsi_turek_FSI2
(08:16:36) [asti]:fsi_turek_FSI2> grep -ri FsiAnalysis

I looked in the modules too and the only references I found were with uppercases:

(08:18:04) [asti]:KratosRelease> pwd
/home/mefpp_dmartin/KratosRelease
(08:18:11) [asti]:KratosRelease> grep -ri FsiAnalysis
applications/FSIapplication/python_scripts/fsi_analysis.py:class FSIAnalysis(AnalysisStage):
applications/FSIapplication/python_scripts/fsi_analysis.py:        #     Kratos.Logger.PrintInfo("FSIAnalysis", "Using the old way to pass the echo_level, this will be removed!")
applications/FSIapplication/python_scripts/fsi_analysis.py:        super(FSIAnalysis, self).OutputSolutionStep()
applications/FSIapplication/python_scripts/fsi_analysis.py:    simulation = FSIAnalysis(model, parameters)
Binary file applications/FSIapplication/python_scripts/__pycache__/fsi_analysis.cpython-34.pyc matches
applications/FSIapplication/tests/mok_benchmark_test.py:            fsi_analysis.FSIAnalysis(model, project_parameters).Run()

I also tried changing the JSON files by replacing "analysis_stage" : "KratosMultiphysics.FSIApplication.fsi_analysis" with

* `"KratosMultiphysics.FSIApplication.FSI_analysis"`

* `"KratosMultiphysics.FSIApplication.FSI_Analysis"`

* `"KratosMultiphysics.FSIApplication.FSIAnalysis"`

without success.

The analysis_stage class is correct.

Can you confirm that the FSI module (FSIApplication) is installed in your machine? You can do so by simply creating a Python script that does

import KratosMultiphysics
import KratosMultiphysics.FSIApplication
damar261 commented 1 year ago

I think we found the problem, I get

    import KratosMultiphysics.FSIApplication
ModuleNotFoundError: No module named 'KratosMultiphysics.FSIApplication'
rubenzorrilla commented 1 year ago

Very good. I think that installing latest release (9.2) should solve the issue (before we didn't include the FSI module with the -all package).

damar261 commented 1 year ago

I already have version 9.2:

(09:36:58) [asti]:source> pip3 show KratosMultiphysics
Name: KratosMultiphysics
Version: 9.2.0
Summary: KRATOS Multiphysics ("Kratos") is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
Home-page: https://github.com/KratosMultiphysics/
Author: Kratos Team
Author-email: kratos@listas.cimne.upc.edu
License: UNKNOWN
Location: /users/dmartin/.local/lib/python3.9/site-packages
Requires: numpy
Required-by: 
rubenzorrilla commented 1 year ago

As far as I know, FSI application must be included with the pip all package (i.e. pip install KratosMultiphysics-all). Pinging @roigcarlo to confirm this.

@damar261 how did you get these binaries?

damar261 commented 1 year ago

Ah! I initially used pip install KratosMultiphysics! Everything works fine with KratosMultiphysics-all, thank you for your help.

rubenzorrilla commented 1 year ago

Very good. For the record, pip install KratosMultiphysics only installs KratosCore.