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

adapting "debuggedPorousInterFoam" to OF version 2.1

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 16, 2013, 06:36
Smile adapting "debuggedPorousInterFoam" to OF version 2.1
  #1
Member
 
Join Date: Feb 2013
Posts: 30
Rep Power: 13
Natalie2210 is on a distinguished road
Hi!

First of all, I want to give a short overview over the problem I'm facing.

The porousInterFoam solver shipped with OF 2.1.1 does not take the porosity into account. Therefore, the solution the solver computes does not coincide with the (analytical) solution of the corresponding problem, i.e. the penetration of a porous medium by a liquid. This fact is known and a corresponding bug report has been filed at

http://openfoam.org/mantisbt/view.php?id=477.

However, a debugged version of porousInterFoam has been published at
http://sourceforge.net/apps/mantisbt...iew.php?id=129
by Niels which differs from the "original" porousInterFoam version by the construction of the porosity field and the corresponding integration of the porosity in the alpha-Equation. However, this code has been written to be integrated into the OpenFoam 1.6-ext version and so I face certain compatibility problems.

The first major problem I encounter is that in the file "createPorousZones.H" the porosity field is created by

Code:
 volScalarField porosity
    (
 IOobject
        (
     "porosity",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        mesh,
        dimensionedScalar("NULL", dimless, 1.0),
        "zeroGradient"
    );
    forAll( pZones, zoneI )
    {
        const label & zoneId( pZones[zoneI].zoneId() );
 
        const labelList & cells(mesh.cellZones()[cellZoneIds_[zoneI]]);
        const scalar & zonePorosity( pZones[zoneI].porosity() );
        forAll( cells, cellI )
        {
         porosity[cells[cellI]] = zonePorosity;
        }
    }
    porosity.write();
The first part of the code is not problematic, in the second half of the code above, starting with "forAll( pZones, zoneI).." I run into problems. It seems that this piece of code attaches the porosity to the cells belonging to the porous cell zone, however, in OF 2.1 the variable "zoneId" is no longer a member of the porousZone class. Does anyone have an idea how to rewrite this piece of code OF 2.1- conform? Maybe there is some piece of code in another solver attaching some property to a certain cell zone which uses a loop similar to this one?


Then I have another question, mainly to Niels if he is somewhere around :-)
The same piece of code I posted above - the creation of the porosity field - is not only found in createPorousZones.H but also in the file alphaEqn.H - why is it defined doubly?
Furthermore, I found no difference in the UEqn.H to the original file ../multiphase/interFoam/porousInterFoam.H/UEqn.H . However, I believe that in the volume-averaged Navier-Stokes equation describing the flow through porous media the porosity also enters the time derivative? I.e. the NS-equation goes

d/dt(rho * U * gamma) = ...

where gamma denotes the porosity. However, this does not enter the calculation even in debuggedPorousInterFoam?


I hope anyone reads this although its quite a long post :-))

Kind regards,
Natalie
Natalie2210 is offline   Reply With Quote

Old   May 16, 2013, 07:39
Default
  #2
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hi Natalie,

Let me try to answer your questions one-by-one.

1. Compilation problems. The following bit of code is written from the top of my head without compilation (targeted for 2.1), so it might not be completely successful. I have modified the code, which you posted, as it differs a bit from the debugged version. However, try the following:

Code:
forAll( pZones, zoneI )
{
    const labelList & zoneIds( pZones[zoneI].zoneIds() );

    const scalar poro( pZones[zoneI].porosity() );

    forAll( zoneIds, zi )
    {
        const labelList & cells( mesh.cellZones()[zoneIds[zi]] );

        forAll( cells, celli )
        {
             porosity[cells[celli]] = poro;
        }
    }
}
porosity.correctBoundaryConditions();

porosity.write();
2. The code was probably also added in alphaEqn.H, to take changes in porosity with time into account.

3. With respect to adding a constant on the temporal derivative, yes, it is true that there should be a correction. We came across this fact after the debugged version was submitted, and since no one responded to the bug report, we left it at the most significant problem.
Please note that the correction in OF-2.1 might not be correct, however, I cannot remember, if we did something different in the end.

Good luck

Niels
ngj is offline   Reply With Quote

Old   May 16, 2013, 08:09
Default
  #3
Member
 
Join Date: Feb 2013
Posts: 30
Rep Power: 13
Natalie2210 is on a distinguished road
It compiles!! Great, thank you so much!

What do you mean by

Quote:
Please note that the correction in OF-2.1 might not be correct
?
Natalie2210 is offline   Reply With Quote

Old   May 16, 2013, 08:33
Default
  #4
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Good.

I meant that

Code:
pZones.ddt(rho, U)
might not be correctly implementation. I cannot remember, whether we ended up making some corrections or not, though we discussed it a lot.

Kind regards

Niels
ngj is offline   Reply With Quote

Old   May 16, 2013, 08:34
Default
  #5
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
P.S. Remember to visualise the porosity field written in the first time folder. This will help you to check, whether the code works.
ngj is offline   Reply With Quote

Old   May 16, 2013, 10:59
Default
  #6
Senior Member
 
Pablo Higuera
Join Date: Jan 2011
Location: Auckland
Posts: 627
Rep Power: 19
Phicau is on a distinguished road
Hi Natalie,

may I suggest you a reference?

http://www.sciencedirect.com/science...78383912000245

In this paper you can find a very comprehensive review of the porous media equations.

Best,

Pablo
Phicau is offline   Reply With Quote

Old   June 9, 2014, 05:47
Default
  #7
Member
 
santhosh
Join Date: Apr 2009
Location: India
Posts: 70
Rep Power: 16
santoo_cfd is on a distinguished road
Quote:
Originally Posted by Natalie2210 View Post
It compiles!! Great, thank you so much!


?
Hi Natalie,

Is it possible for you share the debuggedPorousInterFoam solver you have modified for the 2.1.0 version.

I started modifying the original version from Mantis to able to work with version 2.2.0, and landed up with same compilation trouble you have posted above in createPorousZones.H file. I tried with above suggested modification as well, but still facing compilation errors.

Code:
createPorousZones.H: In function ‘int main(int, char**)’:
createPorousZones.H:20:5: error: request for member ‘size’ is ambiguous
/opt/openfoam230/src/OpenFOAM/lnInclude/PtrListI.H:34:20: error: candidates are: Foam::label Foam::PtrList<T>::size() const [with T = Foam::porosityModel, Foam::label = int]
santoo_cfd is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Pre-compiled disk images of version 2.1 for Mac? einatlev OpenFOAM Installation 11 October 12, 2012 16:48
wmake error zxj160 OpenFOAM 0 March 26, 2012 11:52
paraview installation woes vex OpenFOAM Installation 15 January 30, 2011 08:11
[OpenFOAM] Problem with paraFoam on a linux-64 bit bunni ParaView 4 April 14, 2010 21:55
paraFoam reader for OpenFOAM 1.6 smart OpenFOAM Installation 13 November 16, 2009 22:41


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