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

Darcy Forchheimer: trying to understand the code and how to run with it?

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By student666

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 12, 2015, 18:12
Default Darcy Forchheimer: trying to understand the code and how to run with it?
  #1
Senior Member
 
M. C.
Join Date: May 2013
Location: Italy
Posts: 286
Blog Entries: 6
Rep Power: 17
student666 is on a distinguished road
Hi all,

I'm facing strange behavior using fvOptions and simpleFoam. I mean by setting extrapolated values from experimental data I don't have same pressure losses on my simulation, but lower.
The case is incompressible with MRF source for momentum.
here is th fvOption:
Code:
MRF1
{
    type            MRFSource;
    active          true;
    selectionMode   cellZone;
    cellZone        MRF;

    MRFSourceCoeffs
    {

       nonRotatingPatches (wallStat boccaglio AMI_ROT1 AMI_ROT2 AMI_ROT3);/

        origin      (0 0 0);
        axis        (0 0 1);
        omega       300;

     
    }
}

…....
 
porosity2
{
    type          explicitPorositySource;
    active        true; //yes;
    selectionMode cellZone;
    cellZone      filtro;

    explicitPorositySourceCoeffs
    {
        type DarcyForchheimer;

        DarcyForchheimerCoeffs
        {
              d    d [0 -2 0 0 0 0 0] (1790 1790 1790); 
              f    f [0 -1 0 0 0 0 0] (1640 1640 1640); 
              coordinateSystem
              {
        type cartesian;
        origin (0.05 0.11 0.15);
        coordinateRotation
                 {   type axesRotation;
             e1    (1 0 0);
                 e2    (0 1 0);
             //e3    (0 0 1);
         }
              }
        }
    }
 
}
Porosity zone 2 is a cellzone of about 10mm thickness, isotropic.

In order to set the D (linear?)& F(square?) I made some manipulation on experimental data.

Experimental data consists of pressure losses (static) at different mean velocities.
For each static pressure, I divided the value by thickness of filter (10mm), then by plotting the pressure/meters losses vs. velocity I was able to extrapolate a(=F) & b(=D) values by tendency line representation on the graph, forcing the curve passing by point (0,0).
1st question: is it correct to divided pressure losses by thickness of filter? I mean I followed a tutorial (not openfoam) and I think this division take into account the number of cell in order to interpolate pressure and velocity values, is it correct?


Further by digging into the code I see on DarcyForchheimer.H:


