Hi All
Is there such a func
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 |
In STL, max (well, that would
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 |
Forgot to tell you: the functi
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 |
Thanks a lot Prof. Hrvoje,
It
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... http://www.cfd-online.com/OpenFOAM_D...part/happy.gif (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; |
Just a stupid thought from my
Just a stupid thought from my side, but maybe 5.7 is the maximum of v2_/(k_+kSmall_)) ?
|
Grrr: pow(v2k,0)! Would not t
Grrr: pow(v2k,0)! Would not that be one? Always one :-) Any number to the power zero is one, right?
Hrv |
Yes, you are right. It was a s
Yes, you are right. It was a stupid mistake (it was late at night http://www.cfd-online.com/OpenFOAM_D...part/happy.gif ). 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)
|
Yes, I was using a shorter not
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". http://www.cfd-online.com/OpenFOAM_D...part/happy.gif Thanks. |
All times are GMT -4. The time now is 06:18. |