CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > 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 Search this Thread 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: 12
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 17:10. Reason: Added [CODE][/CODE]
chery1986 is offline   Reply With Quote

Old   June 19, 2014, 03:01
Default Did you ever find a solution?
  #2
New Member
 
Join Date: Mar 2011
Posts: 16
Rep Power: 15
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, 13:59
Default
  #3
New Member
 
Join Date: Jun 2012
Location: Bologna, Italy
Posts: 3
Rep Power: 13
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, 17:19
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
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, 04:25
Default
  #5
New Member
 
Join Date: May 2013
Posts: 11
Rep Power: 12
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, 18 views)
peppino is offline   Reply With Quote

Old   September 28, 2016, 04:59
Default
  #6
New Member
 
Join Date: May 2013
Posts: 11
Rep Power: 12
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, 08:56
Question
  #7
New Member
 
Join Date: May 2013
Posts: 11
Rep Power: 12
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, 17:39
Default
  #8
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
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, 02:33
Default
  #9
New Member
 
Join Date: May 2013
Posts: 11
Rep Power: 12
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, 18:41
Default
  #10
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
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 18:43. Reason: see "edit:"
wyldckat is offline   Reply With Quote

Old   September 30, 2016, 04:17
Default
  #11
New Member
 
Join Date: May 2013
Posts: 11
Rep Power: 12
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: 60
Rep Power: 9
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

Old   February 8, 2019, 14:13
Default
  #13
Senior Member
 
Join Date: Jun 2011
Posts: 163
Rep Power: 14
mechy is on a distinguished road
Hi All
I have the following question about porosity part of forces
How OF calculated the forces applied on the porous zones ?
what formula is used for calculating the forces

thanks for any help
mechy is offline   Reply With Quote

Old   February 8, 2019, 18:26
Default
  #14
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
@mechy: Quick answer... Given my old answer:
Quote:
Originally Posted by wyldckat View Post
https://github.com/OpenFOAM/OpenFOAM.../forces.C#L923 - starts in line 923, "fPTot" and "Md" is what you're looking for.
  1. https://cpp.openfoam.org/v6/
  2. Search "porosityModel" --> https://cpp.openfoam.org/v6/classFoa...sityModel.html
  3. Example, clicked on "DarcyForchheimer" --> https://cpp.openfoam.org/v6/DarcyFor...8C_source.html
  4. Found the calcForce method that is used there: https://cpp.openfoam.org/v6/classFoa...fa6632b88fd61b
  5. Clicked on the line number where it's defined:
    Quote:
    Definition at line 172 of file DarcyForchheimer.C.
  6. And there you go: https://cpp.openfoam.org/v6/DarcyFor...ce.html#l00172
The calculation depends on the model.
__________________
wyldckat is offline   Reply With Quote

Old   February 9, 2019, 04:35
Default
  #15
Senior Member
 
Join Date: Jun 2011
Posts: 163
Rep Power: 14
mechy is on a distinguished road
Dear Bruno
thanks so much for your reply.
I have found that the force is calculated by integrating of Darcy-Forchimmer term over the porous volumes.

I need to calculate the force on the porous-fluid interface by integrating the pressure and viscous stress on the interface. however, the force library only gives the patches as its input. and this library can not give the interface for calculating the force.

I will be so thankful if you can help me to calculate the force on the fluid-porous interface

Best Regards
mechy is offline   Reply With Quote

Old   March 14, 2024, 13:44
Default
  #16
New Member
 
Marion Sant
Join Date: Dec 2023
Posts: 22
Rep Power: 2
edo2822 is on a distinguished road
Quote:
Originally Posted by chery1986 View Post
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.
Hey! I don't have the solution for this problem, but can I ask tyou which boundary condition you imposed for the boundaries of your porous zones?
edo2822 is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[swak4Foam] outputTime in Swak function immortality OpenFOAM Community Contributions 20 October 6, 2022 13:08
ActuatorDiskExplicitForce in OF2.1. Help be_inspired OpenFOAM Programming & Development 10 September 14, 2018 12:12
Am i right? porous jump drag force Shim FLUENT 2 August 25, 2014 10:33
mixerVesselAMI2D's mass is not balancing sharonyue OpenFOAM Running, Solving & CFD 6 June 10, 2013 10:34
porous medium and reactions Valeria FLUENT 1 July 10, 2009 04:58


All times are GMT -4. The time now is 08:17.