CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Post-Processing

Reading faceSet

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By henrik

Reply
 
LinkBack Thread Tools Display Modes
Old   July 18, 2009, 08:46
Default Reading faceSet
  #1
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 10
sega is on a distinguished road
Hallo again.

I'm currently playing with faceSets and how to access its information.
I stole some code from splitMesh, which is reading a faceSet to split a mesh at these faces.

For a very very basic understanding I tried to read an existing faceSet (named f0) and output its size.

Here is the code

Code:
#include "faceSet.H"
#include "polyMesh.H"
#include "argList.H"

using namespace Foam;

int main(int argc, char *argv[])
{
    word setName = argv[1];

    Info<< "Reading faceSet from " << setName << endl;

    #   include "setRootCase.H"
    #   include "createMesh.H"
    #   include "createTime.H"
    #   include "createPolyMesh.H"

    faceSet facesSet(mesh, setName);

    Info<< "faceSet size: " << facesSet.size() << endl;
}
Unsurprisingly to me this code does not work.
Here is the output from wmake:

Code:
sega@deepblue:~/OpenFOAM/sega-1.5/applications/listFaceSet$ wmake
SOURCE=listFaceSet.C ;  g++ -m64 -Dlinux64 -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -march=opteron -O3  -DNoRepository -ftemplate-depth-40 -I/home/sega/OpenFOAM/OpenFOAM-1.5/src/dynamicMesh/lnInclude -I/home/sega/OpenFOAM/OpenFOAM-1.5/src/meshTools/lnInclude -IlnInclude -I. -I/home/sega/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude -I/home/sega/OpenFOAM/OpenFOAM-1.5/src/OSspecific/Unix/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/listFaceSet.o
In file included from listFaceSet.C:74:
/home/sega/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/createMesh.H: In function ‘int main(int, char**)’:
/home/sega/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/createMesh.H:2: error: ‘runTime’ was not declared in this scope
/home/sega/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/createMesh.H:4: error: ‘fvMesh’ is not a member of ‘Foam’
/home/sega/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/createMesh.H:4: error: expected `;' before ‘mesh’
In file included from listFaceSet.C:75:
/home/sega/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/createTime.H:5: error: incomplete type ‘Foam::Time’ used in nested name specifier
make: *** [Make/linux64GccDPOpt/listFaceSet.o] Fehler 1
Just for completeness: I intended to get the faceSets name and its size as output with the command:
Code:
listFaceSet f0
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   July 18, 2009, 10:55
Default
  #2
Senior Member
 
Henrik Rusche
Join Date: Mar 2009
Location: Braunschweig, Niedersachsen, Germany
Posts: 274
Rep Power: 8
henrik is on a distinguished road
Dear Sebastian,

Read the error message carfully! The compiler complains that it does not understand a few things in your createMesh.H.

Without knowing the contents of this file, I would guess that a lot of those errors will go away if you add

#include "fvCFD.H"

to your code. But the ";"-problem will not.

Henrik
henrik is offline   Reply With Quote

Old   July 18, 2009, 12:17
Default
  #3
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 10
sega is on a distinguished road
All of the problems were solved with including fvCFD.H and putting
Code:
-I$(LIB_SRC)/finiteVolume/lnInclude \
into the Make/options file!

But now there is a problem with the number of argument.
When runnning the file on a case for which a faceSet exists in constant/polyMesh/sets/f0 I'm getting this error:
Code:
Wrong number of arguments, expected 0 found 1
The code of my tool actually contains only these couple of lines:
Code:
#include "faceSet.H"
#include "polyMesh.H"
#include "argList.H"
#include "fvCFD.H"

using namespace Foam;

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

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

#   include "setRootCase.H"
#   include "createTime.H"
#   include "createPolyMesh.H"

    Foam::argList::validArgs.append("faceSet");
    word setName(args.additionalArgs()[0]);  

    Info<< "Reading faceSet set from " << setName << endl;

    faceSet facesSet(mesh, setName);

    Info<< "faceSet size: " << facesSet.size() << endl;

    Info<< nl << "end" << endl;
    return 0;
}
so maybe finding the error won't be too hard for one of you?
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   July 18, 2009, 12:32
Default
  #4
Senior Member
 
Henrik Rusche
Join Date: Mar 2009
Location: Braunschweig, Niedersachsen, Germany
Posts: 274
Rep Power: 8
henrik is on a distinguished road
Not sure, but try

Code:
 int main(int argc, char *argv[])
{
     Foam::argList::validArgs.append("faceSet");

#   include "setRootCase.H"
#   include "createTime.H"
#   include "createPolyMesh.H"

     word setName(args.additionalArgs()[0]);

    // more code
}
jiez likes this.
henrik is offline   Reply With Quote

Old   July 19, 2009, 07:13
Default
  #5
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 10
sega is on a distinguished road
Yes, its working! Thank you!
I didn't realize that this would made a difference.
Why is that so?
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   July 19, 2009, 07:35
Default
  #6
Senior Member
 
Henrik Rusche
Join Date: Mar 2009
Location: Braunschweig, Niedersachsen, Germany
Posts: 274
Rep Power: 8
henrik is on a distinguished road
Dear Sebastian,

the argument parser needs to know the full syntax to its job properly which includes flagging errors. Some of the arguments are used in setRootCase.H so valid option have to be defined before ...

If you want to learn more - dig through

$FOAM_SRC/OpenFOAM/lnInclude/argList.C
$FOAM_SRC/OpenFOAM/lnInclude/setRootCase.H

Henrik
henrik is offline   Reply With Quote

Reply

Tags
faceset

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
StitchMesh on two patches anita OpenFOAM Native Meshers: blockMesh 31 April 4, 2013 11:51
Problem converting fluent mesh vinz OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 20 November 17, 2012 10:54
Converting a mesh with splitted cells using fluentMeshToFoam jlpelerin OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 4 April 25, 2011 16:56
TGridFluent mesh with internal by prism layer and internal face for diagnostic sponiar OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 2 March 30, 2009 15:02
FluentMesh conversion problemwaiting for help waynezw0618 OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 12 November 30, 2006 23:12


All times are GMT -4. The time now is 10:13.