# Local porosity

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 LinkBack Thread Tools Display Modes
 January 26, 2010, 04:09 Local porosity #1 New Member   Sergei D. Join Date: Mar 2009 Posts: 4 Rep Power: 0 Hello. Please, give me hints about how to calculate a local porosity with OpenFOAM? I.e. I have a file with coordinates and radii of spherers and I want to map the spheres to a mesh, then calculate volume of spheres for each mesh cell and divide the cell volume by the volume of spheres in a given cell. Thanks.

 March 22, 2010, 07:31 #2 Member   Robertas N. Join Date: Mar 2009 Location: Kaunas, Lithuania Posts: 53 Rep Power: 10 I have a similar question - how to assign porosity values for each cell of the mesh individually and be able to modify it during the runtime. It seems that currently the porosity can be assigned to each porous zone, and each zone contains a number of cells. It would be nice to (re)use the functionality provided by the porousZone class, but to be able to create and destroy the porous zones at runtime, and to add and remove the cells from the appropriate porous zones as needed. Is this approach reasonable? Or can somebody propose a better way? From the existing solvers in OF 1.6, are rhoPorousSimpleFoam and porousExplicitSourceReactingParcelFoam the only ones dealing with porosity? It seems that only the latter is able to treat the porosity, as defined by Se9a (volume ratio), because rhoPorousSimpleFoam is steady state and does not contain the terms with the temporal derivatives.

March 23, 2010, 11:24
#3
Senior Member

Mark Olesen
Join Date: Mar 2009
Location: http://olesenm.github.io/
Posts: 802
Rep Power: 21
Quote:
 Originally Posted by r08n I have a similar question - how to assign porosity values for each cell of the mesh individually and be able to modify it during the runtime. It seems that currently the porosity can be assigned to each porous zone, and each zone contains a number of cells. It would be nice to (re)use the functionality provided by the porousZone class, but to be able to create and destroy the porous zones at runtime, and to add and remove the cells from the appropriate porous zones as needed. Is this approach reasonable? Or can somebody propose a better way?
While it would understandable be nice to reuse the existing porosity treatment, it sounds like what you need is much, much more general -- a field of porosity coefficients covering the entire calculation domain.

 June 28, 2010, 12:05 #4 Member   Robertas N. Join Date: Mar 2009 Location: Kaunas, Lithuania Posts: 53 Rep Power: 10 Looking at the implementation of Foam:orousZone::modifyDdt, it seems that this function simply multiplies the matrix resulting from discretisation of the temporal derivative by the porosity. I wonder, is it reasonable (correct) to use a simple mimesis and rewrite the momentum equation like this, to include the cell-dependent porosity (using porousExplicitSourceReactingParcelFoam, 'UEqn.H', as the basis): Code: fvVectorMatrix UEqn ( fvm::div(phi, U) + turbulence->divDevRhoReff(U) == rho.dimensionedInternalField()*g //+ parcels.SU() ); tmp tmp_ddt = fvm::ddt (rho, U); forAll (mesh.cells(), i) { tmp_ddt().diag ()[i] *= gamma [i]; tmp_ddt().source ()[i] *= gamma [i]; } UEqn += tmp_ddt; Here, 'gamma' is a scalar field of porosity (0 <= gamma <= 1.0). Can it be implemented in such a simple way, or did I overlook something? I haven't tested this yet, but at least this block compiles and doesn't crash when running. mm.abdollahzadeh likes this.

June 29, 2010, 02:53
#5
Senior Member

