CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Including a new utility in OF 13 (http://www.cfd-online.com/Forums/openfoam-solving/58966-including-new-utility-13-a.html)

alondono May 15, 2007 09:40

Hi everyone, I am trying to
 
Hi everyone,

I am trying to include a new postprocessing utility named GradU, what I need is to write all the tensor values for every simulation time, it should be easy, because there is in OF 1.3 an utility magGradU, so I took this code and changed
just minor things. The problem is that when I try to compile this utility, a compilation problem appers. The main code is this one (GradU.C):

-------------------------------

#include "fvCFD.H"


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:

int main(int argc, char *argv[])
{

# include "addTimeOptions.H"
# include "setRootCase.H"
# include "createTime.H"

// Get times list
instantList Times = runTime.times();

// set startTime and endTime depending on -time and -latestTime options
# include "checkTimeOptions.H"

runTime.setTime(Times[startTime], startTime);

# include "createMesh.H"

for (label i=startTime; i<endTime; i++)
{
runTime.setTime(Times[i], i);

Info<< "Time = " << runTime.timeName() << endl;

IOobject Uheader
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ
);

// Check U exists
if (Uheader.headerOk())
{
mesh.readUpdate();

Info<< " Reading U" << endl;
volVectorField U(Uheader, mesh);

Info<< " Calculating GradU" << endl;
volScalarField GradU
(
IOobject
(
"GradU",
runTime.timeName(),
mesh,
IOobject::NO_READ
),
mag(fvc::grad(U))
);
GradU.write();
}
else
{
Info<< " No U" << endl;
}
}

return(0);
}


// ************************************************** *********************** //


But when I type wmake I obtain:

-------------------------------------------------------------------------------- --

