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

Inhomogeneous Porous Media

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 10, 2014, 12:03
Default Inhomogeneous Porous Media
  #1
New Member
 
Marco
Join Date: Nov 2014
Location: Germany
Posts: 14
Rep Power: 11
mkiewat is on a distinguished road
I want to define a source term field via the fvOptions on the rhs of a momentum equation. I know my porous intertial and viscous resistance tensor as a function of space dimensions: D_.value(x,y) and F_.value(x,y), so in each cell, the resulting resistance tensor has different values. How could I create a tensor field, that I can hand over to the momentum equation? Is it possible to create a function that will fill the tensorField? E.g. where could I define something like this, preferably without having to recompile the solver:

Code:
porosity1 
{ 
    type          explicitPorositySource; 
    active        yes; 
    selectionMode cellZone; 
    cellZone      porosity; 

    explicitPorositySourceCoeffs 
    { 
        type DarcyForchheimer; 

        DarcyForchheimerCoeffs 
        {  
        forAll(cells,i)
            {
            d.value[i].xx = 12.34*cells[i].coordinates.x
            d.value[i].yy = 43.21*cells[i].coordinates.y+2
            d.value[i].zz = 1e6
            f.value[i].xx = 4.567*cells[i].coordinates.x
            f.value[i].yy = 654.3*cells[i].coordinates.y+6
            f.value[i].zz = 1e6
            }
       
        coordinateSystem 
               { 
               e1    (1 0 0); 
               e2    (0 1 0); 
               } 
        } 
    } 
}
any ideas?
mkiewat is offline   Reply With Quote

Old   March 3, 2015, 10:52
Default
  #2
New Member
 
Marco
Join Date: Nov 2014
Location: Germany
Posts: 14
Rep Power: 11
mkiewat is on a distinguished road
Ok, i found the solution to my problem. I modified the original DarcyForchheimerTemplates.C file and added a function that returns the coefficients based on some of the flow parameters in each cell (http://foam.sourceforge.net/docs/cpp/a04765_source.html).

Code:
forAll(cellZoneIDs_, zoneI)
{
        const labelList& cells = mesh_.cellZones()[cellZoneIDs_[zoneI]];
        forAll(cells, i)
       {
            const label cellI = cells[i];
            //coordinates of the cell
            const scalar params.xCoor = mesh_.C().component(vector::X)()[cellI];
            const scalar params.yCoor = mesh_.C().component(vector::Y)()[cellI];
            //Volume averaged velocity of the cell
            const scalar params.ux = mag(Uv.internalField()[cellI].x())*alphav.internalField()[cellI] + mag(Ul.internalField()[cellI].x())*(1-alphav.internalField()[cellI]);
            const scalar params.uy = mag(Uv.internalField()[cellI].y())*alphav.internalField()[cellI] + mag(Ul.internalField()[cellI].y())*(1-alphav.internalField()[cellI]);
 
            const tensor Cd = Functions::calcCd(params);
            const scalar isoCd = tr(Cd);
            Udiag[cellI] += V[cellI]*isoCd;
            Usource[cellI] -= V[cellI]*((Cd - I*isoCd) & U[cellI]);
       }
}
Maybe this is helpful for someone else that is trying to do the same kind of stuff.
mkiewat is offline   Reply With Quote

Old   March 3, 2015, 10:59
Default
  #3
New Member
 
Marco
Join Date: Nov 2014
Location: Germany
Posts: 14
Rep Power: 11
mkiewat is on a distinguished road
Now, another thing that I dont't really understand:
Can someone explain what the sense behind this method of adding the source term is?
Code:
Udiag[cellI] += V[cellI]*isoCd;
Usource[cellI] -= V[cellI]*((Cd - I*isoCd) & U[cellI]);
Also from DarcyForchheimerTemplates.C (http://foam.sourceforge.net/docs/cpp/a04765_source.html). Can anybody tell what this second function "apply" is for and what the tensor field "AU" is?
Code:
(template<class RhoFieldType>
void Foam::porosityModels::DarcyForchheimer::apply
 
tensorField& AU,
const RhoFieldType& rho,
const scalarField& mu,
const vectorField& U
)
mkiewat is offline   Reply With Quote

Old   July 16, 2016, 15:05
Default
  #4
New Member
 
exw599
Join Date: Jan 2016
Posts: 6
Rep Power: 10
exw599 is on a distinguished road
Quote:
Originally Posted by mkiewat View Post
Ok, i found the solution to my problem. I modified the original DarcyForchheimerTemplates.C file and added a function that returns the coefficients based on some of the flow parameters in each cell (http://foam.sourceforge.net/docs/cpp/a04765_source.html).

Code:
forAll(cellZoneIDs_, zoneI)
{
        const labelList& cells = mesh_.cellZones()[cellZoneIDs_[zoneI]];
        forAll(cells, i)
       {
            const label cellI = cells[i];
            //coordinates of the cell
            const scalar params.xCoor = mesh_.C().component(vector::X)()[cellI];
            const scalar params.yCoor = mesh_.C().component(vector::Y)()[cellI];
            //Volume averaged velocity of the cell
            const scalar params.ux = mag(Uv.internalField()[cellI].x())*alphav.internalField()[cellI] + mag(Ul.internalField()[cellI].x())*(1-alphav.internalField()[cellI]);
            const scalar params.uy = mag(Uv.internalField()[cellI].y())*alphav.internalField()[cellI] + mag(Ul.internalField()[cellI].y())*(1-alphav.internalField()[cellI]);
 
            const tensor Cd = Functions::calcCd(params);
            const scalar isoCd = tr(Cd);
            Udiag[cellI] += V[cellI]*isoCd;
            Usource[cellI] -= V[cellI]*((Cd - I*isoCd) & U[cellI]);
       }
}
Maybe this is helpful for someone else that is trying to do the same kind of stuff.
Hi mkiewat,

I am facing a similar problem like you, I need to simulate the flow past the porous media where permeability is not uniform over space. "DarcyForchheimerTemplates.C" is in src folder, are there any other solutions to this problem? Because as I know if you change the source code you have to recompile it which is not so easy for me.

Cheers
exw599 is offline   Reply With Quote

Old   December 16, 2020, 13:33
Default
  #5
Senior Member
 
alberto
Join Date: Apr 2016
Location: Mexico
Posts: 117
Rep Power: 10
dewey is on a distinguished road
Hi,


Did you find a way to use a permeability dependent position?
dewey is offline   Reply With Quote

Reply

Tags
fvoptions, porous domain, porous media, porous modellling


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
Multiphase Porous Media Flow - Convergence Issues VT_Bromley FLUENT 7 May 14, 2020 16:34
Porous media setup issues in Fluent Bernard Van FLUENT 29 January 26, 2017 04:09
How to model granular flow through porous media Axius FLUENT 2 August 7, 2014 10:34
species mass source in porous media ? PK FLUENT 0 February 16, 2007 11:12
porous media: Fluent or Star-CD? Igor Main CFD Forum 0 December 5, 2002 15:16


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