Mark Olesen
Join Date: Mar 2009
Location: http://olesenm.github.io/
Posts: 802
Rep Power: 21
Quote:
 Originally Posted by r08n Looking at the implementation of Foam:orousZone::modifyDdt, it seems that this function simply multiplies the matrix resulting from discretisation of the temporal derivative by the porosity. I wonder, is it reasonable (correct) to use a simple mimesis and rewrite the momentum equation like this, to include the cell-dependent porosity (using porousExplicitSourceReactingParcelFoam, 'UEqn.H', as the basis): Code: fvVectorMatrix UEqn ( fvm::div(phi, U) + turbulence->divDevRhoReff(U) == rho.dimensionedInternalField()*g //+ parcels.SU() ); tmp tmp_ddt = fvm::ddt (rho, U); forAll (mesh.cells(), i) { tmp_ddt().diag ()[i] *= gamma [i]; tmp_ddt().source ()[i] *= gamma [i]; } UEqn += tmp_ddt; Here, 'gamma' is a scalar field of porosity (0 <= gamma <= 1.0). Can it be implemented in such a simple way, or did I overlook something? I haven't tested this yet, but at least this block compiles and doesn't crash when running.
If you are only taking care of the temporal terms, this should work fine, but of course doesn't handle any of the porous resistances at all.

April 15, 2012, 16:26
#6
New Member

Honey
Join Date: Mar 2011
Location: Dmg
Posts: 19
Rep Power: 8
Quote:
 Originally Posted by r08n Looking at the implementation of Foam:orousZone::modifyDdt, it seems that this function simply multiplies the matrix resulting from discretisation of the temporal derivative by the porosity. I wonder, is it reasonable (correct) to use a simple mimesis and rewrite the momentum equation like this, to include the cell-dependent porosity (using porousExplicitSourceReactingParcelFoam, 'UEqn.H', as the basis): Code: fvVectorMatrix UEqn ( fvm::div(phi, U) + turbulence->divDevRhoReff(U) == rho.dimensionedInternalField()*g //+ parcels.SU() ); tmp tmp_ddt = fvm::ddt (rho, U); forAll (mesh.cells(), i) { tmp_ddt().diag ()[i] *= gamma [i]; tmp_ddt().source ()[i] *= gamma [i]; } UEqn += tmp_ddt; Here, 'gamma' is a scalar field of porosity (0 <= gamma <= 1.0). Can it be implemented in such a simple way, or did I overlook something? I haven't tested this yet, but at least this block compiles and doesn't crash when running.

The porosity values for my problem is as a function of x, y, & z. So, I am willing to give porosity at every cells separately.

You have posted the code to do so but unfortunately I have understood 50% of it since I have just started to learn OF. However, here comes my questions:
1) where you able to run your code and assign different porosity at every cell?

2)How to give porosities at each individual cell as an input file for OF?

3) If I understood it correctly, OF calculates the centered value at every cell. Now, if we can introduce the porosity at each individual cell to the OF, shall it be centered value or can even be nodal values?

I look forward for some help,

Thank you very much & with best regards.

April 15, 2012, 17:22
#7
Senior Member

Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 253
Blog Entries: 10
Rep Power: 10
Hi

Quote:
 Originally Posted by Honey 2)How to give porosities at each individual cell as an input file for OF?
If the porosity is defined as a volScalarField, it is easy to use the funkySetFiellds utility to set initial values of porosity according to a given expression.
I do not know whether it is possible to do that with the codeStream feature. It would be great if anyone would elaborate on that!
Quote:
 Originally Posted by Honey 3) If I understood it correctly, OF calculates the centered value at every cell. Now, if we can introduce the porosity at each individual cell to the OF, shall it be centered value or can even be nodal values?
Again if the porosity is declared as a volScalarField, the values will be at cell centers (where integration occurs) and there will be other scalar fields that store values for faces of patches (useful if you need the variable in the BC calculations!)

Regards
Hisham

 April 18, 2012, 08:51 #8 Member   Robertas N. Join Date: Mar 2009 Location: Kaunas, Lithuania Posts: 53 Rep Power: 10 On a related note: why is porous media defined as porousZone, not as a scalar field? Introducing a field (rather than a zone) would be more flexible, allow for runtime modifications (moving porous zones, coupling with discrete phase, etc.) and definitions using standard field manipulation utilities. But, probably, there are reasons for the current implementation. I ask this because I used the sources with some modifications in the porosity treatment and I want to know that mistakes can be made in doing so.

 April 18, 2012, 10:43 #9 Senior Member     Hisham Elsafti Join Date: Apr 2011 Location: Braunschweig, Germany Posts: 253 Blog Entries: 10 Rep Power: 10 Hi r08n, As Olesen mentioned, if you have no need to update resistance according to change in porosity, then your approach is fine. The current implementation allows for introducing several porous media models to the same simulation. To allow for varying porosity across the domain, one would need to: 1. Change the porousZone class a little bit, therefor one needs to make a new copy (say myPorousZone or varPorosityPorousZone) [Follow steps in chapter 3 of the user's manual]. Simply copy paste porousMedia directory rename every thing including the options & files inside the Make directory. 5. In myPorousZoneTemplates.C: Code: template 00032 void Foam::myPorousZone::modifyDdt(fvMatrix& m) const 00033 { volScalarField myPorosity_ ( IOobject ( "myPorosity", runTime.constant(), /* myPorosity file needed in constant directory */ mesh_, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh_ ); 00034 //if (porosity_ < 1) 00035 { 00036 forAll(cellZoneIds_, zoneI) 00037 { 00038 const labelList& cells = mesh_.cellZones()[cellZoneIds_[zoneI]]; 00039 00040 forAll(cells, i) 00041 { if(myPorosity_[i] < 0) {Info << "Fatal error: myPorosity_ < 0" << endl; exit(-1)} 00042 m.diag()[cells[i]] *= myPorosity_[i]; 00043 m.source()[cells[i]] *= myPorosity_[i]; 00044 } 00045 } 00046 } 00047 } Hope this helps! It is not tested so errors (bugs) will happen but they can be fixed! The myPorosity file must be in the constant directory (you can try other options like the time directories) You can set values in the myPorosity file using funkySetFields as mentioned above Regards, Hisham mm.abdollahzadeh likes this.

