CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Post-Processing

How to output porous force in OF221

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By wyldckat

Reply
 
LinkBack Thread Tools Display Modes
Old   February 13, 2014, 20:57
Default How to output porous force in OF221
  #1
New Member
 
Chen Yu
Join Date: Sep 2013
Posts: 19
Rep Power: 5
chery1986 is on a distinguished road
I am using porousInterFoam and porousWaveFoam in OF221, and want to output the drag force inside the porous media but cannot figure out the method. I define the porous media in blockMeshDict with a block
hex (1 2 6 5 13 14 18 17) porosity (73 93 1) simpleGrading (1 1 1)
and in porosityZone file define the property of it
Code:
1
(
    porosity
    {
        coordinateSystem
        {
            e1  (1 0 0);
            e2  (0 0 1);
        }

        resistanceFormulation vanGent1995;

        porosity 0.49;
        KC KC [0 0 0 0 0 0 0] 128;
        gammaAddedMass 0.34;
        
        d50 d50 [0 1 0 0 0 0 0] 0.0159;
        alpha alpha [0 0 0 0 0 0 0] 500;
        beta beta [0 0 0 0 0 0 0] 2.0;
    }
)
I found that if I use libforces.so,
Code:
    porousforces
    {
        type forces;
        functionObjectLibs ("libforces.so");
        outputControl timeStep;
        outputInterval     1;

        // Patches to sample
        patches (lowerWall);
        // Name of fields
        pName p;
        Uname U;
        // Density
        rhoName rho;
//        nuName    nuInf;
        rhoInf  1000;
//        nuInf 1e-06;
        // Dump to file
        log true;
        // Centre of rotation
        CofR (0 0 0);
    }
Then it will output the the force history with the first line # Time forces(pressure, viscous, porous) moment(pressure, viscous, porous), but the porous force is always (0, 0, 0).

Anyone know how to output the porous force in the porous media zone.

Last edited by wyldckat; September 13, 2014 at 16:10. Reason: Added [CODE][/CODE]
chery1986 is offline   Reply With Quote

Old   June 19, 2014, 02:01
Default Did you ever find a solution?
  #2
New Member
 
Join Date: Mar 2011
Posts: 10
Rep Power: 7
RygeltheXVI is on a distinguished road
I too am looking to work out porousity drag in openfoam and was wondering if you ever found a solution?

It doesn't make sense that a porous region is a cellzone to work out the forces on a patch (unless the zone is 1 cell wide), but even then you can't have the face bounding your porous region be patches else the flow wont go though them...
RygeltheXVI is offline   Reply With Quote

Old   August 28, 2014, 12:59
Default
  #3
New Member
 
Join Date: Jun 2012
Location: Bologna, Italy
Posts: 3
Rep Power: 6
styleo86 is on a distinguished road
Do you have found any solution to the problem?

I have the same request but I don't find a workaround.
styleo86 is offline   Reply With Quote

Old   September 13, 2014, 16:19
Default
  #4
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,794
Blog Entries: 39
Rep Power: 104
wyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of light
Greetings to all!

I had this thread on my to-do list for a while now and finally managed to look into this.

I have to admit I was going to say at first that this wasn't possible, but after some searching and looking into the source code, here's what I've found:
  1. Although the feature of calculating the porous part of the forces was already available in version 2.2.1, it was only announced as a feature in 2.3.0: http://www.openfoam.org/version2.3.0...processing.php
    Quote:
    forces and forceCoeffs include porosity contribution, and updated writing of bin data to single file(s);
  2. If you look at this file: https://github.com/OpenFOAM/OpenFOAM.../forces.C#L681 - in line 681, you'll find that the missing optional option is named "porosity".
Therefore, since I don't have a test case myself, I can only state that the following line is missing in the function object you use in "controlDict":
Code:
porosity true;
Using chery1986's example:
Code:
    porousforces
    {
        type forces;
        functionObjectLibs ("libforces.so");
        outputControl timeStep;
        outputInterval     1;

        // Patches to sample
        patches (lowerWall);
        // Name of fields
        pName p;
        Uname U;
        // Density
        rhoName rho;
//        nuName    nuInf;
        rhoInf  1000;
//        nuInf 1e-06;
        // Dump to file
        log true;
        // Centre of rotation
        CofR (0 0 0);
        // Include porosity effects
        porosity   true;
    }
Best regards,
Bruno
peppino likes this.
__________________
wyldckat is offline   Reply With Quote

Old   September 28, 2016, 03:25
Default
  #5
New Member
 
Join Date: May 2013
Posts: 10
Rep Power: 5
peppino is on a distinguished road
I would like to revive this thread since I have not yet found an answer to the main question in the forum.
I attach a simple case to work with. The domain is a simple box with a porous zone in it and the flow solution seems reasonable.
The outputted forces though seems enormously high.
This may not be a surprise considering that i specified a cellZone (named framework) instead of a patch in the forces dictionary (see below).
Can I tell the functionObject that framework is a porous cellZone and not a patch? Or is there something else that is wrong?