SOURCE_DIR=.
SOURCE=GradU.C ; g++ -m32 -Dlinux -DDP -Wall -W -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-30 -I/home/alondono/OpenFOAM/OpenFOAM-1.3/src/finiteVolume/lnInclude -I/home/alondono/OpenFOAM/OpenFOAM-1.3/src/OpenFOAM/lnInclude -IlnInclude -I. -fPIC -pthread -c $SOURCE -o Make/linuxGcc4DPOpt/GradU.o
/home/alondono/OpenFOAM/OpenFOAM-1.3/wmake/bashScripts/mkObjectDir /home/alondono/OpenFOAM/OpenFOAM-1.3/applications/bin/linuxGcc4DPOpt/GradU
g++ -m32 -Dlinux -DDP -Wall -W -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-30 -I/home/alondono/OpenFOAM/OpenFOAM-1.3/src/finiteVolume/lnInclude -I/home/alondono/OpenFOAM/OpenFOAM-1.3/src/OpenFOAM/lnInclude -IlnInclude -I. -fPIC -pthread Make/linuxGcc4DPOpt/GradU.o -L/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt \
-lfiniteVolume -lfoamUtil -lOpenFOAM -liberty -o /home/alondono/OpenFOAM/OpenFOAM-1.3/applications/bin/linuxGcc4DPOpt/GradU
/usr/bin/ld: warning: libtriSurface.so, needed by /home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libmeshTools.so, needed by /home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libPstream.so, needed by /home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libOpenFOAM.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libfoamUser.so, needed by /home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libOpenFOAM.so, not found (try using -rpath or -rpath-link)
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::polyMeshAdder::addWithoutPatches(Foam::poly Mesh&, Foam::polyMesh const&, Foam::faceCoupleInfo const&)' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::IPstream::IPstream(int, int, Foam::IOstream::streamFormat, Foam::IOstream::versionNumber)' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::operator>>(Foam::Istream&, Foam::wallPoint&)' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `typeinfo for Foam::triSurface' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::wallPoint::greatPoint' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libOpenFOAM.so: referencia a `vtable for Foam:http://www.cfd-online.com/OpenFOAM_D...part/proud.gifPstream' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::triSurface::~triSurface()' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::IPstream::read(int, char*, int)' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::cellDistFuncs::correctBoundaryFaceCells(Foa m::HashSet<int,> > const&, Foam::Field<double>&, Foam::Map<int>&) const' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::operator<<(Foam:http://www.cfd-online.com/OpenFOAM_D...part/proud.gifstream&, Foam::wallPoint const&)' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libOpenFOAM.so: referencia a `Foam::Pstream::exit(int)' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::polyMeshAdder::polyMeshAdder()' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::triSurface::operator=(Foam::triSurface const&)' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::cellDistFuncs::cellDistFuncs(Foam::polyMesh const&)' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::cellDistFuncs::correctBoundaryPointCells(Fo am::HashSet<int,> > const&, Foam::Field<double>&, Foam::Map<int>&) const' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::orientedSurface::orientedSurface(Foam::triS urface const&, Foam::Vector<double> const&, bool)' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::cellDistFuncs::getPatchIDs(Foam::word const&) const' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::cellDistFuncs::smallestDist(Foam::Vector<do uble> const&, Foam::polyPatch const&, int, Foam::List<int> const&, int&) const' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::triSurface::triSurface(Foam::List<foam::lab elledtri> const&, Foam::Field<foam::vector<double> > const&)' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::patchWave::~patchWave()' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::mapAddedPolyMesh::oldCellMap() const' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::cellDistFuncs::cellDistFuncs(Foam::polyMesh const&)' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::cellDistFuncs::getPointNeighbours(Foam::Pri mitivePatch<foam::face,> > const&> const&, int, Foam::List<int>&) const' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::triSurface::triSurface()' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::triSurface::movePoints(Foam::Field<foam::ve ctor<double> > const&)' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::cellDistFuncs::sumPatchSize(Foam::HashSet<i nt,> > const&) const' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::triSurface::~triSurface()' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::mapAddedPolyMesh::addedFaceMap() const' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libOpenFOAM.so: referencia a `Foam::Pstream::addValidParOptions(Foam::HashTable <foam::string,>&)' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::mapAddedPolyMesh::oldFaceMap() const' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::cellDistFuncs::maxPatchSize(Foam::HashSet<i nt,> > const&) const' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::patchWave::patchWave(Foam::polyMesh const&, Foam::HashSet<int,> > const&, bool)' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::reduce(double&, Foam::sumOp<double> const&)' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libOpenFOAM.so: referencia a `Foam::Pstream::init(int&, char**&)' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libOpenFOAM.so: referencia a `Foam::Pstream::abort()' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::mapAddedPolyMesh::addedCellMap() const' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam::triSurface::subsetMesh(Foam::List<bool> const&, Foam::List<int>&, Foam::List<int>&) const' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam:http://www.cfd-online.com/OpenFOAM_D...part/proud.gifPstream::write(int, char const*, int, bool)' sin definir
/home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libfiniteVolume.so: referencia a `Foam:http://www.cfd-online.com/OpenFOAM_D...part/proud.gifPstream::~OPstream()' sin definir
collect2: ld returned 1 exit status
make: *** [/home/alondono/OpenFOAM/OpenFOAM-1.3/applications/bin/linuxGcc4DPOpt/GradU] Error 1

-------------------------------------------------------------------------------- -------------------

So in conclusion Error 1 and it can not create the executable file.

I also changed the Make and FoamX files and I executed as root but this problem still exist.

What should I do, it's necessary to modify another file for compiling a new utility??

Thanks in advance,

Alex L.

alondono May 15, 2007 09:42

Sorry, The main code is thi
 
Sorry,

The main code is this one:

\*---------------------------------------------------------------------------*/

#include "fvCFD.H"


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:

