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

Collection of simple functionObjects

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

Like Tree3Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 21, 2008, 14:12
Default OpenFOAM has this cool feature
  #1
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
OpenFOAM has this cool feature named functionObjects of which the only incarnation I've seen so far is the probesFunctionObject. functionObject enables the user to "add" code to the solver at runtime (without recompiling it) that is executed at every time-step.

I have published a collection of such function objects on
http://openfoamwiki.net/index.php/Co...unctionObjects
that do simple evaluations that are sometimes useful like averages, integrals, forces, mass-flows on patches and/or volumes.

The actual library can be downloaded via subversion:
svn checkout https://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Breede r/libraries/simpleFunctionObjects/

If anyone has
* ideas for extensions (a liftDrag-FunctionObject comes to mind)
* bugfixes/stylistic suggestions (and there are bound to be some)
she/he is welcome to contribute these via the technical wonder that is called subversion (you'll just need write access to the svn)

Bernhard
__________________
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   April 22, 2008, 00:50
Default This looks interesting. Tha
  #2
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
This looks interesting.

Thanks!
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   April 22, 2008, 05:57
Default Hello, Maybe this is also o
  #3
Senior Member
 
Hannes Kröger
Join Date: Mar 2009
Location: Rostock, Germany
Posts: 123
Rep Power: 18
hannes is on a distinguished road
Hello,

Maybe this is also of interest for someone: I have wrapped the code of the sampleSurface tool into a function object.
Together with an additional writer for the PlotMTV-Format (PlotMTV is a very lightweight contour plot program), this makes it possible to get insight into the fields without always copying files and loading the whole case into Paraview. I find this especially useful for large, parallelized cases (no reconstruction is needed, this is done for the sample planes on the fly).

The code is in our SVN-repository: https://janus.fms.uni-rostock.de/svn/repository/OpenFOAM/trunk/LTTRostockExtensi ons

Username is "gast" with blank password.

Best regards, Hannes
__________________
silentdynamics GmbH - http://silentdynamics.de
open source CAE software solutions & support
hannes is offline   Reply With Quote

Old   April 22, 2008, 06:25
Default Hannes, Does plotmtv requir
  #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
Hannes,

Does plotmtv require regular distances between data points, or does it perform its own kriging?

/mark
olesen is offline   Reply With Quote

Old   April 22, 2008, 07:59
Default Hi Mark, PlotMTV can interp
  #5
Senior Member
 
Hannes Kröger
Join Date: Mar 2009
Location: Rostock, Germany
Posts: 123
Rep Power: 18
hannes is on a distinguished road
Hi Mark,

PlotMTV can interpolate in unstructured triangulated surfaces. The data is written out that way. But it is limited to planar surfaces and the writer currently only supports "interpolatedPlane"s

Hannes
__________________
silentdynamics GmbH - http://silentdynamics.de
open source CAE software solutions & support
hannes is offline   Reply With Quote

Old   April 22, 2008, 19:23
Default Hi Hannes! That is really a
  #6
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
Hi Hannes!

That is really a nice one. But is my impression correct that currently each time it writes out the sampled surfaces for one timestep all the previous outputs get erased? I had to comment out the lines in the sampleSurfaceProbesFunctionObject::execute()-method that erased sampleSurfaces-directory in order to get time-series

Bernhard
__________________
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   April 23, 2008, 07:43
Default Hi Bernhard, yes, you are r
  #7
Senior Member
 
Hannes Kröger
Join Date: Mar 2009
Location: Rostock, Germany
Posts: 123
Rep Power: 18
hannes is on a distinguished road
Hi Bernhard,

yes, you are right. Initially, I also used it without deleting the directories. But since I usually write out samples pretty often and do not want to end up with lots of data garbage, I put it in again.

I have inserted a switch for that right now ("deleteOutputDirectory") , which defaults to "yes"

Hannes
__________________
silentdynamics GmbH - http://silentdynamics.de
open source CAE software solutions & support
hannes is offline   Reply With Quote

Old   April 23, 2008, 08:29
Default Hi Hannes! Cool. I know thi
  #8
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
Hi Hannes!

Cool. I know this is becoming annoying BUT:

1. I think the setting outputInterval should be called outputInterleave because setting it to 1 outputs every second timeStep. Setting it to 0 switches the output of (this is obviously intended). So it is not possible to output every timestep. Initializing the timeSteps_ variable to 1 instead of 0 (I think in 3 places in the code) would give the behaviour I would expect
2. If deleteOutputDirectory==No removing the directory in the start-method would give a behaviour that is semantically similar to what the original probes does
3. I know this is asking much: would it be possible to factor this thing out into a separate library? Right now I've got to edit Make/options and Make/files to get it to compile (the chemistry-stuff). And while you're at it: would you consider putting it on openfoam-extend (just this sampleSurface-stuff)?

Bernhard
__________________
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   April 24, 2008, 04:08
Default Hi Bernhard, Please feel fr
  #9
Senior Member
 
Hannes Kröger
Join Date: Mar 2009
Location: Rostock, Germany
Posts: 123
Rep Power: 18
hannes is on a distinguished road
Hi Bernhard,

Please feel free to improve the code as you want.
I would add that stuff e.g. to the "simpleFunctionObjects" library and remove it from our lib. But I guess I need write access to the sourceforge repository to do so (my sourceforge username is "hanneskroeger").

Hannes
__________________
silentdynamics GmbH - http://silentdynamics.de
open source CAE software solutions & support
hannes is offline   Reply With Quote

Old   April 24, 2008, 05:36
Default Hi Hannes! Great. I added y
  #10
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
Hi Hannes!

Great. I added you to the users with svn write access and prepared a directory "sampling". Just put your stuff there (in such a way that if someone else feels like adding a sample-functionObject, it can live in parallel to your stuff) and add yourself as a contributor to the README-file.

Just one question? Did you have to do any changes to the original sampleSurface-stuff you're using? If not, it should be possible to modify the Make/files to

sampleSurface=$(FOAM_UTILITIES)/postProcessing/miscellaneous/sampleSurface
$(sampleSurface)/surfaces/surface/surface.C
.....

thus pulling in the original stuff (and not adding it to the repository) and only add the new stuff (the MTV-writer) from that hierarchy

Bernhard
__________________
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   April 24, 2008, 07:21
Default Hi Bernhard, I have done as
  #11
Senior Member
 
Hannes Kröger
Join Date: Mar 2009
Location: Rostock, Germany
Posts: 123
Rep Power: 18
hannes is on a distinguished road
Hi Bernhard,

I have done as you suggested and added all the sampleSurface-stuff to Make/files at their original location.

Unfortunately, there might be problems due to the *.dep files in $(FOAM_UTILITIES)/postProcessing/miscellaneous/sampleSurface. After compilation of the sampleSurface utility, they contain relative paths.

So you might consider doing a "wclean" in $(FOAM_UTILITIES)/postProcessing/miscellaneous/sampleSurface
to delete all *.dep files first, before building the library. After building the library, the *.dep files contain absolute paths.

Hannes
__________________
silentdynamics GmbH - http://silentdynamics.de
open source CAE software solutions & support
hannes is offline   Reply With Quote

Old   April 25, 2008, 11:01
Default Hi Hannes! I noticed so, to
  #12
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
Hi Hannes!

I noticed so, too. It's especially inconvenient for people who don't have write-rights on their OF-installation. I'll think of a fix

Bernhard
__________________
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   May 26, 2008, 17:43
Default Hi Hannes! I "fixed" the pr
  #13
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
Hi Hannes!

I "fixed" the problem with the external dependencies some time ago (maybe you noticed in the SVN), but forgot to mention it here: the fix consists of a script that copies the external dependencies to the compilation directory (it is described in the README)

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)
__________________
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   May 27, 2008, 03:54
Default When I try to compile the simp
  #14