Code:
 

     public porosityModel 
 { 
 private: 
  
     // Private data 
  
         //- Darcy coeffient XYZ components (user-supplied) [1/m2] 
         dimensionedVector dXYZ_; 
  
         //- Forchheimer coeffient XYZ components (user-supplied) [1/m] 
         dimensionedVector fXYZ_; 
  
         //- Darcy coefficient - converted from dXYZ [1/m2] 
         List<tensorField> D_; 
  
         //- Forchheimer coefficient - converted from fXYZ [1/m] 
         List<tensorField> F_; 
  
         //- Name of density field 
         word rhoName_; 
  …..
rho is an input, but in simpleFoam I don't specify it at all.
2nd question: how openfoam calculates rho as I specify only nu 1.5e-5 m^2/s in transport properties?




Further into DarcyForchheimer.C:


Code:
  void Foam::porosityModels::DarcyForchheimer::calcTranformModelData() 
 { 
     if (coordSys_.R().uniform()) 
     { 
         forAll (cellZoneIDs_, zoneI) 
         { 
             D_[zoneI].setSize(1); 
             F_[zoneI].setSize(1); 
  
             D_[zoneI][0] = tensor::zero; 
             D_[zoneI][0].xx() = dXYZ_.value().x(); 
             D_[zoneI][0].yy() = dXYZ_.value().y(); 
             D_[zoneI][0].zz() = dXYZ_.value().z(); 
  
             D_[zoneI][0] = coordSys_.R().transformTensor(D_[zoneI][0]); 
  
             // leading 0.5 is from 1/2*rho 
             F_[zoneI][0] = tensor::zero; 
             F_[zoneI][0].xx() = 0.5*fXYZ_.value().x(); 
             F_[zoneI][0].yy() = 0.5*fXYZ_.value().y(); 
             F_[zoneI][0].zz() = 0.5*fXYZ_.value().z(); 
  
             F_[zoneI][0] = coordSys_.R().transformTensor(F_[zoneI][0]); 
         } 
     } 
     else 
     { 
         forAll(cellZoneIDs_, zoneI) 
         { 
             const labelList& cells = mesh_.cellZones()[cellZoneIDs_[zoneI]]; 
  
             D_[zoneI].setSize(cells.size()); 
             F_[zoneI].setSize(cells.size()); 
  
             forAll(cells, i) 
             { 
                 D_[zoneI][i] = tensor::zero; 
                 D_[zoneI][i].xx() = dXYZ_.value().x(); 
                 D_[zoneI][i].yy() = dXYZ_.value().y(); 
                 D_[zoneI][i].zz() = dXYZ_.value().z(); 
  
                 // leading 0.5 is from 1/2*rho 
                 F_[zoneI][i] = tensor::zero; 
                 F_[zoneI][i].xx() = 0.5*fXYZ_.value().x(); 
                 F_[zoneI][i].yy() = 0.5*fXYZ_.value().y(); 
                 F_[zoneI][i].zz() = 0.5*fXYZ_.value().z(); 
             } 
  
             const coordinateRotation& R = coordSys_.R(mesh_, cells); 
  
             D_[zoneI] = R.transformTensor(D_[zoneI], cells); 
             F_[zoneI] = R.transformTensor(F_[zoneI], cells); 
         } 
     }
what's the meaning of the if idle looking for uniform field? I'm not supposed to specify it into the fvOption dictionary.
3rd question: can someone help me please?


Thanks a lot!


Bye
student666 is offline   Reply With Quote

Old   February 12, 2015, 19:59
Default
  #2
Senior Member
 
M. C.
Join Date: May 2013
Location: Italy
Posts: 286
Blog Entries: 6
Rep Power: 17
student666 is on a distinguished road
Hi,

I work a little on angleExplicit case on porousSimpleFoam folder.
If in 0 folder I keep only U & p file, computation starts anyway.

I'm a little in confusion about this topic, as I thought rho was calculated by perfect Gas equation, but removing T file, computation start and terminate with no errors.

In any case, I discovered a mismatch between my BCs and the tutorial case:
in the tutorial case a BC for the porosity walls is used and set to slip, but if I change it into wall with fixed uniform value (0 0 0) it works anyway...so what's the difference with it?

thank you for any help.

Bye
student666 is offline   Reply With Quote

Old   February 13, 2015, 10:50
Default
  #3
Senior Member
 
M. C.
Join Date: May 2013
Location: Italy
Posts: 286
Blog Entries: 6
Rep Power: 17
student666 is on a distinguished road
I test the DarcyForchHeimer on a test case based on measurments of pressure losses on a porous media using porousSimpleFoam and porosity dict:

https://www.dropbox.com/s/w27xlva4ftbw908/case.JPG?dl=0

it's 2D case of a channel of 21x2 meters with one porous zone of 1meter in the middle.

As it's possibile to see, I calculated the D & F coefficient by plotting on a graph and drawing the tendecy line passing through (0,0).

These values are used into porosity dict for the DarcyForchheimer model, but red lines show results of calculation, higly disagree with measruments, any suggestion?

As it possible to see on the following picture, after the porous zone (fluid flows in x+ direction) velocity has a 1.06m/s value, while at inlet the BC is 0.88m/s: I was expecting a reduction on velocity after the porous media.
https://www.dropbox.com/s/duxz3jeu4hjghjr/fdsf.png?dl=0
Can someone give me an explanation?

Here is the case, with the mesh.unv
https://www.dropbox.com/s/ixu1pdwevbpg88b/case.zip?dl=0

Thanks a lot
student666 is offline   Reply With Quote

Old   February 13, 2015, 11:16
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,938
Rep Power: 39
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

Why do you think that 5000 iterations is enough for the case to converge?
alexeym is offline   Reply With Quote

Old   February 13, 2015, 11:40
Default
  #5
Senior Member
 
M. C.
Join Date: May 2013
Location: Italy
Posts: 286
Blog Entries: 6
Rep Power: 17
student666 is on a distinguished road
Hi,

thanks for reply.

Here's a plot of the residual;

https://www.dropbox.com/s/sr7kftxrvk...nning.png?dl=0

I see residual floating over very low values; honestly I haven't checked a physical quantity, as well I haven't set up a turbulent case, but a laminar one.
In any case, I can't see how velocity should raise up its value after the porous media.
Should it be as for the conservativness of the FV method?
I mean as for the BC applied, mass conservation has to be kept, so higher pressure before porous media gives a "bump" to the fluid, but as for conservativness the calculation leads to have same mass flow between inlet and outlet and, as for constant section area, velocity can't decrease.
student666 is offline   Reply With Quote

Old   February 13, 2015, 11:56
Default
  #6
Senior Member
 
M. C.
Join Date: May 2013
Location: Italy
Posts: 286
Blog Entries: 6
Rep Power: 17
student666 is on a distinguished road
Hi,

here's a plot of the sum of inlet and outlet massflow.

As you can see after few hundred iterations it comes to 0.

https://www.dropbox.com/s/1r97qj99jj...sflow.png?dl=0

This should explain the local raise for velocity value.

How can I the set up correctly the Darcy Forchheimer model?
student666 is offline   Reply With Quote

Old   March 25, 2015, 10:22
Default
  #7
Senior Member
 
M. C.
Join Date: May 2013
Location: Italy
Posts: 286
Blog Entries: 6
Rep Power: 17
student666 is on a distinguished road
Hi all,

I don't know why, but the DarcyForchHeimer model didn't work for me.

I found this useful link:
http://www.geocities.co.jp/SiliconVa...fvOptions.html

and by changing model to FixedCoeff, I was able to solve my problem.

Anyway, these are the steps I performed to test the model on a simple case: a straight 2D channel of constant section with a predefined thickness for the porous zone.

1 - I divided pressure losses (experimental data) by the thickness of the porous zone: call this A

2 - Using excel, I plotted A vs. velocity and ask to have the alfa e beta coefficient for the tendency line.

3 - in the fvOptionDict I set these values for alfa & beta for the FixedCoeff model.
Code:
porosity1
{
    type          explicitPorositySource;
    active        true; //yes;
    selectionMode cellZone;
    cellZone      porous;

    explicitPorositySourceCoeffs
    {
        type fixedCoeff;

        fixedCoeffCoeffs
        {
              alpha    alpha [0 0 -1 0 0 0 0] (25000 25000 25000); //linear term
              beta     beta [0 -1 0 0 0 0 0] (10000 10000 10000); //squared term
              coordinateSystem
              {
        type cartesian;
        origin (1.005 0.25 0);
        rho 1.205;
        coordinateRotation
                 {   
             type axesRotation;
             e1    (1 0 0);
                 e2    (0 1 0);
             //e3    (0 0 1);
         }
              }
        }
    }
 
}
4 - CFD model has been modelled with a porous zone with the same thickness of porous zone of above

Post-processing the results I had the matching between the experimental and numerical results (within a small tolerance).

Hope this can help.

Regards
Bahram and shizuka like this.
student666 is offline   Reply With Quote

Old   February 12, 2018, 01:54
Default
  #8
Member
 
Ramana
Join Date: Jul 2017
Location: India
Posts: 58
Rep Power: 9
svramana is on a distinguished road
Quote:
Originally Posted by student666 View Post
Hi all,

I don't know why, but the DarcyForchHeimer model didn't work for me.

I found this useful link:
http://www.geocities.co.jp/SiliconVa...fvOptions.html

and by changing model to FixedCoeff, I was able to solve my problem.

Anyway, these are the steps I performed to test the model on a simple case: a straight 2D channel of constant section with a predefined thickness for the porous zone.

1 - I divided pressure losses (experimental data) by the thickness of the porous zone: call this A

2 - Using excel, I plotted A vs. velocity and ask to have the alfa e beta coefficient for the tendency line.

3 - in the fvOptionDict I set these values for alfa & beta for the FixedCoeff model.
Code:
porosity1
{
    type          explicitPorositySource;
    active        true; //yes;
    selectionMode cellZone;
    cellZone      porous;

    explicitPorositySourceCoeffs
    {
        type fixedCoeff;

        fixedCoeffCoeffs
        {
              alpha    alpha [0 0 -1 0 0 0 0] (25000 25000 25000); //linear term
              beta     beta [0 -1 0 0 0 0 0] (10000 10000 10000); //squared term
              coordinateSystem
              {
        type cartesian;
        origin (1.005 0.25 0);
        rho 1.205;
        coordinateRotation
                 {   
             type axesRotation;
             e1    (1 0 0);
                 e2    (0 1 0);
             //e3    (0 0 1);
         }
              }
        }
    }
 
}
4 - CFD model has been modelled with a porous zone with the same thickness of porous zone of above

Post-processing the results I had the matching between the experimental and numerical results (within a small tolerance).

Hope this can help.

Regards
Hi,
I want to simulate flow and heat transfer from porous square cylinder to a flowing wind.

I have defined the porous cylinder as porous blockage( similar to the one in PisoFaom tutorial) and now i want to modify the governing equation to make a user-defined solver.

In predefined solver for porous media i.e PorousSimplefoam,There is no time derivative (as it is a steady state solver )and there is no entry to read porosity.

I have few questions regarding momentum and energy equations

1). How and where to define porosity (1 for fluid region & (0<porosity<1) for porous zone) as i am using single domain approach(single set of governing equations are utilized to solve both fluid and porous zones).

2). what are the modifications required in momentum equation to include porosity effect in it.

