CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Personalization of mapFields and libsampling - Compilation issues (https://www.cfd-online.com/Forums/openfoam-programming-development/173879-personalization-mapfields-libsampling-compilation-issues.html)

saimat June 29, 2016 07:49

Personalization of mapFields and libsampling - Compilation issues
 
Dear Foamers,

i'm using OpenFOAM 2.2.2. In order to lower the interpolation errors of mapFields near walls I am trying to add a new interpolation scheme like this was done here:

http://www.cfd-online.com/Forums/ope...mapfields.html

Therefore I need to change mapFields itself as well as some files in the sampling library (inside meshToMeshInterpolation).
I want the original mapFields executable and sampling libraries to be unchanged. Thats why I copied the mapFields directory as well as the whole OpenFOAM src-folder (including 'sampling') to another location.

To get a smooth start I changed the names 'mapFields' to mapFieldsMJ and did some changes to the Make-files. Now they look like that:

mapFieldsMJ/Make/files:
Code:

mapLagrangian.C
mapFieldsMJ.C

EXE = $(FOAM_USER_APPBIN)/mapFieldsMJ

mapFieldsMJ/Make/options:
Code:

EXE_INC = \
    -I$(LIB_USER_SRC)/meshTools/lnInclude \
    -I$(LIB_USER_SRC)/lagrangian/basic/lnInclude \
    -I$(LIB_USER_SRC)/finiteVolume/lnInclude \
    -I$(LIB_USER_SRC)/sampling/lnInclude

EXE_LIBS = \
    -L$(FOAM_USER_LIBBIN) \
    -lsamplingMJ \
    -lmeshTools \
    -llagrangian \
    -lfiniteVolume \
    -lgenericPatchFields

$LIB_USER_SRC/sampling/Make/files:
Code:

... (only last line changed) ...

meshToMeshNew = meshToMeshInterpolation/meshToMeshNew
$(meshToMeshNew)/meshToMeshNew.C
$(meshToMeshNew)/meshToMeshNewParallelOps.C

LIB = $(FOAM_USER_LIBBIN)/libsamplingMJ

$LIB_USER_SRC/sampling/Make/files:
Code:

EXE_INC = \
    -I$(LIB_USER_SRC)/finiteVolume/lnInclude \
    -I$(LIB_USER_SRC)/meshTools/lnInclude \
    -I$(LIB_USER_SRC)/surfMesh/lnInclude \
    -I$(LIB_USER_SRC)/fileFormats/lnInclude \
    -I$(LIB_USER_SRC)/triSurface/lnInclude \
    -I$(LIB_USER_SRC)/conversion/lnInclude \
    -I$(LIB_USER_SRC)/lagrangian/basic/lnInclude

LIB_LIBS = \
    -lfiniteVolume \
    -lmeshTools \
    -lsurfMesh \
    -lfileFormats \
    -ltriSurface \
    -llagrangian \
    -lconversion

Afterwards I tried to compile the renamed code and to run it. The compilation of libsamplingMJ (first) and mapFieldsMJ (second) gave no error. But using mapFieldsMJ in a test case afterwards failed and returned the following error message:

Code:

*** glibc detected *** mapFieldsMJ: corrupted double-linked list: 0x00000000013694e0 ***                                                                                                                                 
======= Backtrace: =========                                                                                                                                                                                             
/lib64/libc.so.6[0x34c2075f3e]                                                                                                                                                                                           
/lib64/libc.so.6[0x34c2076343]                                                                                                                                                                                           
/lib64/libc.so.6[0x34c2078d68]                                                                                                                                                                                           
/lib64/libc.so.6(exit+0x115)[0x34c2035b15]                                                                                                                                                                               
/lib64/libc.so.6(__libc_start_main+0x104)[0x34c201ed24]                                                                                                                                                                   
mapFieldsMJ[0x4326f9]                                                                                                                                                                                                     
======= Memory map: ========                                                                                                                                                                                             
00400000-00501000 r-xp 00000000 08:02 11403340                          /local_home/joppa_local/OpenFOAM/joppa_local-2.2.2/platforms/linux64Gcc45DPOpt/bin/mapFieldsMJ                                                   
00701000-00707000 rw-p 00101000 08:02 11403340                          /local_home/joppa_local/OpenFOAM/joppa_local-2.2.2/platforms/linux64Gcc45DPOpt/bin/mapFieldsMJ                                                   
011c5000-01720000 rw-p 00000000 00:00 0                                  [heap]                                                                                                                                           
34c1c00000-34c1c20000 r-xp 00000000 08:02 5243033                        /lib64/ld-2.12.so                                                                                                                               
34c1e1f000-34c1e20000 r--p 0001f000 08:02 5243033                        /lib64/ld-2.12.so                                                                                                                               
34c1e20000-34c1e21000 rw-p 00020000 08:02 5243033                        /lib64/ld-2.12.so                                                                                                                               
34c1e21000-34c1e22000 rw-p 00000000 00:00 0                                                                                                                                                                               
34c2000000-34c218a000 r-xp 00000000 08:02 5243035                        /lib64/libc-2.12.so                                                                                                                             
34c218a000-34c238a000 ---p 0018a000 08:02 5243035                        /lib64/libc-2.12.so                                                                                                                             
34c238a000-34c238e000 r--p 0018a000 08:02 5243035                        /lib64/libc-2.12.so                                                                                                                             
34c238e000-34c2390000 rw-p 0018e000 08:02 5243035                        /lib64/libc-2.12.so
34c2390000-34c2394000 rw-p 00000000 00:00 0
34c2400000-34c2483000 r-xp 00000000 08:02 5243399                        /lib64/libm-2.12.so
... more lines followed ...

The original mapFields still works well in that test case.

I tried to get rid of this problem without success - getting a little bit frustrated since I did not even change anything inside the code.

Could you please help me? I would be very grateful if anyone could give me a hint how to solve the problem.

hk318i June 29, 2016 08:13

Your Make deep revision!
Here are few general points,
  • You don't have to copy the complete source of OpenFOAM.
  • Copy what you need to modify only and rename the classes.
  • Link back to original OpenFOAM source and libraries.
The problem is simple you compiled the same classes twice with the same names and when you link the new ones to any case the solver cannot decide which one to use.

saimat June 29, 2016 08:27

Thank you very much for this answer.

Please don't blame me for my inexperience, but actually I'm still not sure what I did wrong. Which classes did I compile twice? Do I have to rename everything in the sampling-directory?

hk318i June 29, 2016 08:56

No worries, we all are on OpenFOAM learning curve.
The classes of sampling library are recompiled without renaming. You don't need them all, you only need meshToMesh class. Before you processed further in this issue, it is better to test the new versions of OpenFOAM because this class had major updates since OF2.2. Even in OF2.2, you will notice that there are new meshToMesh class.

The easiest and most straight forward way could be copy and rename meshtoMesh and included directly in your application.


All times are GMT -4. The time now is 06:25.