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

Understanding interFoam

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 10, 2008, 10:35
Default Hello. I'm trying to get a
  #1
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
Hello.

I'm trying to get a rather complete overview about what interFoam is doing and how it works.

What do you think is the best way of understanding a solver?

I had a quick look into the Doxygen documentation.
Starting from interFoam.C I looked up the first header-file: fvCFD.H. There I find 14 other .H-files. Some of them linking even more dependencies.

So, at first glance it seems to be impossible to read this whole crowd of codes.

Where can I find the essentials of the underlying finite volume method, like how surface tension is implemented, how the interface is tracked/reconstructed, or the divergence and laplacian schemes are treated just to give some examples?

Maybe you can give me a hint where to start?
linyanx and Jim1310 like this.
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   July 11, 2008, 03:17
Default Hi Sebastian I have some p
  #2
Senior Member
 
Join Date: Mar 2009
Posts: 248
Rep Power: 18
jaswi is on a distinguished road
Hi Sebastian

I have some personal notes on interFOAM which were made for learning purposes. I will send them over to you after Tuesday. Please just send me an e-mail next week . Regarding the interface tracking and reconstruction , interFOAM uses compressive schemes so there is no need of reconstruction. The gamma scalar transport equation is solvd with compressive schemes which not only keeps the interface sharp but also compresses it. I will give you some more details on that next week .

I started with that same approach as you are trying now but it did not work. All you need is to pick some major classes and study them.

My advice would be leave the OpenFOAM/primitives folder for now and try taking a look at :

primitiveMesh, polyMesh, fvMesh and classes related to patches (there is a whole hierarchy for that) . Once you understand the structure of mesh and patches then you will understand the fvPacthes and fvPatchFields as it is from where the boundary conditions come into play. If you will be planning to go for a deeper study then we can divide the stuff among us and try to create some easy to understand guide or documentation.I have done some code reading and can share my experience with you.

I will be actively pursuing this casue after next week. Let me know if you want to join me :-).

With Best Regards
Jaswi
jaswi is offline   Reply With Quote

Old   July 21, 2008, 10:44
Default Having a deeper look into the
  #3
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
Having a deeper look into the PhD-thesis of Henrik Rusche I get the feeling, that this is a rather complete overview what interFoam is doing.

Is interFoam a result from this work?
And what is (still) applying to the current solver?
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   August 13, 2008, 06:43
Default Hello again! After looking
  #4
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
Hello again!

After looking into the UEqn.H file of the interFoam solver I gathered some more knowledge about the solver. But of course there are some further questions.

The UEqn.H defines a (left-hand-side) equation and solves the variables in it until they satisfy another (right-hand-side) equation?

Regarding the first equation:

(
fvm::ddt(rho, U)
+ fvm::div(rhoPhi, U)
- fvm::laplacian(muf, U)
- (fvc::grad(U) & fvc::grad(muf))
//- fvc::div(muf*(fvc::interpolate(dev(fvc::grad(U))) & mesh.Sf()))
);

muf: This must be the "average" dynamic viscosity from the two fluids?
rhoPhi: Don't know what this is. Phi is a cell face motion flux (per definition). What does rhoPhi mean?

What about these logical operators (&) in an algebraic equation? What kind of operation is this?

What is mesh.Sf() ?



Second equation:

( fvc::interpolate(interface.sigmaK())*fvc::snGrad(g amma)
- ghf*fvc::snGrad(rho)
- fvc::snGrad(pd)
) * mesh.magSf()

The hydrostatic phenomena is hidden behind snGrad(pd)? But why is is a surface normal gradient and not a "simple" gradient?

What are ghf and mesh.magSf()

