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

Collection of simple functionObjects

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 2, 2009, 10:54
Default
  #21
Senior Member
 
Martin Beaudoin
Join Date: Mar 2009
Posts: 332
Rep Power: 22
mbeaudoin will become famous soon enough
The problem is fixed.

Just update your svn working copy for Breeder_1.5, and recompile the library.

Also make sure the environment variable FOAM_DEV is not defined when compiling the library for the OpenCFD version.

Martin

Quote:
Originally Posted by mbeaudoin View Post
My mistake,

I published a new functionObject this week on openfoam-extend, and this code was developed for 1.5-dev.

The "tolerances" switches are available only under the dev version of OpenFOAM.

I will fix this shortly.

Martin
mbeaudoin is offline   Reply With Quote

Old   April 27, 2010, 01:07
Default
  #22
Senior Member
 
Jiang
Join Date: Oct 2009
Location: Japan
Posts: 186
Rep Power: 17
panda60 is on a distinguished road
Dear all,
How can I create my own functionObject ?
my purpose is to extract a plane data of internal domain in every time step, and save to disk.
I noticed "surfaces functionObject" can do the similar thing, so 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   October 4, 2010, 20:31
Default
  #23
Member
 
Join Date: Mar 2009
Location: Sydney, New South Wales, Australia
Posts: 42
Rep Power: 17
rassilon is on a distinguished road
Quote:
Originally Posted by gschaider View Post
Bernhard

PS: the real reason why I'm writing here is that I added a new functionObject (panicDump) to the library and wanted to advertise it. It checks whether the values in a field are inside certain bounds and if they are outside writes all fields to disk and exits. The purpose of this FO is to gracefully stop simulations that are obviously going to explode while the fields still might be useful for post-mortem analysis (not full of NaNs or 1e43)

Hi Bernhard,

Is it possible to use panicDump to monitor and act on the mass flow through a patch?

I would like my simulation to finish and end reasonably gracefully when the mass flow on a particular patch reaches a specified value. I am using the patchMassFlow function object to monitor the mass flow, which is great, but a mechanism for automatically stopping the run when the specified patchMassFlow value is reached would be even better.

If this is possible, how do I go about setting it up? The code for panicDump is looking for a fieldName_ - Can I just insert the massFlow identifier here, or do I need to make some deeper modifications to the code?

Also, what is the syntax fro the panicDump function? I have tried this:

