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

binData in forces functionObject

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By sippanspojk

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 6, 2019, 10:09
Default binData in forces functionObject
  #1
Member
 
David Andersson
Join Date: Oct 2019
Posts: 46
Rep Power: 6
sippanspojk is on a distinguished road
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 likes this.
sippanspojk is offline   Reply With Quote

Old   February 27, 2020, 17:25
Default
  #2
Member
 
Gang Wang
Join Date: Oct 2019
Location: China
Posts: 64
Rep Power: 7
Gang Wang is on a distinguished road
Hi!

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

Best regards,
Gang
Gang Wang is offline   Reply With Quote

Old   February 29, 2020, 11:26
Default
  #3
Senior Member
 
Join Date: Nov 2010
Location: USA
Posts: 1,232
Rep Power: 24
me3840 is on a distinguished road
It's writing out a file of the binned data.
me3840 is offline   Reply With Quote

Old   March 2, 2020, 04:52
Default
  #4
Member
 
David Andersson
Join Date: Oct 2019
Posts: 46
Rep Power: 6
sippanspojk is on a distinguished road
Quote:
Originally Posted by me3840 View Post
It's writing out a file of the binned data.
Yes, well that is clear. But what is the "binned data"?
sippanspojk is offline   Reply With Quote

Old   March 2, 2020, 06:05
Default
  #5
Member
 
Hosein
Join Date: Nov 2011
Location: Germany
Posts: 93
Rep Power: 14
einstein_zee is on a distinguished road
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...
einstein_zee is offline   Reply With Quote

Old   March 2, 2020, 19:03
Default
  #6
Senior Member
 
Join Date: Nov 2010
Location: USA
Posts: 1,232
Rep Power: 24
me3840 is on a distinguished road
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.
me3840 is offline   Reply With Quote

Old   March 3, 2020, 02:43
Default
  #7
Member
 
David Andersson
Join Date: Oct 2019
Posts: 46
Rep Power: 6
sippanspojk is on a distinguished road
Quote:
Originally Posted by me3840 View Post
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!
sippanspojk is offline   Reply With Quote

Reply

Tags
forces, functionobjects, openfoam, programming, udf


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
forces functionObject with interFoam and dynamic pressure AnnaF OpenFOAM Post-Processing 4 June 20, 2019 20:46
Point of action of 'forces' functionObject? vikramrajagopalan OpenFOAM Post-Processing 2 March 21, 2019 15:08
Residuals and forces spiraling out of control before failing edomalley1 OpenFOAM Running, Solving & CFD 3 September 7, 2018 10:42
Forces for airfoil test case Martin_ OpenFOAM Running, Solving & CFD 1 July 2, 2012 11:58
Patch names amp forces functionObject david OpenFOAM Bugs 3 April 26, 2011 21:59


All times are GMT -4. The time now is 19:30.