int main(int argc, char *argv[])
{

# include "addTimeOptions.H"
# include "setRootCase.H"
# include "createTime.H"

// Get times list
instantList Times = runTime.times();

// set startTime and endTime depending on -time and -latestTime options
# include "checkTimeOptions.H"

runTime.setTime(Times[startTime], startTime);

# include "createMesh.H"

for (label i=startTime; i<endTime; i++)
{
runTime.setTime(Times[i], i);

Info<< "Time = " << runTime.timeName() << endl;

IOobject Uheader
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ
);

// Check U exists
if (Uheader.headerOk())
{
mesh.readUpdate();

Info<< " Reading U" << endl;
volVectorField U(Uheader, mesh);

Info<< " Calculating GradU" << endl;
volTensorField GradU
(
IOobject
(
"GradU",
runTime.timeName(),
mesh,
IOobject::NO_READ
),
mag(fvc::grad(U))
);
GradU.write();
}
else
{
Info<< " No U" << endl;
}
}

return(0);
}


// ************************************************** *********************** //

gschaider May 16, 2007 18:02

Hi Alex! The good news: the
 
Hi Alex!

The good news: the error messages say that the .C file was compiled to a .o file (so there is no problem with your program), but (the bad news) it was not possible to link it (and I have no idea why). Could you post the Make/options, Make/files-files?

alondono May 17, 2007 22:29

Hi Bernhard, These are the
 
Hi Bernhard,

These are the files,

Make/Options

EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude

EXE_LIBS = \
-lfiniteVolume \
-lfoamUtil


Make/files

GradU.C

EXE = $(FOAM_APPBIN)/GradU


And if it's useful, this is the FoamX/GradU.cfg file

// GradU tool definition

description "grad(U) calculation";

GradUDict
{
type dictionary;
description "GradU control dictionary";
dictionaryPath "system";

entries
{
arguments
{
type rootCaseTimeArguments;
}
}
}

// ************************************************** *********************** //

Thanks for your help.

Regards,

Alex L.

gschaider May 21, 2007 08:52

Hi Alex! Either I'm missing
 
Hi Alex!

Either I'm missing something very obious about your case or something is very strange on your machine.

BTW: What kind of Linux are you using (version)?

Are the libraries that are "missing" (your intial posting) during linking, actually there? For instance /home/alondono/OpenFOAM/OpenFOAM-1.3/lib/linuxGcc4DPOpt/libtriSurface.so

Are they readable for you? What does the file-command think of them?

Bernhard

alondono May 21, 2007 20:43

Hi Bernhard, I think I have
 
Hi Bernhard,

I think I have found the problem, and it appears to be what you asked me about: the linux version.

Using Ubuntu this utility does not compile and the problem seems to be that a library (.so file) is missing.

Using OpenSUSE 10.1 this utility works properly and creates the EXE file, and besides it prints the GradU tensor as I expected.

Thanks for your help.

With kind regards,

lakeat April 11, 2008 09:09

onyx-bridge 313% gdb ../../../
 
onyx-bridge 313% gdb ../../../wmake/rules/sgi*/wmkdep
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "mips-sgi-irix6.5"...
(gdb) r dynamicFvMesh.C
Starting program: /disk4/usr/people/student3/OpenFOAM/OpenFOAM-1.4.1/wmake/rules/sgiN32Gcc/wmkdep dynamicFvMesh.C
Making dependency list for source file dynamicFvMesh.C
$(OBJECTS_DIR)/dynamicFvMesh.o: dynamicFvMesh.dep
1111dynamicFvMesh.dep: dynamicFvMesh.C
1111dynamicFvMesh.dep: dynamicFvMesh.H
could not open file fvMesh.H for source file dynamicFvMesh.C
could not open file autoPtr.H for source file dynamicFvMesh.C
could not open file runTimeSelectionTables.H for source file dynamicFvMesh.C