2). Can i have access to your case files.the above link is not working
Thanks in advance,

Reagrds,
S.V.Ramana
svramana is offline   Reply With Quote

Old   February 12, 2018, 07:44
Default
  #9
Senior Member
 
M. C.
Join Date: May 2013
Location: Italy
Posts: 286
Blog Entries: 6
Rep Power: 17
student666 is on a distinguished road
Hi, the files are gone. But if I remember well, i used a fvOptions dict, as even for my case i had only one domain (fluid).
Regards
student666 is offline   Reply With Quote

Old   February 12, 2018, 09:01
Default
  #10
Member
 
Ramana
Join Date: Jul 2017
Location: India
Posts: 58
Rep Power: 9
svramana is on a distinguished road
Quote:
Originally Posted by student666 View Post
Hi, the files are gone. But if I remember well, i used a fvOptions dict, as even for my case i had only one domain (fluid).
Regards
Hi,
I think i am doing similar kind of simulation.In my simulation i have defined the porous cylinder as blockage and assigned porous resistance through Darcy-forchheimer coefficients.

In predefined solver for porous media i.e PorousSimpleFoam,There is no time derivative (as it is a steady state solver )and there is no entry to read porosity.

I have a query regarding momentum and energy equations

1). How and where to define porosity (1 for fluid region & (0<porosity<1) for porous zone) as i am using single domain approach(single set of governing equations are utilized to solve both fluid and porous zones).

