|
[Sponsors] |
February 8, 2018, 09:46 |
bound() function of the bound.C file
|
#1 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
Hi everybody,
yesterday I had a discussion with my colleague about the bound function. We were digging into the code and were finally surprised how interesting this function is working. Actually we needed just the max() function but for unknown reason we went the wrong direction at the beginning. Nevertheless it was good that we discussed about the bound() functionality. However, it is always nice to have the code implementation and be able to understand it but in that particular case, does anybody know if there is a mathematical background behind this interesting expression? After small drafts we realized that the unbounded values will get some values which are somehow an average of the field values. We can imagine that this makes much more sense than setting it to a - lets say - minimum value e.g. 0. The question as already mentioned is. Does anybody know if there is some mathematical background / formula behind that? At least there should be some mathematical or physical background for that implementation. https://cpp.openfoam.org/v5/bound_8C_source.html Code:
32 Foam::volScalarField& 33 Foam::bound(volScalarField& vsf, const dimensionedScalar& lowerBound) 34 { 35 const scalar minVsf = min(vsf).value(); 36 37 if (minVsf < lowerBound.value()) 38 { 39 Info<< "bounding " << vsf.name() 40 << ", min: " << minVsf 41 << " max: " << max(vsf).value() 42 << " average: " << gAverage(vsf.primitiveField()) 43 << endl; 44 45 vsf.primitiveFieldRef() = max 46 ( 47 max 48 ( 49 vsf.primitiveField(), 50 fvc::average(max(vsf, lowerBound))().primitiveField() 51 * pos(-vsf.primitiveField()) 52 ), 53 lowerBound.value() 54 ); 55 56 vsf.boundaryFieldRef() = max(vsf.boundaryField(), lowerBound.value()); 57 } 58 59 return vsf; 60 }
__________________
Keep foaming, Tobias Holzmann |
|
November 20, 2018, 06:55 |
|
#2 | ||
Senior Member
Guilherme
Join Date: Apr 2017
Posts: 225
Rep Power: 10 |
Hi Tobi,
I'm studying about the bound function... so unfortunately I can not help you in your post. I have a question and maybe you can help me..., related to the kEpsilon model. Based on original file: kEpsilon On lines 132 and 133 I could substitute for: Quote:
Quote:
OBS: I understand that SMALL is the default value of this function. |
|||
November 20, 2018, 07:55 |
|
#3 | |
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15 |
Quote:
I quess the averaging is made in order to suppress numerical oscillations. As far as I know the bounding is performed to help the solver to find a solution or avoid that the solver diverges. |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] funkyDoCalc with OF2.3 massflow | NiFl | OpenFOAM Community Contributions | 14 | November 25, 2020 03:30 |
[swak4Foam] Problem installing swak_2.x for OpenFoam-2.4.0 | towanda | OpenFOAM Community Contributions | 6 | September 5, 2015 21:03 |
[OpenFOAM] Annoying issue of automatic "Rescale to Data Range " with paraFoam/paraview 3.12 | keepfit | ParaView | 60 | September 18, 2013 03:23 |
[blockMesh] BlockMesh FOAM warning | gaottino | OpenFOAM Meshing & Mesh Conversion | 7 | July 19, 2010 14:11 |
DecomposePar links against liblamso0 with OpenMPI | jens_klostermann | OpenFOAM Bugs | 11 | June 28, 2007 17:51 |