CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   help adding the energy equation to porousinterfoam using the enthalpy formulation (http://www.cfd-online.com/Forums/openfoam-programming-development/114362-help-adding-energy-equation-porousinterfoam-using-enthalpy-formulation.html)

help adding the energy equation to porousinterfoam using the enthalpy formulation

Hello All,

I am adding the enrgy equation to porousinterfoam using the enthalpy formulation. So for my conductivity calculation, i need to multiply each material conductivity with the cell porosity.

I search around to find out how to use the cell porosity but I didn't have any luck, so please can anyone lead me with his or her suggestions?

Thank you all,

 Natalie2210 May 13, 2013 05:30

Hi!

I'm afraid I cannot help you with your original question but I wonder whether you tried some simple cases with porousInterFoam?

for example, if a so-called "rectilinear flow" is considered which is basically a 1D flow (imagine a rectangle where you have the inlet on the left hand side and the outlet on the right) there is an analytical solution to the flow front progression,

xf = sqrt(2*K*P0*t/(mu*eps))

where xf denotes the flow front progression, K the permeability of the porous medium, P0 the injection pressure, mu the viscosity in Pa*s and eps the porosity.

Now, as far as I have gleaned, the porosity eps is not taken into account when using the porousInterFoam solver but even if I assume eps=1, the solver does not yield correct results. Have you /has anyone experienced this problem?

There have been some discussions last year to that topic and I also found a debugged version of the porousInterFoam solver (http://sourceforge.net/apps/mantisbt...iew.php?id=129) which should repair the problem of not taking the porosity into account. I'm trying to compile this debugged version and I will let you know whether this fixes the problem I described above, but still, I'm curious of your experiences with porousInterFoam.

Greetings, Natalie

 Cyp May 13, 2013 07:47

Quote:
 Originally Posted by Natalie2210 (Post 427127) Hi! I'm afraid I cannot help you with your original question but I wonder whether you tried some simple cases with porousInterFoam? for example, if a so-called "rectilinear flow" is considered which is basically a 1D flow (imagine a rectangle where you have the inlet on the left hand side and the outlet on the right) there is an analytical solution to the flow front progression, xf = sqrt(2*K*P0*t/(mu*eps)) where xf denotes the flow front progression, K the permeability of the porous medium, P0 the injection pressure, mu the viscosity in Pa*s and eps the porosity. Now, as far as I have gleaned, the porosity eps is not taken into account when using the porousInterFoam solver but even if I assume eps=1, the solver does not yield correct results. Have you /has anyone experienced this problem? There have been some discussions last year to that topic and I also found a debugged version of the porousInterFoam solver (http://sourceforge.net/apps/mantisbt...iew.php?id=129) which should repair the problem of not taking the porosity into account. I'm trying to compile this debugged version and I will let you know whether this fixes the problem I described above, but still, I'm curious of your experiences with porousInterFoam. Greetings, Natalie

Actually, porousInterFoam does not simulate two phase flow in porous media, expect in some very special cases (as the Hele-Shaw cells). This solver is not consistent with the two-phase flow physic in porous media.

You have to keep in mind that porous media laws are in fact averaged equations. That means that in one cell of the mesh, you have both fluid and solid, even if this latter is not physically represented. In two-phase flow through porous material, we use the concept of saturation S, which is the rate of liquid over the void space volume of the cell. Basically, S varyies on the range [0,1].

The problem with porousInterFoam, is that this solver is just a VOF solver with additionnal resistance source terms. With that solver, the saturation does not exist and the phase indicator is either equal to 0 or 1. You can't have value in between (for exemple, S=0.4 means that the void space of a cell is filled by 40% liquid and 60% gas). So, in my opinion, this solver has absolutely no meanings.

I think the right solution is to program a solver based on IMPES method (see a presentation I made at OFW7 for additionnal details).

Best regards,
Cyp

 ngj May 13, 2013 15:51

Hi Cyp,

Please allow me to disagree, since I exactly know the debugged version that Natalie referred to, as I myself posted that particular report. The debugged version corrects for the previous error that computational cells with a solid present did not fill faster than cells without a solid.

The solution to this error was straight forward, because MULES was actually prepared to this type of flows, though the interface was not utilised in porousInterFoam.

We had a master student, who tested the solver and he obtained good results in comparison with experimental data for coastal engineering size problems (dimensions of many meters in each direction).

Kind regards,

Niels

P.S. There has not been a response to the bug report, since the error is still present in version 2.2.0.

 Cyp May 13, 2013 15:56

Quote:
 Originally Posted by ngj (Post 427258) Hi Cyp, Please allow me to disagree, since I exactly know the debugged version that Natalie referred to, as I myself posted that particular report. The debugged version corrects for the previous error that computational cells with a solid present did not fill faster than cells without a solid. The solution to this error was straight forward, because MULES was actually prepared to this type of flows, though the interface was not utilised in porousInterFoam. We had a master student, who tested the solver and he obtained good results in comparison with experimental data for coastal engineering size problems (dimensions of many meters in each direction). Kind regards, Niels P.S. There has not been a response to the bug report, since the error is still present in version 2.2.0.

Yes, but with porousInterFoam, even with the debugged version, you can't have gas AND liquid in the same cell, can you ?

 ngj May 13, 2013 16:07

Hi Cyp,

I have just gone through your presentation, and I now understand what you mean. For your problems, where the saturation is of importance, then porousInterFoam will not work, because the two fluids are considered as immiscible.

For coastal engineering problems, however, where there is a pretty clear interface between air and water, capillary effects can largely be neglected in man made structure and grain sizes are say 10 cm or larger, porousInterFoam does a pretty good job.

I have tried reading the posts by Nadine and Natalie, however, it is a bit unclear to me, which effects are of importance to them.

All the best,

Niels

 Natalie2210 May 14, 2013 03:07

Hi!

Thank you all for your replies!
@Cyp: I'm afraid I cannot find the presentation you referred to, could you post a link? Although I think, I know the concept of introducing the saturation S as an independent variable. However, in my case, I can assume that the interface is sharp without taking capillary effects into account, so it sounds to me as if the debugged version of the porousInterFoam solver would solve my problem :-)

@Niels: Great to "meet" you in person! I have tried to compile your debugged version of the porousInterFoam solver, but I'm running into some problems. It is to say I am quite new to OpenFoam and thats the first additional piece of code I'm trying to compile. However, here is what I do and get:

I'm using OpenFoam version 2.1.1 on Ubuntu 12.04. I have downloaded your file and put the entire directory "debuggedPorousInterFoam" into

wmake debuggedPorousInterFoam to the file Allwmake in \$FOAM_INST_DIR/applications/multiphase/interFoam .

Running Allwmake, I get the following errors when it comes to compiling the debuggedPorousInterFoam solver:

+ wmake debuggedPorousInterFoam
In file included from /home/openfoam/TryoutOF/openfoam211/applications/solvers/multiphase/interFoam/createFields.H:96:0,
from debuggedPorousInterFoam.C:60:
/home/openfoam/TryoutOF/openfoam211/src/finiteVolume/lnInclude/readGravitationalAcceleration.H: In function ‘int main(int, char**)’:
/home/openfoam/TryoutOF/openfoam211/src/finiteVolume/lnInclude/readGravitationalAcceleration.H:5:9: error: redeclaration of ‘Foam::uniformDimensionedVectorField g’
/home/openfoam/TryoutOF/openfoam211/src/finiteVolume/lnInclude/readGravitationalAcceleration.H:2:35: error: ‘Foam::uniformDimensionedVectorField g’ previously declared here
In file included from debuggedPorousInterFoam.C:61:0:
createPorousZones.H:21:45: error: ‘class Foam::porousZone’ has no member named ‘zoneId’
In file included from debuggedPorousInterFoam.C:63:0:
/home/openfoam/TryoutOF/openfoam211/applications/solvers/multiphase/interFoam/correctPhi.H:37:12: error: ‘pimple’ was not declared in this scope
In file included from debuggedPorousInterFoam.C:76:0:
/home/openfoam/TryoutOF/openfoam211/applications/solvers/multiphase/interFoam/setDeltaT.H:37:36: error: ‘maxAlphaCo’ was not declared in this scope
/home/openfoam/TryoutOF/openfoam211/applications/solvers/multiphase/interFoam/setDeltaT.H:37:48: error: ‘alphaCoNum’ was not declared in this scope
In file included from debuggedPorousInterFoam.C:84:0:
alphaEqnSubCycle.H:3:15: error: ‘piso’ was not declared in this scope
In file included from alphaEqnSubCycle.H:22:0,
from debuggedPorousInterFoam.C:84:
alphaEqn.H:20:45: error: ‘class Foam::porousZone’ has no member named ‘zoneId’
In file included from alphaEqnSubCycle.H:30:0,
from debuggedPorousInterFoam.C:84:
alphaEqn.H:20:45: error: ‘class Foam::porousZone’ has no member named ‘zoneId’ ..

and so on. Did I put the code at the wrong place in the source or do I need to (re)compile something else before?

I would also be very interested in this master's thesis you mentioned, is it online available?

Kind regards,
Natalie

 ngj May 14, 2013 03:51

Good morning Natalie,

Unfortunately, the version you have downloaded is meant for version 1.6-ext, and there are always small differences between the versions. Therefore:

1. Compare the debugged and your versions of porousInterFoam.

2. Transfer the differences into your 2.1.1. version of porousInterFoam, however, please note that some interfaces in the classes could have changes since 1.6-ext.

3. Compile.

A very pronounced difference is the call to

Code:

`MULES::explicitSolve();`
and the construction of the porosity field, which is missing in the original versions.

Kind regards

Niels

P.S. As far as I know the thesis is not available online, and since I am no longer at University, I cannot help you in that regard.

 Pedro24 May 14, 2013 08:35

I totally agree with Cyp.

The VOF model is defined at the miscroscopic scale (or pore-scale) while the darcy-type penalization term in the momentum equation is defined at the macroscopic scale where the computation cell is composed about thousand pores.

The capillary force term depending on the local interface curvature :

Code:

`fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)`
has no sense in a macroscopic model because you don't know the phase distribution in each computational cell (for that reason, we use empirical capillary pressure law in multiphase porous models).

In your case, considering really strong simplifications :

1) capillary effect are negligible in the porous media.
2) your interface is always sharp in the porous media whatever the flow properties

