|
[Sponsors] |
April 23, 2010, 06:12 |
How to create my own functionObject ?
|
#1 |
Senior Member
Jiang
Join Date: Oct 2009
Location: Japan
Posts: 186
Rep Power: 16 |
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. |
|
April 27, 2010, 00:59 |
|
#2 |
Senior Member
Jiang
Join Date: Oct 2009
Location: Japan
Posts: 186
Rep Power: 16 |
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); } ); } |
|
May 20, 2010, 13:26 |
Not able to use newly created library
|
#3 |
New Member
|
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.. |
|
May 21, 2010, 03:35 |
|
#4 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,679
Rep Power: 40 |
Quote:
If you try with Code:
functionObjectLibs ("libmonitor.so"); 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. |
||
May 21, 2010, 07:55 |
|
#5 |
New Member
|
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 |
|
May 25, 2010, 10:39 |
|
#6 |
New Member
|
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. |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
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 |