|
[Sponsors] |
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: 17 |
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: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
Quote:
|
||
June 28, 2010, 13:05 |
|
#4 |
Member
Robertas N.
Join Date: Mar 2009
Location: Kaunas, Lithuania
Posts: 53
Rep Power: 17 |
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<fvVectorMatrix> 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; 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. |
|
June 29, 2010, 03:53 |
|
#5 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 |
Quote:
|
||
April 15, 2012, 17:26 |
|
#6 | |
New Member
Honey
Join Date: Mar 2011
Location: Dmg
Posts: 23
Rep Power: 15 |
Quote:
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, 18:22 |
|
#7 | ||
Senior Member
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17 |
Hi
Quote:
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:
Regards Hisham |
|||
April 18, 2012, 09:51 |
|
#8 |
Member
Robertas N.
Join Date: Mar 2009
Location: Kaunas, Lithuania
Posts: 53
Rep Power: 17 |
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, 11:43 |
|
#9 |
Senior Member
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17 |
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<class Type> 00032 void Foam::myPorousZone::modifyDdt(fvMatrix<Type>& 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 |
|
April 18, 2012, 13:53 |
|
#10 | |
Member
Robertas N.
Join Date: Mar 2009
Location: Kaunas, Lithuania
Posts: 53
Rep Power: 17 |
Quote:
|
||
June 6, 2014, 09:46 |
Porosity in OpenFOAM 2.3.0
|
#11 |
Member
santhosh
Join Date: Apr 2009
Location: India
Posts: 70
Rep Power: 17 |
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, 20:37 |
|
#12 |
New Member
Vitor Geraldes
Join Date: Dec 2009
Location: Lisbon, Portugal
Posts: 26
Rep Power: 16 |
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, 01:11 |
|
#13 |
Member
santhosh
Join Date: Apr 2009
Location: India
Posts: 70
Rep Power: 17 |
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.
|
|
May 18, 2020, 11:05 |
|
#14 |
Senior Member
Alejandro
Join Date: Jan 2014
Location: Argentina
Posts: 128
Rep Power: 12 |
Can u share your implementation? Do u have it for a newer version of OpenFOAM?
|
|
July 19, 2020, 11:31 |
|
#15 |
New Member
Armin Alavi
Join Date: May 2019
Location: Tehran
Posts: 22
Rep Power: 7 |
Hello Foamers
I used explicitPorosity fvOption to model porous media in compresibleInterFoam solver. I wonder how I could define D (Darcy coefficient) so that it is a function of alpha.liquid. Technically I want D coefficient to be different in cells that contain liquid from ones that contain gas. Any suggestions would be highly appreciated. Armin |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to write k and epsilon before the abnormal end | xiuying | OpenFOAM Running, Solving & CFD | 8 | August 27, 2013 16:33 |
[blockMesh] BlockMeshmergePatchPairs | hjasak | OpenFOAM Meshing & Mesh Conversion | 11 | August 15, 2008 08:36 |
Convergence moving mesh | lr103476 | OpenFOAM Running, Solving & CFD | 30 | November 19, 2007 15:09 |
IcoFoam parallel woes | msrinath80 | OpenFOAM Running, Solving & CFD | 9 | July 22, 2007 03:58 |
Could anybody help me see this error and give help | liugx212 | OpenFOAM Running, Solving & CFD | 3 | January 4, 2006 19:07 |