you can use the model but it remains in my opinion an ill-defined model.

In all cases, i think that is necessary to remove the capillary term in the porous medium (even if it has probably no effect, it is a physical non sense to keep it) and change the name of the solver because it misleads some people.

Regards,

Pierre

 Cyp May 16, 2013 11:09

dear all,

If you are looking for some good references regarding multiphase flow in porous media, have a look at :

Petroleum reservoir simulation - Khalid Aziz, Antonín Settari

it's the bible !

A more recent book is :

Computational Methods for Multiphase Flows in Porous Media (Computational Science and Engineering) - Zhangxin Chen, Guanren Huan, Yuanle Ma

All concepts and equations are detailed!

Moreover, I am curious about the derivation of your analytical solution. Can you provide a reference ?

Best,
Cyp

 Natalie2210 May 23, 2013 02:40

Hi Cyp,

have a look at this paper: http://www.scielo.br/scielo.php?pid=...pt=sci_arttext

Here the RTM process (resin flow through fibrous preform) is modelled. Although the analytic solution stems from the reduction of the Navier-Stokes equations to Darcy's law, a simulation in that regime should give similar results, I believe.

Best,
Natalie

 mecman September 20, 2013 15:14

Quote:
 Originally Posted by Cyp (Post 428059) dear all, If you are looking for some good references regarding multiphase flow in porous media, have a look at : Petroleum reservoir simulation - Khalid Aziz, Antonín Settari it's the bible ! A more recent book is : Computational Methods for Multiphase Flows in Porous Media (Computational Science and Engineering) - Zhangxin Chen, Guanren Huan, Yuanle Ma All concepts and equations are detailed! Moreover, I am curious about the derivation of your analytical solution. Can you provide a reference ? Best, Cyp