Code:
...
(
exitStrategy
{
type    panicDump;
functionObjectLibs
(
    "libSimpleFunctionObjects.so"
);

fieldName  targetMassFlow;
maximum 1.05;
minimum 0;
}
But it didn't seem to work.

Any assistance would be gratefully received...


R
rassilon is offline   Reply With Quote

Old   October 5, 2010, 13:54
Default
  #24
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by rassilon View Post
Hi Bernhard,

Is it possible to use panicDump to monitor and act on the mass flow through a patch?

Any assistance would be gratefully received...


R
Sorry. This isn't currently possible with the functionObjects that are in that libary. You'd have to write a new one that is a hybrid between panicDump and patchMassFlow

Bernhard
gschaider is offline   Reply With Quote

Old   October 6, 2010, 00:56
Default
  #25
Member
 
Join Date: Mar 2009
Location: Sydney, New South Wales, Australia
Posts: 42
Rep Power: 17
rassilon is on a distinguished road
Quote:
Originally Posted by gschaider View Post
Sorry. This isn't currently possible with the functionObjects that are in that libary. You'd have to write a new one that is a hybrid between panicDump and patchMassFlow

Bernhard
Thanks Bernhard,

I think that is probably beyond my level of programming, so i will look at another way of doing this.

Cheers,


R
rassilon is offline   Reply With Quote

Old   January 3, 2012, 12:08
Default
  #26
Member
 
Tibor Nyers
Join Date: Jul 2010
Location: Hungary
Posts: 91
Rep Power: 17
Toorop is on a distinguished road
Hi,

I actually managed to solve my problem just before posting a question. Someone may have a hard time on this one in the future so I post it anyway. It took me a while to guess the correct syntax to specify a region for simpleFunctionObjects.

My solver was chtMultiRegionSimpleFoam with correct region naming (fluid and solid) and I needed the average temperature of the solid. The correct region specification can be found below.

Code:
T_average
{
    type volumeAverage;
    functionObjectLibs ( "libsimpleFunctionObjects.so" );
    region "solid";
    fields ( T );
    factor 1.0;
    verbose true;
}
My suggestion is to conform the syntax with the likes of fields and patches. A nice addition would be to specify the region in the output log file as well (like with patches).

@controlDict: regions ( solid01 solid02 );
@logfile: Average of T : solid01 = 300 solid02 = 273
Toorop is offline   Reply With Quote

Old   January 3, 2012, 13:04
Default
  #27
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Toorop View Post
Hi,

I actually managed to solve my problem just before posting a question. Someone may have a hard time on this one in the future so I post it anyway. It took me a while to guess the correct syntax to specify a region for simpleFunctionObjects.

My solver was chtMultiRegionSimpleFoam with correct region naming (fluid and solid) and I needed the average temperature of the solid. The correct region specification can be found below.

Code:
T_average
{
    type volumeAverage;
    functionObjectLibs ( "libsimpleFunctionObjects.so" );
    region "solid";
    fields ( T );
    factor 1.0;
    verbose true;
}
A very good place to share such information that is obviously missing from the Wiki-page is .... the Wiki-page itself. Thanks

Quote:
Originally Posted by Toorop View Post
My suggestion is to conform the syntax with the likes of fields and patches. A nice addition would be to specify the region in the output log file as well (like with patches).

@controlDict: regions ( solid01 solid02 );
@logfile: Average of T : solid01 = 300 solid02 = 273
That is a bit complicated: the handling of the region is part of a superclass (that also handles regions for patches for instance). Changing that superclass would mean that almost every functionObject in SFO (and some in swak) would have to be changed.

One workaround would be to use the variable replacement of OF to safe typing (this only works if functions is a dictionary, not a list):
Code:
T_average1
{
    type volumeAverage;
    functionObjectLibs ( "libsimpleFunctionObjects.so" );
    region "solid01";
    fields ( T );
    factor 1.0;
    verbose true;
}
T_average2
{
  $T_average1;
  region "solid02";
}
The only "problem" with that approach is that currently the name of the region (or the functionObject) is not printed making both output-lines look the same (except for the value). THIS is something that is easily fixed (if I find a feature request in the SFO-Mantis)

You can write a feature request about the region-list too, but I don't think it is very likely that I'll do it as a) it is quite time consuming b) has the possibility to introduce a number of weird bugs

Bernhard
gschaider is offline   Reply With Quote

Old   January 4, 2012, 05:16
Default
  #28
Member
 
Tibor Nyers
Join Date: Jul 2010
Location: Hungary
Posts: 91
Rep Power: 17
Toorop is on a distinguished road
Hi Bernhard,

thank you for the detailed explanation. I have registered at sourceforge but somehow when I click the submit error button the page goes to a blank one and I get no confirmation about the successful report, and my report won't show up on the report page.

It's maybe related to the fact that I cannot choose from a category under the Enter Report Details. It's required but no options show up, just the default (select).

Maybe I have to make a bug report about the bug trucker as well?!
Toorop is offline   Reply With Quote

Old   January 4, 2012, 10:04
Default
  #29
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Toorop View Post
Hi Bernhard,

thank you for the detailed explanation. I have registered at sourceforge but somehow when I click the submit error button the page goes to a blank one and I get no confirmation about the successful report, and my report won't show up on the report page.

It's maybe related to the fact that I cannot choose from a category under the Enter Report Details. It's required but no options show up, just the default (select).

Maybe I have to make a bug report about the bug trucker as well?!
Yeah. Don't know why we didn't have a category for this on the BugTracker yet

Seriously. I'm afraid there is not much I can do about this problem. The missing Category isn't the problem. Sounds more like a "didn't redirect the https to the right server in the server-farm"-problem at Sourceforge (possibly combined with a restrictive company firewall at your place)

Could you try it again and see if it is reproducible? I know this is frustrating if you lost a quarter of an hour of work because you wrote a detailed bug-report. So just fill out the basics: Title and in the description a link to this conversation. You can always add a note later on if the server accepts the bug report

If it doesn't work for you reproducible then I'll open the report and will add you (so that you get updates)
gschaider is offline   Reply With Quote

Old   January 5, 2012, 04:54
Default
  #30
Member
 
Tibor Nyers
Join Date: Jul 2010
Location: Hungary
Posts: 91
Rep Power: 17
Toorop is on a distinguished road
Hi,

really appreciate your efforts!
My issue won't go away, really strange, indeed.