Member
 
Juho Peltola
Join Date: Mar 2009
Location: Finland
Posts: 89
Rep Power: 17
juho is on a distinguished road
When I try to compile the simpleFunctionObjects at /utilities/simpleFunctionObjects with

wmake libso

I get the error message

make: *** No rule to make target `externalStuff/surfaces/surface/surface.dep', needed by `Make/linuxGccDPOpt/dependencies'. Stop.

I'm using 1.4.1, GCC 4.2.1 and Binutils 2.18

Could anyone give me guidance on how to get it to compile?
juho is offline   Reply With Quote

Old   May 27, 2008, 04:50
Default Hi Juho! Please do the foll
  #15
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
Hi Juho!

Please do the following (just to make sure we're starting off the same version). In the directory

- do a "svn update"
- remove externalStuff
- do "wclean" and "rmdepall"

Then set up the externalStuff as described in the README and retry

Bernhard
__________________
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   May 27, 2008, 05:15
Default Oh, there's a README... Com
  #16
Member
 
Juho Peltola
Join Date: Mar 2009
Location: Finland
Posts: 89
Rep Power: 17
juho is on a distinguished road
Oh, there's a README...

Compiled without complaints!

Thank you for the help and sorry for the stupid question!
juho is offline   Reply With Quote

Old   May 29, 2008, 03:22
Default Could you point me in a direct
  #17
Member
 
Juho Peltola
Join Date: Mar 2009
Location: Finland
Posts: 89
Rep Power: 17
juho is on a distinguished road
Could you point me in a direction for modifying the output of patchFieldFlow in a way that it could be used as an input for timeVaryingUniformFixedValue boundary condition?

Only thing the output would need is brackets around the values. ie.

(
1 0
2 1
3 1
4 10
5 1
)
juho is offline   Reply With Quote

Old   May 29, 2008, 04:07
Default The first bracket was easy, ju
  #18
Member
 
Juho Peltola
Join Date: Mar 2009
Location: Finland
Posts: 89
Rep Power: 17
juho is on a distinguished road
The first bracket was easy, just added it to timelineFunctionObject.C
juho is offline   Reply With Quote

Old   April 2, 2009, 03:00
Default compilation error
  #19
Senior Member
 
Prapanch Nair
Join Date: Mar 2009
Location: Bangalore, India
Posts: 105
Rep Power: 17
prapanj is on a distinguished road
Hi Bernhard,

Thank you for this cool tool.

I have OF 1.5. When I tried to compile using wmake libso, I got a compilation error.

Let me paste the last few lines of the compilation output:

SOURCE=trackDictionary/trackDictionaryFunctionObject.C ; g++ -m32 -Dlinux -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -I/home/rwdi-india/OpenFOAM/OpenFOAM-1.5/src/finiteVolume/lnInclude -I/home/rwdi-india/OpenFOAM/OpenFOAM-1.5/src/meshTools/lnInclude -I/home/rwdi-india/OpenFOAM/OpenFOAM-1.5/src/sampling/lnInclude -I/home/rwdi-india/OpenFOAM/OpenFOAM-1.5/src/triSurface/lnInclude -I/home/rwdi-india/OpenFOAM/OpenFOAM-1.5/src/lagrangian/basic/lnInclude -IlnInclude -I. -I/home/rwdi-india/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude -I/home/rwdi-india/OpenFOAM/OpenFOAM-1.5/src/OSspecific/Unix/lnInclude -fPIC -pthread -c $SOURCE -o Make/linuxGccDPOpt/trackDictionaryFunctionObject.o
trackDictionary/trackDictionaryFunctionObject.C: In member function ‘void Foam::trackDictionaryFunctionObject::echoSwitchesV alues()’:
trackDictionary/trackDictionaryFunctionObject.C:201: error: ‘tolerances’ is not a member of ‘Foam::debug’
make: *** [Make/linuxGccDPOpt/trackDictionaryFunctionObject.o] Error 1



And then compilation exits. I am not able to use the functions after this. Is that a bug or am I doing something wrong here?

Thank you

Prapanj.
prapanj is offline   Reply With Quote

Old   April 2, 2009, 09:29
Default
  #20
Senior Member
 
Martin Beaudoin
Join Date: Mar 2009
Posts: 332
Rep Power: 22
mbeaudoin will become famous soon enough
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

Quote:
Originally Posted by prapanj View Post
Hi Bernhard,

Thank you for this cool tool.

I have OF 1.5. When I tried to compile using wmake libso, I got a compilation error.

Let me paste the last few lines of the compilation output:

SOURCE=trackDictionary/trackDictionaryFunctionObject.C ; g++ -m32 -Dlinux -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -I/home/rwdi-india/OpenFOAM/OpenFOAM-1.5/src/finiteVolume/lnInclude -I/home/rwdi-india/OpenFOAM/OpenFOAM-1.5/src/meshTools/lnInclude -I/home/rwdi-india/OpenFOAM/OpenFOAM-1.5/src/sampling/lnInclude -I/home/rwdi-india/OpenFOAM/OpenFOAM-1.5/src/triSurface/lnInclude -I/home/rwdi-india/OpenFOAM/OpenFOAM-1.5/src/lagrangian/basic/lnInclude -IlnInclude -I. -I/home/rwdi-india/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude -I/home/rwdi-india/OpenFOAM/OpenFOAM-1.5/src/OSspecific/Unix/lnInclude -fPIC -pthread -c $SOURCE -o Make/linuxGccDPOpt/trackDictionaryFunctionObject.o
trackDictionary/trackDictionaryFunctionObject.C: In member function ‘void Foam::trackDictionaryFunctionObject::echoSwitchesV alues()’:
trackDictionary/trackDictionaryFunctionObject.C:201: error: ‘tolerances’ is not a member of ‘Foam::debug’
make: *** [Make/linuxGccDPOpt/trackDictionaryFunctionObject.o] Error 1



And then compilation exits. I am not able to use the functions after this. Is that a bug or am I doing something wrong here?

Thank you

Prapanj.
mbeaudoin 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
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 03:00.