April 18, 2012, 12:53
#10
Member

Robertas N.
Join Date: Mar 2009
Location: Kaunas, Lithuania
Posts: 53
Rep Power: 10
Quote:
 Originally Posted by Hisham 5. In myPorousZoneTemplates.C: Code: template 00032 void Foam::myPorousZone::modifyDdt(fvMatrix& m) const 00033 { volScalarField myPorosity_ ( IOobject ( "myPorosity", runTime.constant(), /* myPorosity file needed in constant directory */ mesh_, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh_ ); 00034 //if (porosity_ < 1) 00035 { 00036 forAll(cellZoneIds_, zoneI) 00037 { 00038 const labelList& cells = mesh_.cellZones()[cellZoneIds_[zoneI]]; 00039 00040 forAll(cells, i) 00041 { if(myPorosity_[i] < 0) {Info << "Fatal error: myPorosity_ < 0" << endl; exit(-1)} 00042 m.diag()[cells[i]] *= myPorosity_[i]; 00043 m.source()[cells[i]] *= myPorosity_[i]; 00044 } 00045 } 00046 } 00047 }
Thanks for suggestion. This is a useful extension to the porousZone class -- setting porosity as a field rather than as a constant. This can be probably used for other relevant parameters, like Darcy-Forchheimer coefficients, etc.

 June 6, 2014, 08:46 Porosity in OpenFOAM 2.3.0 #11 Member   santhosh Join Date: Apr 2009 Location: India Posts: 70 Rep Power: 10 Hi, In the OpenFOAM 2.3.0, Where we can set the value of porosity. If I am not wrong, whole porous media treatment is modified and I cannot see the modifyDdt in the source folder where it contained the "\gamma" term which denotes the porosity. I tried mentioning the "\gamma" value in the constant/porosityProperties dictionary but doesn't seems to honored. Is there any way to mention the porosity value in the OpenFOAM 2.3.0 Thanks in advance.

 April 8, 2016, 19:37 #12 New Member   Vitor Geraldes Join Date: Dec 2009 Location: Lisbon, Portugal Posts: 20 Rep Power: 9 Taking intro account the vectorial nature of fvVectorMatrix, why tmp_ddt().diag() is a scalar instead of a vector? Is there also a simple way to incorporate directly in the matrix a local anisotropic permeability?

 April 10, 2016, 00:11 #13 Member   santhosh Join Date: Apr 2009 Location: India Posts: 70 Rep Power: 10 I realized that porosity is included in the D term. It is the ratio of porosity to the permeability. Also, fvPatch functionality is very generic to add source term to most of the openfoam solvers. Currently I have used interfoam along with fvPatch to simulate Multiphase flow through porous media.

 Thread Tools Display Modes Linear Mode

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

 Similar Threads Thread Thread Starter Forum Replies Last Post xiuying OpenFOAM Running, Solving & CFD 8 August 27, 2013 15:33 hjasak OpenFOAM Native Meshers: blockMesh 11 August 15, 2008 07:36 lr103476 OpenFOAM Running, Solving & CFD 30 November 19, 2007 15:09 msrinath80 OpenFOAM Running, Solving & CFD 9 July 22, 2007 02:58 liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 19:07

All times are GMT -4. The time now is 23:58.

 Contact Us - CFD Online - Privacy Statement - Top