Code:
report the region on which the actual calculation is evaluated

In a multi region setting the log file doesn't contain the region name on which the calculation is evaluated. If multiple simpleFunctionObjects report the same sort of data it would be more convenient for pyFoamPlotWatcher with customRegexp to have the region name on the different lines.

@controldict
T_average
{
    type volumeAverage;
    functionObjectLibs ( "libsimpleFunctionObjects.so" );
    region "solid01";
    fields ( T );
    factor 1.0;
    verbose true;
}

@logfile the "desired" output
Average of T : solid01 = 300
I add the bug report picture as an attachment, maybe you can point out whats wrong.

Thanks!
Attached Images
File Type: jpg bug_report.jpg (32.1 KB, 21 views)
Toorop is offline   Reply With Quote

Old   January 5, 2012, 06:54
Default
  #31
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Toorop View Post
Hi,

really appreciate your efforts!
My issue won't go away, really strange, indeed.

Code:
report the region on which the actual calculation is evaluated

In a multi region setting the log file doesn't contain the region name on which the calculation is evaluated. If multiple simpleFunctionObjects report the same sort of data it would be more convenient for pyFoamPlotWatcher with customRegexp to have the region name on the different lines.

@controldict
T_average
{
    type volumeAverage;
    functionObjectLibs ( "libsimpleFunctionObjects.so" );
    region "solid01";
    fields ( T );
    factor 1.0;
    verbose true;
}

@logfile the "desired" output
Average of T : solid01 = 300
I add the bug report picture as an attachment, maybe you can point out whats wrong.

Thanks!
I'll have a look. Currently the Sourceforge-Mantis is not responding. Maybe they have bigger problems there.

