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

Function maxvsfvsf

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 27, 2006, 20:08
Default Hi All Is there such a func
  #1
Member
 
diablo80@web.de
Join Date: Mar 2009
Posts: 93
Rep Power: 17
sampaio is on a distinguished road
Hi All

Is there such a function?

It gave me no compilation error, but apparently is not doing what I expected it to do:

I thought that if I use vsf1 = max(vsf2, vsf3) it would give the maximum between vsf2 and vsf3 at each control volume. But, when I use vsf3 = to 1 everywhere (actually, I used vsf3=vsf2^0, just to make sure), and print the maximum value of the domain (Info << max(vsf1).value()) it output a number greater than 1 (5.7).

Am I doing something stupid?

Thanks a lot
Luiz
sampaio is offline   Reply With Quote

Old   March 27, 2006, 20:17
Default In STL, max (well, that would
  #2
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33
hjasak will become famous soon enough
In STL, max (well, that would be std::max, but you're using namespace std;) is sometimes defined as a stupid template - try Foam::max instead and see if it's any better.

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   March 27, 2006, 20:19
Default Forgot to tell you: the functi
  #3
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33
hjasak will become famous soon enough
Forgot to tell you: the function is defined as a BINARY_FUNCTION(func) macro expansion. For me, it's lnInclude/GeometricFieldFunctions.H, line 260.

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   March 28, 2006, 01:21
Default Thanks a lot Prof. Hrvoje, It
  #4
Member
 
diablo80@web.de
Join Date: Mar 2009
Posts: 93
Rep Power: 17
sampaio is on a distinguished road
Thanks a lot Prof. Hrvoje,
It didnt work.
Here is the piece of code, supposed to print the maximum value as 1. It is outputing 5.7, instead. I even tried to zero the boundary values, as a desperate measure...

(what I am trying to do is a v2f turb model, I hope to be my first contribution for this fantastic code... I want to limit v2 to something lower than the total kinetic energy, k)

Thanks again.


volScalarField v2k(v2_/(k_+kSmall_));
v2k = Foam::max((v2_/(k_+kSmall_)),pow(v2k,0));
forAll(v2k.boundaryField(), patchI)
{
v2k.boundaryField()[patchI] = 0.0*v2k.boundaryField()[patchI];
}

nfo << "\nMax de v2/k: "<< max(v2k).value() << endl;
sampaio is offline   Reply With Quote

Old   March 28, 2006, 04:37
Default Just a stupid thought from my
  #5
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
Just a stupid thought from my side, but maybe 5.7 is the maximum of v2_/(k_+kSmall_)) ?
__________________
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 28, 2006, 09:28
Default Grrr: pow(v2k,0)! Would not t
  #6
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 33
hjasak will become famous soon enough
Grrr: pow(v2k,0)! Would not that be one? Always one :-) Any number to the power zero is one, right?

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   March 28, 2006, 09:32
Default Yes, you are right. It was a s
  #7
Member
 
diablo80@web.de
Join Date: Mar 2009
Posts: 93
Rep Power: 17
sampaio is on a distinguished road
Yes, you are right. It was a stupid mistake (it was late at night ). I should have taken the minimum in the second line. Thanks. (Actually, there is also a physical mistake in the above implementation, and it should be 2, since u2+v2+w2=2*k, but that doesnt matter to this discussion)
sampaio is offline   Reply With Quote

Old   March 28, 2006, 10:02
Default Yes, I was using a shorter not
  #8
Member
 
diablo80@web.de
Join Date: Mar 2009
Posts: 93
Rep Power: 17
sampaio is on a distinguished road
Yes, I was using a shorter notation for dimensionedScalar("1",dimensionSet(0, 0, 0, 0, 0),1).

Now that everything is working (except my case is still diverging, I will change it back to this "1".

Thanks.
sampaio 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
udf function!! shayej FLUENT 1 February 5, 2009 09:37
Cp as a function Mareike CFX 4 April 8, 2008 05:55
If function PANKAJ CFX 3 January 13, 2008 04:53
Stream Function - Potential Function coordinates harish Main CFD Forum 8 June 25, 2005 14:18
Max y+ as a function of Re Fred Uckfield Main CFD Forum 6 October 17, 2001 12:15


All times are GMT -4. The time now is 01:26.