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

How to create my own functionObject ?

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 23, 2010, 06:12
Default How to create my own functionObject ?
  #1
Senior Member
 
Jiang
Join Date: Oct 2009
Location: Japan
Posts: 186
Rep Power: 16
panda60 is on a distinguished road
Dear all,
I use functionObjedt like following:
functions
{
extraction
{
type surfaces;
functionObjectLibs ("libsampling.so");
enabled true;
outputControl timeStep;
outputInterval 5;
surfaceFormat foamFile;
interpolationScheme cellPointFace;
fields
(
U
T
);
surfaces
(
aplane
{
type plane;
basePoint (-0.4 0 0.5);
normalVector (1.0 0 0);
}
);
}
}

my purpose is to extract a plane data of internal domain in every time step. But the file directory is not what I want.
I copy src/sampling ,and modify a little ,create another called libmysampling.so.

but when using, it displays:

--> FOAM Warning :
From function dlLibraryTable:pen(const dictionary& dict, const word& libsEntry, const TablePtr tablePtr)
in file lnInclude/dlLibraryTableTemplates.C at line 68
library "libmysampling.so" did not introduce any new entries


It seems that my own libmysampling.so doesn't take effect.
Could any one tell me how to create functionObject type ?
Thanks.
panda60 is offline   Reply With Quote

Old   April 27, 2010, 00:59
Default
  #2
Senior Member
 
Jiang
Join Date: Oct 2009
Location: Japan
Posts: 186
Rep Power: 16
panda60 is on a distinguished road
I want to modify surfaces functionObject, I found it belongs to sampling,
So I copy src/sampling directory to another position.
I changed the name to LIB = $(FOAM_USER_LIBBIN)/libmysampling.

in sampling\sampledSurface\sampledSurfaces, I found 2 places had name "surfaces",

*.H file:
public:
//- Runtime type information
TypeName("surfaces");
*.C文file:
PtrList<sampledSurface> newList
(
dict.lookup("surfaces"),
sampledSurface::iNew(mesh_)
);

I changed these "surfaces" to "mysurfaces", and compiled, no problem.
but when I used, had the following mistake,

Starting time loop
--> FOAM Warning :
From function dlLibraryTable:pen(const dictionary& dict, const word& libsEntry, const TablePtr tablePtr)
in file lnInclude/dlLibraryTableTemplates.C at line 68
library "libmysampling.so" did not introduce any new entries

Unknown function type mysurfaces
Valid functions are :
5
(
surfaces
fieldAverage
fieldMinMax
sets
probes
)

From function functionObject::New(const word& name, const Time&, const dictionary&)
in file db/functionObjects/functionObject/functionObject.C at line 89.
FOAM exiting

It seems that my modified name haven't been registed in functionObject.
Could anyone can give me some help ?

Thanks.

I am using like this in my controlDict file:
extraction
{
type mysurfaces;
functionObjectLibs ("libmysampling.so");
enabled true;
outputControl timeStep;
outputInterval 1;
surfaceFormat foamFile;
interpolationScheme cellPointFace;
fields
(
U
T
);
mysurfaces
(
aplane
{
type plane;
basePoint (-0.4 0 0.5);
normalVector (1.0 0 0);
}
);
}
panda60 is offline   Reply With Quote

Old   May 20, 2010, 13:26
Default Not able to use newly created library
  #3
New Member
 
Subodh Kumar
Join Date: Apr 2009
Location: India
Posts: 9
Rep Power: 16
Subodh is on a distinguished road
Send a message via Yahoo to Subodh
I have created a library successfully, but I am not able to use it, It is giving error like below. Any help or input would be greatly appreciated..

Type of Error

--> FOAM Warning :
From function dlLibraryTable:pen(const dictionary& dict, const word& libsEntry, const TablePtr tablePtr)
in file lnInclude/dlLibraryTableTemplates.C at line 68
library "monitor.so" did not introduce any new entries