Program received signal SIGSEGV, Segmentation fault.
fread () at /xlv42/6.5.23m/work/irix/lib/libc/libc_n32_M4/stdio/fread.c:37
37 /xlv42/6.5.23m/work/irix/lib/libc/libc_n32_M4/stdio/fread.c: No such file or directory.
in /xlv42/6.5.23m/work/irix/lib/libc/libc_n32_M4/stdio/fread.c
(gdb) bt
#0 fread () at /xlv42/6.5.23m/work/irix/lib/libc/libc_n32_M4/stdio/fread.c:37
#1 0x10002b74 in yylex ()
#2 0x10003250 in main ()
(gdb) q
The program is running. Exit anyway? (y or n) y
onyx-bridge 314% uname -a
IRIX64 onyx-bridge 6.5 01080747 IP35
onyx-bridge 315% ulimit -a
time(seconds) unlimited
file(blocks) unlimited
data(kbytes) unlimited
stack(kbytes) 65536
memory(kbytes) 29096416
coredump(blocks) unlimited
nofiles(descriptors) 200
vmemory(kbytes) unlimited
concurrency(threads) 1024
onyx-bridge 316%



































Hi Bernhard,

Concerning the beginning of this thread, I have a question.

I try to compile OpenFOAM on Irix6.5, yet I met core dump everytime when wmkdep is called. So, it is quite fatal

that after compilation icoFoam failed with SegV.

For instance, when I wmake libso dynamicFVMesh, after it is finished, I get a bad dynamicFVMesh.so and with a core

file under src/dynamicFVMesh directory.
Here is the information when I try to debug it.

-----------------------------
onyx-bridge 313% gdb ../../../wmake/rules/sgi*/wmkdep
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "mips-sgi-irix6.5"...
(gdb) r dynamicFvMesh.C
Starting program: /disk4/usr/people/student3/OpenFOAM/OpenFOAM-1.4.1/wmake/rules/sgiN32Gcc/wmkdep dynamicFvMesh.C
Making dependency list for source file dynamicFvMesh.C
$(OBJECTS_DIR)/dynamicFvMesh.o: dynamicFvMesh.dep
1111dynamicFvMesh.dep: dynamicFvMesh.C
1111dynamicFvMesh.dep: dynamicFvMesh.H
could not open file fvMesh.H for source file dynamicFvMesh.C
could not open file autoPtr.H for source file dynamicFvMesh.C
could not open file runTimeSelectionTables.H for source file dynamicFvMesh.C

Program received signal SIGSEGV, Segmentation fault.
fread () at /xlv42/6.5.23m/work/irix/lib/libc/libc_n32_M4/stdio/fread.c:37
37 /xlv42/6.5.23m/work/irix/lib/libc/libc_n32_M4/stdio/fread.c: No such file or directory.
in /xlv42/6.5.23m/work/irix/lib/libc/libc_n32_M4/stdio/fread.c
(gdb) bt
#0 fread () at /xlv42/6.5.23m/work/irix/lib/libc/libc_n32_M4/stdio/fread.c:37
#1 0x10002b74 in yylex ()
#2 0x10003250 in main ()
(gdb) q
The program is running. Exit anyway? (y or n) y
onyx-bridge 314% uname -a
IRIX64 onyx-bridge 6.5 01080747 IP35
onyx-bridge 315% ulimit -a
time(seconds) unlimited
file(blocks) unlimited
data(kbytes) unlimited
stack(kbytes) 65536
memory(kbytes) 29096416
coredump(blocks) unlimited
nofiles(descriptors) 200
vmemory(kbytes) unlimited
concurrency(threads) 1024
onyx-bridge 316%


So, what does this line mean?
#0 fread () at /xlv42/6.5.23m/work/irix/lib/libc/libc_n32_M4/stdio/fread.c:37


Please help, thanks!

Daniel

lakeat April 11, 2008 09:17

I am very sorry for the wrong
 
I am very sorry for the wrong post!

What I want to say is the error message:
-------------------------------------------
....not found (try using -rpath or -rpath-link)
-------------------------------------------
is most likely because gnu-ld is not successfully installed. For I am working on porting OpenFOAM to IRIX but no avail now, and I met the same problem as you were, Alex.

I am trying to figure it out.


All times are GMT -4. The time now is 22:52.