MFrontGenericInterfaceSupport icon indicating copy to clipboard operation
MFrontGenericInterfaceSupport copied to clipboard

Using

Open Janduigorila opened this issue 2 years ago • 25 comments

$ sudo apt install python3 python3-numpy libboost-all-dev cmake g++ gfortran The next step is to get the TFEL source code:

$ cd <where_you_want_to_download_the_source> $ mkdir -p TFEL && cd TFEL $ git clone https://github.com/thelfer/tfel.git This will download the current development version of TFEL.

Then we create a build directory and call ccmake.

$ mkdir build && cd build $ ccmake ../tfel ccmake allows to select various options. In this tutorial, we choose the following options:

CMAKE_INSTALL_PREFIX ~/.local TFEL_APPEND_VERSION ON enable-numpy-support ON enable-python ON enable-python-bindings ON The TFEL_APPEND_VERSION allows to install different versions of TFEL at the same location.

Then configure twice [c],[c] and generate [g]. Once done, just type:

$ make $ make install Finally, add the paths in your local .bashrc file:

export PATH=$PATH:~.local/bin export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:~/.local/lib export PYTHONPATH=${PYTHONPATH}:~/.local/lib/python3.8/site-packages Now you can use the local TFEL binaries such as mfront-X.Y.Z-dev and mtest-X.Y.Z-dev or define some global alias names for them.

<!– # Windows MINGW – > But, when I tried:

import mgis.fenics as mf Traceback (most recent call last): File "/home/philip/Documents/math-programming/MATH code/First FEM approx/brittle_1.py", line 3, in import mgis.fenics as mf ModuleNotFoundError: No module named 'mgis' And, when i Tried: from mfront_5_0_0_dev import MFrontNonlinearMaterial from mfront_5_0_0_dev import MFrontNonlinearProblem Traceback (most recent call last): File "/home/philip/Documents/math-programming/MATH code/First FEM approx/brittle_1.py", line 3, in from mfront_5_0_0_dev import MFrontNonlinearMaterial ImportError: cannot import name 'MFrontNonlinearMaterial' from 'mfront_5_0_0_dev' (/home/philip/.local/lib/python3.10/site-packages/mfront_5_0_0_dev/init.py) What it could be?

Janduigorila avatar Dec 10 '23 20:12 Janduigorila

You seem to have compiled tfel, not mgis, did you ?

thelfer avatar Dec 10 '23 20:12 thelfer

But mgis is not a module from TFEs?

Janduigorila avatar Dec 10 '23 20:12 Janduigorila

image I followed these steps to install it

Janduigorila avatar Dec 10 '23 20:12 Janduigorila

Ok, README tells you that MGIS is meant to use behaviours generated by MFront. Hence, you do want to install TFEL/MFront but you still need to install MGIS.

See https://thelfer.github.io/mgis/web/install.html and https://github.com/thelfer/MFrontGenericInterfaceSupport/blob/master/INSTALL-cmake.md

thelfer avatar Dec 10 '23 20:12 thelfer

BTW, the python bindings of MGIS gives you access to mgis.fenics which works with the legacy version of FEniCS. If you need to use FEniCS-X, another library is required.

thelfer avatar Dec 10 '23 20:12 thelfer

Ok, i'll try to follow the steps, i'm newbie with linux and installations. But thanks for your attention.

Janduigorila avatar Dec 10 '23 20:12 Janduigorila

And I need to have spack and that stuffs of supercomputer to use mgis?

Janduigorila avatar Dec 10 '23 20:12 Janduigorila

No, you either install from source or using spack (or brew on Mac OS)

thelfer avatar Dec 10 '23 20:12 thelfer

Where can I found this:Call cmake <path_to_MGIS_SOURCES> to configure the directory It's not clear what should I do, the link is from the mfront git?

Janduigorila avatar Dec 10 '23 21:12 Janduigorila

in my TFEL directory, /home/philip/Downloads/TFEL There is two files, one build and one TFEL, no MGIS

Janduigorila avatar Dec 10 '23 21:12 Janduigorila

git clone https://github.com/thelfer/MFrontGenericInterfaceSupport.git

thelfer avatar Dec 10 '23 21:12 thelfer

Ok, i followed the 5 steps of installation, but still not working and tipped the "Make clean". What should I do now?

Janduigorila avatar Dec 10 '23 22:12 Janduigorila