I would appreciate any answers.
Thanks so far!
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   August 13, 2008, 10:48
Default Hi, In regards to '&' (dot pro
  #5
Member
 
Andrew King
Join Date: Mar 2009
Location: Perth, Western Australia, Australia
Posts: 82
Rep Power: 17
andersking is on a distinguished road
Hi, In regards to '&' (dot product) and mesh.Sf() (face surface area vectors) the Programmer's Guide gives lots of info. (in ~/OpenFOAM/OpenFOAM-1.?/doc/Guides-a4/ )

they also give a lot of other vector/tensor operators.

As for the C++ code dependencies the online Doxygen docs are useful. ( http://foam.sourceforge.net/doc/Doxygen/html/ )

Cheers,
Andrew
__________________
Dr Andrew King
Fluid Dynamics Research Group
Curtin University
andersking is offline   Reply With Quote

Old   August 14, 2008, 05:35
Default Hi Sebastian I tried to con
  #6
Senior Member
 
Join Date: Mar 2009
Posts: 248
Rep Power: 18
jaswi is on a distinguished road
Hi Sebastian

I tried to contact you on sebastian.gatzka@stud.tu-darmstadt.de related to interfoam , but the mail bounced back . Could you please confirm the address or please mail me your another email address.

With Best Regards
Jaswinder
jaswi is offline   Reply With Quote

Old   August 15, 2008, 09:56
Default Try this one: sebastian.gatzka
  #7
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
Try this one: sebastian.gatzka@gmx.de
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   August 20, 2008, 12:24
Default I had a look into the Programm
  #8
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
I had a look into the Programmers Guide.
It looks like the code is getting clearer to me, now.

Just to make sure I understand it right:

In the case of an incompressible fluid with constant properties the expressions grad(U) is zero and so

fvc::grad(U) & fvc::grad(muf)

AND

fvc::div(muf*(fvc::interpolate(dev(fvc::grad(U))) & mesh.Sf()))

will be equal to zero?

With constant fluid properties snGrad(rho) will be zero as well?

Is this correct so far?
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   August 20, 2008, 12:50
Default grad(U) isn't zero div(U) is
  #9
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 21
eugene is on a distinguished road
grad(U) isn't zero
div(U) is zero

There is a big difference.
eugene is offline   Reply With Quote

Old   August 21, 2008, 06:16
Default Yes, of course. Sorry. So m
  #10
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
Yes, of course. Sorry.

So my problem persists:
There are three components in the equation I don't understand. I haven't seen these terms in any incompressible Navier-Stokes so far.

1) fvc::grad(U) & fvc::grad(muf)
2) fvc::div(muf*(fvc::interpolate(dev(fvc::grad(U))) & mesh.Sf()))
3) ghf*fvc::snGrad(rho)

-------------------

1) Of course grad(U) is NOT zero. What about grad(muf)? Is there a gradient in the neighbourhood of the interface?

2) Whats this whole expression? I haven't seen anything similar in the works of Rusche and Ubbink or any other textbook about CFD so far. Any hints, where to look?

3) Maybe the same like grad(muf). Is snGrad(rho) nonzero in the sourrounding of the interface?

Thanks so far.
Greetings from sunny Germany.
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   August 21, 2008, 09:40
Default Gatzka, 1) this term is wha
  #11
Member
 
E. David Huckaby
Join Date: Mar 2009
Posts: 57
Rep Power: 17
david_h is on a distinguished road
Gatzka,

1) this term is what is left of term (2) if the differential operators commute and div(U)=0

2) this term is the part of the stress tensor which cannot be represented by the laplacian

(I assume (1) was selected over (2) to improve the stability)

3) this term is to cancel the density gradient which is introduced due to using the gradient of dyanmic pressure, pd = p - rho * (gh), in the momentum equation.

hope this helps
Dave
david_h is offline   Reply With Quote

Old   August 24, 2008, 05:22
Default Thank you Dave. Finally, I
  #12
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
Thank you Dave.

Finally, I can see where this will lead, and now I recognize the analogy to the equations in Ubbinks PhD-thesis. Obviously I have to be very carefully with the differential operators in the momentum equation.

I gave it a try to recalculate the interFoam UEqn.
On the way I tried to treat all operators right.
Maybe you want to have a look at the point where I am stuck:
http://therealsega.th.funpic.de/open...pulsbilanz.pdf

Obviously there a still many differences between my equation (which is not jet finished), equation (2.15) in Ubbinks work and the final UEqn used with interFoam.

1) First of all Ubbink is losing the transposed gradients of the velocity-field somewhere between the lines. I don't know how.

2) My equation is stating a "real" laplacian operator. Ubbinks has non, just a "pre"-laplacian (?) div(mu*grad(U)). In interFoam there is a laplacian which is including the muf (face interpolated dynamic viscosity).

3) interFoam has these deviatoric components. Dave said they are components left over from the stress tensor. Maybe they are some representation from the transposed gradients?

You see, I want to recap the development of the interFoam solver my way. Please tell me if I'm completely wrong. Regarding the deviatoric components I have read the section in the programmers guide but don't know jet how to use these information in my equations.

Regards. S.
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   August 28, 2008, 10:47
Default Sebastian, 1) The 4th term
  #13
Member
 
E. David Huckaby
Join Date: Mar 2009
Posts: 57
Rep Power: 17
david_h is on a distinguished road
Sebastian,