Hi CyprienI want simulate Heat pipe (Heat pipe:At the hot interface of a heat pipe a liquid in contact with a thermally conductive solid surface turns into a vapor by absorbing heat from that surface. The vapor then travels along the heat pipe to the cold interface and condenses back into a liquid - releasing the latent heat. The liquid then returns to the hot interface through either capillary action by wick structure ) with porousInterFoam solver. But I read this this page and I dont know,this solver useful for my case or not?
can you guide me for this subject?
Regards,

 salehda June 8, 2014 18:06

Did you figure out a solution to your problem ??

Thanks

 santoo_cfd June 9, 2014 02:44

Hi,

I am also looking for a solution where porousInterFOAM takes into account of porosity of computation cell.

I thought by modifying the temporal term wherein, you have the porosity term in the equation, will solve the problem.

Good to see the debuggedInterFoam here. Thanks.

I will look into it now to see if I can modify work with 2.2.0 version.

 ngj June 9, 2014 04:30

Good day,

A lot of other things was also done to have (large scale) porosiy effects included, so take e.g. a look at the solver porousWaveFoam in the waves2Foam toolbox.

Kind regards,

Niels

Hello David,

well I sort of did but without using porousinterFoam!
I changed the interFoam code where I added the energy equation and modified the momentum equation to account for the porosity.

sorry not much help!!!

 salehda June 17, 2014 08:21

Were you able to add the effect of porosity [ the thermal conductivity of the porous material] in the energy equation?
From my knowledge OpenFOAM doesn't take into account this effect and the only thermal model available for porous media is Fixed temperature !!
I will appreciate any guidance in this point
Thanks

David,

In my case I used the porosity approach in order to get two different regions (solid and fluid) so the porosity is either 1 or 0 no intermediate values. I wrote the thermophysical properties as function of the porosity and added a source term to the momentum equation as function of the porosity as well.

hope this will help :)