Unknown function type monitor

Table of functionObjects is empty

From function functionObject::New(const word& functionType, const Time&, const dictionary&)
in file db/functionObject/functionObject.C at line 75.

FOAM exiting

functionObject in ControlDict

functions
(
monitor
{
type monitor;
functionObjectLibs ("monitor.so");
inletPatches (VolImp);
outletPatches (Outflow);
rhoInf 998.0;
}
);

My Inputs/Findings/Observations

I searched over OpenFOAM forums, there were few discussion regarding this, which say if OpenFOAM-1.6 is being used then it might causing because some parameters in functionobject are missing in controlDict file. It also says error messages displayed for this problem in OpenFOAM-1.6 and OpenFOAM-1.5 are different, OpenFOAM-1.6 says as above but OpenFOAM-1.5 says "parameters are missing". Since I am using OpenFOAM-1.5 there must be another reason for this error..
Subodh is offline   Reply With Quote

Old   May 21, 2010, 03:35
Default
  #4
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,679
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by Subodh View Post
Unknown function type monitor

Table of functionObjects is empty

....

functionObject in ControlDict

functions
(
monitor
{
type monitor;
functionObjectLibs ("monitor.so");
inletPatches (VolImp);
outletPatches (Outflow);
rhoInf 998.0;
}
);

If you try with
Code:
functionObjectLibs ("libmonitor.so");
it might work for you.
Note the 'lib' prefix when specifying the library to load.

Actually, it could be a good RFE to automatically add the 'lib' prefix and the '.so' suffix.
I just don't know how this might look on other systems though.
olesen is offline   Reply With Quote

Old   May 21, 2010, 07:55
Default
  #5
New Member
 
Subodh Kumar
Join Date: Apr 2009
Location: India
Posts: 9
Rep Power: 16
Subodh is on a distinguished road
Send a message via Yahoo to Subodh
Thank you Olesen for suggestion..
According to your suggestion, I created a new library called libmonitor.so and loaded it in controlDict by using functionObjectLibs ("libmonitor.so"); but it is giving the same error with new library name. Below is error produced by simpleFoam. Please note when I changed functionObjectLibs ("monitor.so"); to functionObjectLibs ("libmonitor.so"); in controlDict then OpenFOAM asked for missing library so I created by name of libmonitor.so instead of monitor.so

What would you suggest in this case, should I debug simpleFoam code ??? I do not know what help I could get by debuging but since I am a software engineer I know this way only.

Type of Error
Starting time loop

--> FOAM Warning :
From function dlLibraryTable:pen(const dictionary& dict, const word& libsEntry, const TablePtr tablePtr)
in file lnInclude/dlLibraryTableTemplates.C at line 68
library "libmonitor.so" did not introduce any new entries



Unknown function type monitor

Table of functionObjects is empty

From function functionObject::New(const word& functionType, const Time&, const dictionary&)
in file db/functionObject/functionObject.C at line 75.

FOAM exiting
Subodh is offline   Reply With Quote

Old   May 25, 2010, 10:39
Default
  #6
New Member
 
Subodh Kumar
Join Date: Apr 2009
Location: India
Posts: 9
Rep Power: 16
Subodh is on a distinguished road
Send a message via Yahoo to Subodh
I finally managed to create a library which works well.

Solution of the problem :

updateMesh(const mapPolyMesh&)

movePoints(const pointField&)

Above virtual functions have to be overridden and FuctionObjects header file and C files need to be included.
Subodh is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Meshing a Sphere Ajay FLUENT 10 September 3, 2016 15:18
Steps to create a quater O grid or Y grid brissyben ANSYS Meshing & Geometry 3 April 12, 2012 06:46
Actuator disk model audrich FLUENT 0 September 21, 2009 08:06
Where's the singularity/mesh flaw? audrich FLUENT 3 August 4, 2009 02:07
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 12:55


All times are GMT -4. The time now is 17:29.