1) The 4th term on right hand side of the last equation is zero, if:
- the gradient and divergence operators commute
- and the velocity is divergence free

In the indicial notation:
mu ( d_j ( d_i u_j ) ) = mu ( d_i (d_j u_j) )

2) If you combine terms 2 and 3 of RHS you will get the modified laplacian in interFoam.

Also, the density should be outside the D/Dt operator on the left hand side of the first equation. If combined with the continuity equation you will be able to get your equation to look like eq. 2.15 of the Thesis and interFoam
david_h is offline   Reply With Quote

Old   August 30, 2008, 08:37
Default Thanks! I made the correcti
  #14
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
Thanks!

I made the corrections to the PDF-file. Have a look.

Further unclarities are marked with the question mark. These are

- in the material derivative: Is there an identity U*grad(rho*U) = grad(rho*U*U) ?
- is the commuted divergence operator correct (righ hand side 4)
- is the "combination" of RHS 2 + 3 correct this way? If not how does it work? Whats behind this operation?
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   August 30, 2008, 08:38
Default Sorry, I have missed one impor
  #15
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
Sorry, I have missed one important question.

What about the transposed gradient?
How do I treat this one?
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   September 8, 2008, 12:43
Default I think what happens is you co
  #16
Member
 
E. David Huckaby
Join Date: Mar 2009
Posts: 57
Rep Power: 17
david_h is on a distinguished road
I think what happens is you converted

div( mu grad(U)^T ) = grad(U)^T . grad(mu) (using div(U) == 0)

as opposed to

div( mu grad(U)^T ) = grad(mu) . grad(U)^T = grad(U) . grad(mu)
david_h is offline   Reply With Quote

Old   September 13, 2008, 11:53
Default Ok, so div( mu grad(U)^T )
  #17
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
Ok, so

div( mu grad(U)^T ) = grad(mu) . grad(U)^T = grad(U) . grad(mu)

is correct?

I converted like this

div( mu grad(U)^T ) = mu div( grad(U)^T ) + grad(U)^T grad(mu)

and that is wrong?

Would you mind having a look at the other questions, too?
Obviously my knowledge about differential operators is limited ...
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   September 24, 2008, 09:50
Default Hello. I'm back again and m
  #18
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
Hello.

I'm back again and made some changes to the file above with the new information. Would anyone mind having a look at the equations?

There are still some questions (some of them already mentioned above without answer so far).

1) Expression div(mu(grad(u)) must be the source of to the interFoam expression fvc::div(muf*(fvc::interpolate(dev(fvc::grad(U)))

How can this be done? Maybe someone can tell me in operator syntax?

2) I didn't get the thing about dynamic pressure.
If I try to use dynamic pressure instead of static pressure pd = p - rho*g*h and transform to the interFoam expression ghf*fvc::snGrad(rho) and fvc::snGrad(pd) there is still g*rho left from the original equation. What happens to it?

Thanks so far.
Sebastian
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   September 30, 2008, 10:30
Default Jaswinder: I'm trying to lea
  #19
Senior Member
 
Tomislav Maric
Join Date: Mar 2009
Location: Darmstadt, Germany
Posts: 284
Blog Entries: 5
Rep Power: 21
tomislav_maric is on a distinguished road
Jaswinder:
I'm trying to learn interFoam also, so I would really benefit from Your notes. Can You please send them to:

tomislav.maric@fsb.hr

Thank You!
__________________
When asking a question, prepare a SSCCE.
tomislav_maric is offline   Reply With Quote

Old   November 12, 2009, 05:28
Default
  #20
Senior Member
 
isabel
Join Date: Apr 2009
Location: Spain
Posts: 171
Rep Power: 17
isabel is on a distinguished road
There is something in interFoam I don't understand. At createFields.H:

volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
gamma*rho1 + (scalar(1) - gamma)*rho2,
gamma.boundaryField().types()
);
rho.oldTime();


Does anybody know what "gamma.boundaryfield().types()" and "rho.oldTime();" means?
isabel is offline   Reply With Quote

Reply


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
Understanding dimensionedScalar jaswi OpenFOAM Running, Solving & CFD 7 December 4, 2014 13:55
Basic Understanding Abduri CFX 8 March 7, 2009 07:12
Understanding k from kepsilon markh83 OpenFOAM Post-Processing 3 December 5, 2008 04:42
Understanding ODE transFuncj0 david_flo1 OpenFOAM Running, Solving & CFD 1 March 8, 2008 13:30
LUSGS understanding Gustavo Main CFD Forum 0 February 14, 2007 11:12


All times are GMT -4. The time now is 13:55.