CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   binData in forces functionObject (https://www.cfd-online.com/Forums/openfoam-programming-development/221960-bindata-forces-functionobject.html)

sippanspojk November 6, 2019 10:09

binData in forces functionObject
 
Hi,

I am writing my own functionObject and since I am quite new to OpenFOAM i started off by making a copy of the standard functionObject forces and I am now about to adopt it to my needs.

I have managed to understand quite a bit of what is going on in there but on thing that I still don't understand is the binData, that is referred on many places in the code.

For example:

Code:

case BINS_FILE:
        {
            // bin data

            writeHeader(file(i), "Force bins");
            writeHeaderValue(file(i), "bins", nBin_);
            writeHeaderValue(file(i), "start", binMin_);
            writeHeaderValue(file(i), "delta", binDx_);
            writeHeaderValue(file(i), "direction", binDir_);

            vectorField binPoints(nBin_);
            writeCommented(file(i), "x co-ords  :");
            forAll(binPoints, pointi)
            {
                binPoints[pointi] = (binMin_ + (pointi + 1)*binDx_)*binDir_;
                file(i) << tab << binPoints[pointi].x();
            }
            file(i) << nl;

            writeCommented(file(i), "y co-ords  :");
            forAll(binPoints, pointi)
            {
                file(i) << tab << binPoints[pointi].y();
            }
            file(i) << nl;

            writeCommented(file(i), "z co-ords  :");
            forAll(binPoints, pointi)
            {
                file(i) << tab << binPoints[pointi].z();
            }
            file(i) << nl;

            writeCommented(file(i), "Time");

            const word binForceTypes("[pressure,viscous]");
            for (label j = 0; j < nBin_; j++)
            {
                const word jn('(' + Foam::name(j) + ')');
                const word f("forces" + jn + binForceTypes);

                file(i)<< tab << f;
            }
            if (localSystem_)
            {
                for (label j = 0; j < nBin_; j++)
                {
                    const word jn('(' + Foam::name(j) + ')');
                    const word f("localMoments" + jn + binForceTypes);

                    file(i)<< tab << f;
                }
            }

            break;
        }

I more or less understand what this section is doing but I don't understand what the BINS_FILE is.

Thankful for any explanation on this.

Cheers,
David

Gang Wang February 27, 2020 17:25

Hi!

I also felt confused about this, do you have any idea about bindata?

Best regards,
Gang

me3840 February 29, 2020 11:26

It's writing out a file of the binned data.

sippanspojk March 2, 2020 04:52

Quote:

Originally Posted by me3840 (Post 759978)
It's writing out a file of the binned data.

Yes, well that is clear. But what is the "binned data"?

einstein_zee March 2, 2020 06:05

Hii there,

well if you read the description it says the following :

"Member function forces::write() calculates the forces/moments and
writes the forces/moments into the file \<timeDir\>/forces.dat and bin
data (if selected) to the file \<timeDir\>/forces_bin.dat"

also later it follows with the usage of it as :

"Bin data is optional, but if the dictionary is present, the entries must
be defined according o
\table
nBin | number of data bins | yes |
direction | direction along which bins are defined | yes |
cumulative | bin data accumulated with increasing distance | yes |
\endtable"

It is an optional feature and it seems that you may use it when you want to have spatial distribution of forces/moments along a certain direction ... You may try it out to see how it works...

me3840 March 2, 2020 19:03

In other words this will get you a distribution of forces along a direction.

This is typical for aero cases where one is interested in seeing where drag or lift has the largest increase or decrease, allowing focused development of that area.

sippanspojk March 3, 2020 02:43

Quote:

Originally Posted by me3840 (Post 760200)
In other words this will get you a distribution of forces along a direction.

This is typical for aero cases where one is interested in seeing where drag or lift has the largest increase or decrease, allowing focused development of that area.

Alright, now I have a better idea of what it does. Thank you for your help!


All times are GMT -4. The time now is 07:27.