And How can I activate these options: Options enable-c-bindings: compiles the C bindings (default=OFF) enable-fortran-bindings: compiles bindings for the Fortran2003 language (default=OFF) enable-python-bindings: compiles the Python bindings. This requires the Boost/Python library to be available (default=OFF) enable-fenics-bindings: compiles the FEniCS bindings. Those bindings are experimental and very limited. To use MGIS with FEniCS, usage of the Python bindings are encouraged. enable-julia-bindings: compiles the Julia bindings. This requires the CxxWrap library to be available. enable-website: generate the TFEL website (enabled by default if pandoc is found) enable-portable-build: do not use processor specific flags. enable-static: compiles static libraries enable-doxygen-doc: enable the generation of the API documentation using with Doxygen. cmake usefull variables CMAKE_BUILD_TYPE : two values are supported Release and Debug CASTEM_INSTALL_PATH : specify where the castem has been installed CMAKE_TOOLCHAIN_FILE : specify a tool chain file Python_ADDITIONAL_VERSIONS : select the python version to use. Note that only the major and minor version of python shall be passed, not the revision version or the detection fails.

Janduigorila avatar Dec 10 '23 22:12 Janduigorila

You have to be clearer. What are you meaning by the "5 steps of installation". There are usually three: cmake, make and make install.

Here is a script that I use for a fresh install: install.zip

You may want to ignore everything related to tfel-plot and tfel-editor but it is a good starting point for what you need to do.

thelfer avatar Dec 10 '23 22:12 thelfer

sorry, i meant this 5 steps from the site that you provides me: The simplest way to compile this package is:

cd to the directory containing the package’s source code and type cmake . to configure the package for your system. This will build MGIS in place.

However, we strongly recommend building MGIS out of the source tree as follows:

Create a build directory et go in this directory Call cmake <path_to_MGIS_SOURCES> to configure the directory Useful options are listed below.

Running cmake takes awhile. While running, it prints some messages telling which features it is checking for.

Type make to compile the package.

Optionally, type make check to run any self-tests that come with the package.

Type make install to install the programs and any data files and documentation.

You can remove the program binaries and object files from the source code directory by typing make clean.

Also, thanks for the help, I'll try to see this install zip

Janduigorila avatar Dec 10 '23 22:12 Janduigorila

Let me know

thelfer avatar Dec 10 '23 23:12 thelfer

it took a while, but in the end, some errors appeared: CMake Error at cmake/modules/qt.cmake:1 (find_package): By not providing "FindQt5.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "Qt5", but CMake did not find one.

Could not find a package configuration file provided by "Qt5" (requested version 5.3) with any of the following names:

Qt5Config.cmake
qt5-config.cmake

Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR" to a directory containing one of the above files. If "Qt5" provides a separate development package or SDK, be sure it has been installed. Call Stack (most recent call first): CMakeLists.txt:14 (include)

-- Configuring incomplete, errors occurred! See also "/home/philip/codes/tfel-plot/master/src/build/CMakeFiles/CMakeOutput.log". See also "/home/philip/codes/tfel-plot/master/src/build/CMakeFiles/CMakeError.log". And installation failed

Janduigorila avatar Dec 10 '23 23:12 Janduigorila

Ok, i installed everything and successfully, but mgis.fenics is not working yet

How can i check these options: Options enable-c-bindings: compiles the C bindings (default=OFF) enable-fortran-bindings: compiles bindings for the Fortran2003 language (default=OFF) enable-python-bindings: compiles the Python bindings. This requires the Boost/Python library to be available (default=OFF) enable-fenics-bindings: compiles the FEniCS bindings. Those bindings are experimental and very limited. To use MGIS with FEniCS, usage of the Python bindings are encouraged. enable-julia-bindings: compiles the Julia bindings. This requires the CxxWrap library to be available. enable-website: generate the TFEL website (enabled by default if pandoc is found) enable-portable-build: do not use processor specific flags. enable-static: compiles static libraries enable-doxygen-doc: enable the generation of the API documentation using with Doxygen. cmake usefull variables CMAKE_BUILD_TYPE : two values are supported Release and Debug CASTEM_INSTALL_PATH : specify where the castem has been installed CMAKE_TOOLCHAIN_FILE : specify a tool chain file Python_ADDITIONAL_VERSIONS : select the python version to use. Note that only the major and minor version of python shall be passed, not the revision version or the detection fails. Also, The only problem that i was founding it was caused by the missing of qt5 that i already installed and there is no error in the installation proccess.

Janduigorila avatar Dec 11 '23 01:12 Janduigorila

As I told you, you did not need to install  tfel-plot and tfel-editor which add those dependencies to Qt.

