# Inhomogeneous Porous Media

 Register Blogs Members List Search Today's Posts Mark Forums Read November 10, 2014, 13:03 Inhomogeneous Porous Media #1 New Member   Marco Join Date: Nov 2014 Location: Germany Posts: 14 Rep Power: 9 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?    March 3, 2015, 11:52 #2 New Member   Marco Join Date: Nov 2014 Location: Germany Posts: 14 Rep Power: 9 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.   March 3, 2015, 11:59 #3 New Member   Marco Join Date: Nov 2014 Location: Germany Posts: 14 Rep Power: 9 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 void Foam::porosityModels::DarcyForchheimer::apply tensorField& AU, const RhoFieldType& rho, const scalarField& mu, const vectorField& U )```   July 16, 2016, 16:05 #4
New Member

exw599
Join Date: Jan 2016
Posts: 5
Rep Power: 7 Quote:
 Originally Posted by mkiewat 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   December 16, 2020, 14:33 #5 Senior Member   alberto Join Date: Apr 2016 Location: Mexico Posts: 112 Rep Power: 7 Hi, Did you find a way to use a permeability dependent position?  Tags fvoptions, porous domain, porous media, porous modellling Thread Tools Search this Thread Show Printable Version Email this Page Search this Thread: Advanced Search Display Modes Linear Mode Switch to Hybrid Mode Switch to Threaded 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 Off Pingbacks are On Refbacks are On Forum Rules Similar Threads Thread Thread Starter Forum Replies Last Post VT_Bromley FLUENT 7 May 14, 2020 17:34 Bernard Van FLUENT 29 January 26, 2017 05:09 Axius FLUENT 2 August 7, 2014 11:34 PK FLUENT 0 February 16, 2007 12:12 Igor Main CFD Forum 0 December 5, 2002 16:16

All times are GMT -4. The time now is 09:16.