I have defined porosity values in my porosityDict in "constant" folder , and porosity Index in "0" folder in my case but i don't know how to read these values in solverporosityDict.png

i am new to OF ,i will be glad if you can help me to resolve this issue.

Regards,
S.V.Ramana
svramana is offline   Reply With Quote

Old   February 12, 2018, 15:24
Default
  #11
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 15
clapointe is on a distinguished road
Check out this tutorial -- https://github.com/OpenFOAM/OpenFOAM...htDuctImplicit. The solver, porousSimpleFoam, will read the properties from the porousProperties dictionary in the constant folder.
clapointe is offline   Reply With Quote

Old   February 14, 2018, 04:40
Default
  #12
Member
 
Ramana
Join Date: Jul 2017
Location: India
Posts: 58
Rep Power: 9
svramana is on a distinguished road
Quote:
Originally Posted by clapointe View Post
Check out this tutorial -- https://github.com/OpenFOAM/OpenFOAM...htDuctImplicit. The solver, porousSimpleFoam, will read the properties from the porousProperties dictionary in the constant folder.
Hi,
Thanks for the quick reply.The above file reads Darcy-Forchheimer coefficients and not porosity values.

Regards,
S.V.Ramana
svramana is offline   Reply With Quote

Old   February 14, 2018, 10:49
Default
  #13
Senior Member
 
Join Date: Aug 2015
Posts: 494
Rep Power: 15
clapointe is on a distinguished road
If you know the porosity, you should be able to estimate the Darcy coefficient. The Forchheimer coefficient can initially be set to zero.
clapointe is offline   Reply With Quote

Old   February 21, 2018, 08:54
Default
  #14
Member
 
Anurag
Join Date: Aug 2014
Location: Germany
Posts: 57
Rep Power: 12
anuragm is on a distinguished road
You can use any solver that has support for fvOptions (not all solvers support it). In the fvOptions dictionary included below, for example, you can specify a source called as "porosity1" for the cellzone named "porous". This zone has to be defined in your mesh using the topoSet utility and an accompaying dictionary.

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  4.1                                   |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "constant";
    object      fvOptions;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

porosity1
{
    type            explicitPorositySource;
    active          yes;

    explicitPorositySourceCoeffs
    {
        selectionMode   cellZone;
        cellZone        porous;

        type            DarcyForchheimer;

        DarcyForchheimerCoeffs
        {
            d   d [0 -2 0 0 0 0 0] (5.7e6 5.7e6 5.7e6);
            f   f [0 -1 0 0 0 0 0] (2.3 2.3 2.3);
            coordinateSystem
            {
                type    cartesian;
                origin  (0 0 0);
                coordinateRotation
                {
                    type    axesRotation;
                    e1  (1 0 0);
                    e2  (0 1 0);
                }
            }
        }
    }
}
//************************************************************************* //
anuragm is offline   Reply With Quote

Reply


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



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