Code:
forces_1
{type forces;
functionObjectLibs ("libforces.so"); 
porosity true;
patches (framework );    //not a patch!!
rhoName rhoInf;
rhoInf 1.2;
CofR (0 0 0);
outputControl   timeStep;
outputInterval  1;}
Attached Files
File Type: gz boxCase2.tar.gz (7.0 KB, 3 views)
peppino is offline   Reply With Quote

Old   September 28, 2016, 03:59
Default
  #6
New Member
 
Join Date: May 2013
Posts: 10
Rep Power: 5
peppino is on a distinguished road
I seem to have found the reason for the extremely high forces, simply i forgot to scale the mesh before running...

Also, I noticed an error message when running the solver that complained about framework not being a patch. So I tested to remove all entries from the patch list in the dictionary (see below) and the error message disappeared. the porous forces are outputted anyway.

I presume this means that the functionObject will print out forces exherted on all porous zones in the domain.

Code:
  forces_1
{type forces;
functionObjectLibs ("libforces.so"); 
porosity true;
patches ( );    
rhoName rhoInf;
rhoInf 1.2;
CofR (0 0 0);
outputControl   timeStep;
outputInterval  1;}
peppino is offline   Reply With Quote

Old   September 28, 2016, 07:56
Question
  #7
New Member
 
Join Date: May 2013
Posts: 10
Rep Power: 5
peppino is on a distinguished road
next question is then: if there are several porous zones in the domain, is there a way to output the forces on a single porous zone rather than the sum of the forces on all zones? any suggestions are appreciated!
peppino is offline   Reply With Quote

Old   September 28, 2016, 16:39
Default
  #8
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,794
Blog Entries: 39
Rep Power: 104
wyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of light
Quote:
Originally Posted by peppino View Post
next question is then: if there are several porous zones in the domain, is there a way to output the forces on a single porous zone rather than the sum of the forces on all zones? any suggestions are appreciated!
Quick question: Which OpenFOAM version are you using?
__________________
wyldckat is offline   Reply With Quote

Old   September 29, 2016, 01:33
Default
  #9
New Member
 
Join Date: May 2013
Posts: 10
Rep Power: 5
peppino is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Quick question: Which OpenFOAM version are you using?
Hi Bruno,
I am using OF 2.3.1.
By the way, thank you for your previous post where you discussed the keyword "porosity"
peppino is offline   Reply With Quote

Old   September 29, 2016, 17:41
Default
  #10
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,794
Blog Entries: 39
Rep Power: 104
wyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of light
Quick answers:
Quote:
Originally Posted by peppino View Post
I am using OF 2.3.1.
By the way, thank you for your previous post where you discussed the keyword "porosity"
That makes it a bit clearer and you're welcome!

Quote:
Originally Posted by peppino View Post
next question is then: if there are several porous zones in the domain, is there a way to output the forces on a single porous zone rather than the sum of the forces on all zones? any suggestions are appreciated!
I've checked the code and the only way would be to create a custom function object. I don't have the time necessary to do it myself, but you can find a very similar example here: https://github.com/wyldckat/forceDirCoeffs/tree/of22x

edit: Sorry, forgot to mention that the piece of code you're looking for is here: https://github.com/OpenFOAM/OpenFOAM.../forces.C#L923 - starts in line 923, "fPTot" and "Md" is what you're looking for.

Last edited by wyldckat; September 29, 2016 at 17:43. Reason: see "edit:"
wyldckat is offline   Reply With Quote

Old   September 30, 2016, 03:17
Default
  #11
New Member
 
Join Date: May 2013
Posts: 10
Rep Power: 5
peppino is on a distinguished road
Thanks for the suggestion and the links. I doubt that I will be able to modify the code but I will give it a try later on. If i can get it to work i will post the result.
peppino is offline   Reply With Quote

Old   November 30, 2016, 06:40
Default
  #12
Member
 
Anirudh Kulkarni
Join Date: May 2016
Posts: 43
Rep Power: 2
Tempest is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Quick answers:

That makes it a bit clearer and you're welcome!


I've checked the code and the only way would be to create a custom function object. I don't have the time necessary to do it myself, but you can find a very similar example here: https://github.com/wyldckat/forceDirCoeffs/tree/of22x

edit: Sorry, forgot to mention that the piece of code you're looking for is here: https://github.com/OpenFOAM/OpenFOAM.../forces.C#L923 - starts in line 923, "fPTot" and "Md" is what you're looking for.
Is it possible to calculate the porous Forces in OF without using the forceCoeffs macro in controlDict but to add a certain piece of code in the main solver?
Tempest is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
outputTime in Swak function immortality OpenFOAM Post-Processing 16 February 14, 2016 17:02
Am i right? porous jump drag force Shim FLUENT 2 August 25, 2014 09:33
ActuatorDiskExplicitForce in OF2.1. Help be_inspired OpenFOAM Programming & Development 8 July 3, 2014 10:54
mixerVesselAMI2D's mass is not balancing sharonyue OpenFOAM Running, Solving & CFD 6 June 10, 2013 09:34
porous medium and reactions Valeria FLUENT 1 July 10, 2009 03:58


All times are GMT -4. The time now is 02:47.