Will add the feature request to the local bug-database and get to it (probably the output will only occur for non-default regions. That way it won't break old customRegexp that I (and possibly other people) rely on)

Last edited by gschaider; January 5, 2012 at 07:14.
gschaider is offline   Reply With Quote

Old   January 5, 2012, 19:00
Default
  #32
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Toorop View Post
Hi,

really appreciate your efforts!
My issue won't go away, really strange, indeed.
OK. I created a report (Nr 117). Add yourself to the issue (I think the button is named "Monitor" or so) to get updates.

I copy/pasted your information into the form and saw the behaviour you described (plain white window). Then I removed the additional information (desired input/output) from the form and it worked. Adding the information afterwards was not a problem. My guess is that some of the "weird" characters threw the application into an undefined state

Bernhard
gschaider is offline   Reply With Quote

Old   January 6, 2012, 03:19
Default
  #33
Member
 
Tibor Nyers
Join Date: Jul 2010
Location: Hungary
Posts: 91
Rep Power: 17
Toorop is on a distinguished road
Thank you, have added myself to the issue!
Toorop is offline   Reply With Quote

Old   January 9, 2012, 10:28
Default
  #34
Member
 
Tibor Nyers
Join Date: Jul 2010
Location: Hungary
Posts: 91
Rep Power: 17
Toorop is on a distinguished road
Bernhard,
thank you for your time and patience, I have updated swak and everything works.
Toorop is offline   Reply With Quote

Old   March 10, 2014, 06:53
Default
  #35
Senior Member
 
Sita Drost
Join Date: Mar 2009
Location: Arnhem, The Netherlands
Posts: 227
Rep Power: 18
sita is on a distinguished road
Dear Bernhard,

Thanks, it looks like your simpleFunctionObjects are exactly what I need. However, when I follow the instructions for compilation (wmake libso), I get an error similar to the one Juho mentioned (May 27, 2008):

make: *** No rule to make target `/home/ahm_ubuntu/OpenFOAM/OpenFOAM-1.6-ext/src/OpenFOAM/lnInclude/UPstream.H', needed by `trackDictionary/trackDictionaryFunctionObject.dep'. Stop.

As you can see in the error message, I use OpenFOAM-1.6-ext. The simpleFunctionObjects I'm trying to compile are those intended for OpenFOAM-1.6. Does anyone know what I should do to fix this error?

Thanks in advance!
Sita
sita is offline   Reply With Quote

Old   March 10, 2014, 15:32
Default
  #36
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by sita View Post
Dear Bernhard,

Thanks, it looks like your simpleFunctionObjects are exactly what I need. However, when I follow the instructions for compilation (wmake libso), I get an error similar to the one Juho mentioned (May 27, 2008):

make: *** No rule to make target `/home/ahm_ubuntu/OpenFOAM/OpenFOAM-1.6-ext/src/OpenFOAM/lnInclude/UPstream.H', needed by `trackDictionary/trackDictionaryFunctionObject.dep'. Stop.

As you can see in the error message, I use OpenFOAM-1.6-ext. The simpleFunctionObjects I'm trying to compile are those intended for OpenFOAM-1.6. Does anyone know what I should do to fix this error?

Thanks in advance!
Sita
Do a Allwclean and rmdepall in the directory of the SFO-sources. My suspicion is that you compiled it with an old version of 1.6-ext then updated that and then tried to recompile the SFO. Because I don't see no UPstream.H in my 1.6-ext-installation.
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   March 11, 2014, 04:18
Default
  #37
Senior Member
 
Sita Drost
Join Date: Mar 2009
Location: Arnhem, The Netherlands
Posts: 227
Rep Power: 18
sita is on a distinguished road
Thanks, that seems to help, but now I get new errors... Allwclean doesn't work (Allwclean: command not found), but wclean simpleFunctionObjects does. Also rmdepall worked.
The errors I get now are:

/home/ahm_ubuntu/OpenFOAM/OpenFOAM-1.6-ext/ThirdParty/packages/gcc-4.5.2/platforms/linux64GccDPOpt/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.5.2/include-fixed/features.h:338:25: fatal error: sys/cdefs.h: No such file or directory
compilation terminated.
compilation terminated.
make: *** [Make/linux64GccDPOpt/simpleFunctionObject.o] Error 1
make: *** [Make/linux64GccDPOpt/simpleDataFunctionObject.o] Error 1
make: *** [Make/linux64GccDPOpt/timelineFunctionObject.o] Error 1

Something wrong with my ThirdParty directory?

Last edited by sita; March 11, 2014 at 04:20. Reason: typo
sita is offline   Reply With Quote

Old   March 11, 2014, 16:28
Default
  #38
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by sita View Post
Thanks, that seems to help, but now I get new errors... Allwclean doesn't work (Allwclean: command not found), but wclean simpleFunctionObjects does. Also rmdepall worked.
The errors I get now are:

/home/ahm_ubuntu/OpenFOAM/OpenFOAM-1.6-ext/ThirdParty/packages/gcc-4.5.2/platforms/linux64GccDPOpt/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.5.2/include-fixed/features.h:338:25: fatal error: sys/cdefs.h: No such file or directory
compilation terminated.
compilation terminated.
make: *** [Make/linux64GccDPOpt/simpleFunctionObject.o] Error 1
make: *** [Make/linux64GccDPOpt/simpleDataFunctionObject.o] Error 1
make: *** [Make/linux64GccDPOpt/timelineFunctionObject.o] Error 1

Something wrong with my ThirdParty directory?
Allwmake/Allwclean: Sorry. I was in swak-mode (where such scripts exist). wclean and "wmake libso" would of course be the commands

sys/cdefs.h: that is a problem of your installation and in no way related to SFO
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   March 12, 2014, 07:00
Default
  #39
Senior Member
 
Sita Drost
Join Date: Mar 2009
Location: Arnhem, The Netherlands
Posts: 227
Rep Power: 18
sita is on a distinguished road
Hmm… I think I'll just upgrade to foam-extend-3.0 and try again. Thanks for your help!
sita is offline   Reply With Quote

Old   June 6, 2014, 13:26
Default Which variables?
  #40
New Member
 
Join Date: Feb 2013
Posts: 21
Rep Power: 13
Shahr is on a distinguished road
I find this thread the best place to ask this question:

I am looking for a list of variables I can do field operations on, e. g. fieldAverage, fieldMinMax, etc.

I found some information about the new features added for version 2.2,
but I have no idea what possibilities are available.
Shahr is offline   Reply With Quote

Reply


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
Variable deltaT and functionObjects henrik OpenFOAM Bugs 8 July 22, 2009 05:11
OF15 functionObjects do not read LESProperties for incompressible flows aunola OpenFOAM Bugs 1 September 28, 2008 18:18
Collection Codes OpenFoam larry OpenFOAM Running, Solving & CFD 0 July 3, 2006 18:11
Collection efficiency Jen FLUENT 0 November 16, 2005 11:16
Data output collection simon Main CFD Forum 0 September 29, 2003 10:03


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