Anyway, you can now type something like:

$ source ~/codes/tfel-editor/master/install/env.sh
$ source ~/codes/mgis/master/install/env.sh

You'll have to do it in every new terminal

thelfer avatar Dec 11 '23 08:12 thelfer

Thanks dude, now when I'm running, it doesn't appears anymore any mgis import error. But my code isn't working yet image Just for ask, this script need to be configured in Mfront, right? How can I call it to write this?

Janduigorila avatar Dec 11 '23 20:12 Janduigorila

And, really, thanks for everything, you helped me a lot.

Janduigorila avatar Dec 11 '23 20:12 Janduigorila

you need to write this behaviour in a file name PhaseFieldDamage.mfront and call MFront to generate the shared library that will be loaded by mgis.fenics:

$ mfront --obuild --interface=generic PhaseFieldDamage.mfront

thelfer avatar Dec 11 '23 20:12 thelfer

ok, The first one that you send me, compile in vs code terminal, but this one:

PhaseFieldDisplacementDeviatoricSplit_BehaviourType.mfront.zip

I tried: mfront --obuild --interface=umat PhaseFieldDisplacementDeviatoricSplit_BehaviourType.mfront

switching every interface to each of these options: Cast3M Cast3M21 Castem Castem21 abaqus abaqusexplicit amitex ansys aster calculix castem castem21 comsol dianafea epx generic umat

But, this compilation error:

philip@my-computer:~/Documents/math-programming/MATH code$ mfront --obuild --interface=umat PhaseFieldDisplacementDeviatoricSplit_BehaviourType.mfront Error while treating file 'PhaseFieldDisplacementDeviatoricSplit_BehaviourType.mfront'

Appeared everytime, and when I run the file:

philip@my-computer:~/Documents/math-programming/MATH code$ /bin/python3 "/home/philip/Documents/math-programming/MATH code/First FEM approx/brittle_boudin.py" Behaviour 'PhaseFieldDisplacementDeviatoricSplit' has not been found in './src/libBehaviour.so'. Attempting to compile 'PhaseFieldDisplacementDeviatoricSplit.mfront' in './'... Error while treating file 'PhaseFieldDisplacementDeviatoricSplit.mfront' CxxTokenizer::openFile: unable to open file 'PhaseFieldDisplacementDeviatoricSplit.mfront' Traceback (most recent call last): File "/home/philip/codes/mgis/master/install-d4058ad4/lib/python3.10/site-packages/mgis/fenics/nonlinear_material.py", line 66, in init self.load_behaviour() File "/home/philip/codes/mgis/master/install-d4058ad4/lib/python3.10/site-packages/mgis/fenics/nonlinear_material.py", line 84, in load_behaviour self.is_finite_strain = mgis_bv.isStandardFiniteStrainBehaviour( RuntimeError: LibrariesManager::extract: could not load symbol 'PhaseFieldDisplacementDeviatoricSplit_BehaviourType'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/philip/Documents/math-programming/MATH code/First FEM approx/brittle_boudin.py", line 30, in material_u = mf.MFrontNonlinearMaterial("./src/libBehaviour.so", File "/home/philip/codes/mgis/master/install-d4058ad4/lib/python3.10/site-packages/mgis/fenics/nonlinear_material.py", line 80, in init self.load_behaviour() File "/home/philip/codes/mgis/master/install-d4058ad4/lib/python3.10/site-packages/mgis/fenics/nonlinear_material.py", line 84, in load_behaviour self.is_finite_strain = mgis_bv.isStandardFiniteStrainBehaviour( RuntimeError: LibrariesManager::extract: could not load symbol 'PhaseFieldDisplacementDeviatoricSplit_BehaviourType'

Appeared. I tried to do the same as you, but I don't know why is not working. https://thelfer.github.io/mgis/web/mgis_fenics_phase_field.html this is the site where I took the files

Janduigorila avatar Dec 11 '23 20:12 Janduigorila

You zip file is empty.

This works out of the box:

$ wget https://gitlab.enpc.fr/navier-fenics/mgis-fenics-demos/raw/master/demos/phase_field/PhaseFieldDisplacementDeviatoricSplit.mfront
$ mfront --obuild --interface=generic PhaseFieldDisplacementDeviatoricSplit.mfront

thelfer avatar Dec 11 '23 21:12 thelfer

BTW, MGIS only works with the generic interface (MGIS means MFront's Generic Interface Support`)

thelfer avatar Dec 11 '23 21:12 thelfer