CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Installation (https://www.cfd-online.com/Forums/openfoam-installation/)
-   -   [OpenFOAM.com] Custom solver (TwoPhaseFlow) installation error in OpenFOAM v1812 (https://www.cfd-online.com/Forums/openfoam-installation/243122-custom-solver-twophaseflow-installation-error-openfoam-v1812.html)

silviliril May 31, 2022 01:08

Custom solver (TwoPhaseFlow) installation error in OpenFOAM v1812
 
I am trying to install TwoPhaseFlow solver which is compatible with OpenFOAM-v1812.

I installed OpenFOAM-v1812 already and now trying to compile TwoPhaseFlow. I am getting following error:

Code:

In file included from /home/arupdas/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/lnInclude/List.H:381:0,
                from /home/arupdas/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/lnInclude/wordList.H:48,
                from /home/arupdas/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/lnInclude/Enum.H:40,
                from /home/arupdas/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/lnInclude/IOobject.H:79,
                from /home/arupdas/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/lnInclude/regIOobject.H:41,
                from /home/arupdas/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/lnInclude/GeometricField.H:42,
                from /home/arupdas/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/lnInclude/GeometricScalarField.H:38,
                from /home/arupdas/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/lnInclude/GeometricFields.H:34,
                from /home/arupdas/OpenFOAM/OpenFOAM-v1812/src/finiteVolume/lnInclude/volFields.H:37,
                from surfaceTensionForceModels/surfaceTensionForceModel/RDF/RDF.H:34,
                from surfaceTensionForceModels/surfaceTensionForceModel/RDF/RDF.C:20:
/home/arupdas/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/lnInclude/List.C: In instantiation of ‘Foam::List<T>::List(InputIterator, InputIterator) [with InputIterator = int; T = long int]’:
surfaceTensionForceModels/surfaceTensionForceModel/RDF/RDF.C:124:43:  required from here
/home/arupdas/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/lnInclude/List.C:300:44: error: no matching function for call to ‘distance(int&, int&)’
    List<T>(begIter, endIter, std::distance(begIter, endIter))
                                            ^
In file included from /usr/include/c++/5/bits/stl_algobase.h:66:0,
                from /usr/include/c++/5/bits/char_traits.h:39,
                from /usr/include/c++/5/string:40,
                from /home/arupdas/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/lnInclude/string.H:52,
                from /home/arupdas/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/lnInclude/word.H:43,
                from /home/arupdas/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/lnInclude/int16.H:39,
                from /home/arupdas/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/lnInclude/int.H:38,
                from /home/arupdas/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/lnInclude/label.H:39,
                from /home/arupdas/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/lnInclude/messageStream.H:50,
                from /home/arupdas/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/lnInclude/error.H:51,
                from /home/arupdas/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/lnInclude/typeInfo.H:56,
                from surfaceTensionForceModels/surfaceTensionForceModel/RDF/RDF.H:33,
                from surfaceTensionForceModels/surfaceTensionForceModel/RDF/RDF.C:20:
/usr/include/c++/5/bits/stl_iterator_base_funcs.h:114:5: note: candidate: template<class _InputIterator> typename std::iterator_traits<_Iterator>::difference_type std::distance(_InputIterator, _InputIterator)
    distance(_InputIterator __first, _InputIterator __last)
    ^
/usr/include/c++/5/bits/stl_iterator_base_funcs.h:114:5: note:  template argument deduction/substitution failed:
/usr/include/c++/5/bits/stl_iterator_base_funcs.h: In substitution of ‘template<class _InputIterator> typename std::iterator_traits<_Iterator>::difference_type std::distance(_InputIterator, _InputIterator) [with _InputIterator = int]’:
/home/arupdas/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/lnInclude/List.C:300:44:  required from ‘Foam::List<T>::List(InputIterator, InputIterator) [with InputIterator = int; T = long int]’
surfaceTensionForceModels/surfaceTensionForceModel/RDF/RDF.C:124:43:  required from here
/usr/include/c++/5/bits/stl_iterator_base_funcs.h:114:5: error: no type named ‘difference_type’ in ‘struct std::iterator_traits<int>’
make: *** [Make/linux64GccDPInt64Opt/surfaceTensionForceModels/surfaceTensionForceModel/RDF/RDF.o] Error 1
/usr/bin/ld: cannot find -lsurfaceForces
collect2: error: ld returned 1 exit status
make: *** [/home/arupdas/OpenFOAM/arupdas-v1812/platforms/linux64GccDPInt64Opt/bin/reconstructInterface] Error 1
/usr/bin/ld: cannot find -lsurfaceForces
collect2: error: ld returned 1 exit status
make: *** [/home/arupdas/OpenFOAM/arupdas-v1812/platforms/linux64GccDPInt64Opt/bin/multiRegionPhaseChangeFlow] Error 1
/usr/bin/ld: cannot find -lsurfaceForces
collect2: error: ld returned 1 exit status
make: *** [/home/arupdas/OpenFOAM/arupdas-v1812/platforms/linux64GccDPInt64Opt/bin/interFlow] Error 1
/usr/bin/ld: cannot find -lsurfaceForces
collect2: error: ld returned 1 exit status
make: *** [/home/arupdas/OpenFOAM/arupdas-v1812/platforms/linux64GccDPInt64Opt/bin/compressibleInterFlow] Error 1

Error messages:
/home/arupdas/OpenFOAM/OpenFOAM-v1812/src/OpenFOAM/lnInclude/List.C:300:44: error: no matching function for call to ‘distance(int&, int&)’

/usr/include/c++/5/bits/stl_iterator_base_funcs.h:114:5: error: no type named ‘difference_type’ in ‘struct std::iterator_traits<int>’

Please tell me, what am I doing wrong?

olesen June 9, 2022 10:23

Looks like usual problem with label size 64. If you construct something like the following:
Code:

label val = 100;
labelList test(5, val);

With label size 64 this is seen as labelList(int, long), but there is no constructor for that. You are hoping to get the first parameter seen as a label (int64) but it is still an int.


In OpenFOAM-v1812 and others, there was a list constructor taking two iterators, which is what the compiler is trying to use (and failing miserably). Which also explains why this constructor with two iterators was chucked out in later versions.


You can probably compile with somewhat newer OpenFOAM versions, but I did a quick test with 2112 + clang and there are still something that the DLR people need to update. I suggest that you create an issue on their tracker about what you are attempting. With some luck they can point you in the right direction.


All times are GMT -4. The time now is 19:55.