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

Trying to figure out the details of simpleFoam

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

Like Tree7Likes
  • 1 Post By brooksmoses
  • 1 Post By page
  • 3 Post By alberto
  • 2 Post By CoenW

Reply
 
LinkBack Thread Tools Display Modes
Old   February 21, 2007, 20:53
Default So, I've been writing up my di
  #1
brooksmoses
Guest
 
Posts: n/a
So, I've been writing up my dissertation, which involves some computations done with a variant of simpleFoam, and I'm trying to figure out exactly what it's doing in enough detail to explain it. Unfortunately, after a couple of hours of looking at it and searching through the source code and the OpenFOAM manual, I still have some questions. Perhaps the most useful way for me to ask for help is to post the relevant code with annotations about what parts I understand and what I'm still confused by, so I'll do that. The quoted code is from my version, but fairly close to that in simpleFoam.

fvVectorMatrix UEqn
(
fvm::div(phi, U)
- fvm::laplacian(nu, U)
- f
);

My understanding is that this defines a set of coefficients for a linear equation in U, as a function of phi, nu, and f (which is a forcing term I added). So far, so good.

UEqn.relax();

This adjusts the coefficients so as to incorporate the underrelaxation coefficient, such that a solution to UEqn == source will produce a partly-relaxed version of U, yes? And it doesn't do anything to U?

solve(UEqn == -fvc::grad(p));

This computes a solution, and does something with it, but I'm not entirely clear on what. Does it update U? Does it add information to UEqn? Why is grad(p) in here, when the usual form of the predictor-corrector is to add the pressure effect in the corrector step? (My guess: this version adds the old-timestep pressure here, and the corrector step is only adding the effects from the change in pressure.)

volScalarField AU = UEqn.A();
U = UEqn.H()/AU;

This is the part that I'm most confused about -- what, exactly, are A() and H()? It appears from fvMatrix.C that A() is a volume-corrected version of the diagonal terms of the linear equation, but I'm not at all clear on what H() is, and the comment in fvMatrix.H, which describes it as "the H operation source", isn't enlightening me. What does the U that results from this contain as far as updates from the U at the beginning of the timestep?

phi = fvc::interpolate(U) & mesh.Sf();
adjustPhi(phi, U, p);

This calculates the face-normal (flux) velocities, and adjusts them to account for boundary conditions, yes?

fvScalarMatrix pEqn
(
fvm::laplacian(1.0/AU, p) == fvc::div(phi)
);

This is, again, a set of coefficients for a linear equation, this time in p. How does the relaxation on UEqn affect the values of 1.0/AU that go into this? (Does that matter any?)

pEqn.solve();

This, again, computes a solution. Again, what does it do with the solution? I presume from later things that it must update p, yes?

phi -= pEqn.flux();

I presume that this is adjusting phi based on the newly-computed p values, and is equivalent to the "U -= fvc::grad(p)/AU" line below? And that this is done before the relaxation step so as to retain the divergenceless nature of phi?

p.relax();

This, I gather, is an explicit relaxation step along the lines of p = alpha p + (1 - alpha) p_old, unlike the UEqn.relax() line above?

// Momentum corrector
U -= fvc::grad(p)/AU;

And then this is doing the corrector step of the timestep, which I'd understand better if I knew what UEqn.A() was.

Thanks, muchly, for whatever enlightment you can offer!
rapierrz likes this.
  Reply With Quote

Old   February 22, 2007, 10:56
Default You need to read papers like t
  #2
Senior Member
 
Srinath Madhavan (a.k.a pUl|)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 698
Rep Power: 12
msrinath80 is on a distinguished road
You need to read papers like this[1] one which explains icoFoam for instance. In fact you should be able to cite them as a reference.

[1] http://powerlab.fsb.hr/ped/kturbo/Op...apers/Foam.pdf
msrinath80 is offline   Reply With Quote

Old   February 22, 2007, 14:15
Default You can find details also in t
  #3
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,894
Rep Power: 26
alberto will become famous soon enoughalberto will become famous soon enough
You can find details also in the Hrvoje's PhD thesis, where the derivation of the discretized equation and the SIMPLE algorithm are explained.

Regards,
Alberto
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as live DVD/USB, hard drive image and virtual image.
OpenQBMM - An open-source implementation of quadrature-based moment methods
alberto is offline   Reply With Quote

Old   February 22, 2007, 14:36
Default It may also be useful to look
  #4
New Member
 
Maryse Page
Join Date: Mar 2009
Posts: 8
Rep Power: 8
page is on a distinguished road
It may also be useful to look at the icoFoam page on the OpenFOAM wiki http://openfoamwiki.net/index.php/IcoFoam
fumiya likes this.
page is offline   Reply With Quote

Old   February 22, 2007, 18:07
Default >This is the part that I'm mos
  #5
Senior Member
 
kumar
Join Date: Mar 2009
Posts: 112
Rep Power: 8
kumar2 is on a distinguished road
>This is the part that I'm most confused about -->what, exactly, are A() and H()?

Hi Brooks,

See page p-157 to 158 ( and few pages both sides ) of henrikrusche's phd thesis available from

http://powerlab.fsb.hr/ped/kturbo/Op...chePhD2002.pdf

Good luck on your thesis

kumar
kumar2 is offline   Reply With Quote

Old   February 22, 2007, 18:25
Default About H and U, from Hrv thesis
  #6
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,894
Rep Power: 26
alberto will become famous soon enoughalberto will become famous soon enough
About H and U, from Hrv thesis:

if you take the semidiscretised momentum equation in the form:

Ap Up = H(U) - grad(p) <=> Up = H(U)/Ap - grad(p)/Ap

H(U) = - sum_n a_n U_n + Uo/Delta t represents the sum of the matrix coefficient of the neighbouring cells multiplied by the corresponding velocity plus the unsteady term.

H(U) in foam is obtained through UEqn.H(). The coefficient Ap is given by UEqn.A().

You find an almost identical nomenclature in the book:

J. H. Ferziger, M. Péric, "Computational Methods for Fluid Dynamics", 3rd Ed., pp. 167 - 178, Springer, 2002.

Regards,
A.
Tushar@cfd, fumiya and iurnus like this.
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as live DVD/USB, hard drive image and virtual image.
OpenQBMM - An open-source implementation of quadrature-based moment methods
alberto is offline   Reply With Quote

Old   February 22, 2007, 18:36
Default Thanks for the suggestions and
  #7
brooksmoses
Guest
 
Posts: n/a
Thanks for the suggestions and references, everyone! That looks like enough to get me started; I'll come back with more questions if I still have any once I read all this.
  Reply With Quote

Old   November 23, 2009, 09:41
Default
  #8
New Member
 
Coen Wit
Join Date: Jul 2009
Posts: 5
Rep Power: 8
CoenW is on a distinguished road
And again I'm kicking an old topic...

lots of search-work is involved in finding out about OpenFOAM's inner workings, which I've been doing as well lately. To add to the wealth of information presented in this topic I'd like to refer to one of the workshop presentations:

http://www.tfd.chalmers.se/~hani/kur...pplication.pdf

Slides 9-16 give a very succint and clear overview of the workings of the PISO algoritm in icoFOAM and should serve as a good basis for viewing the other papers mentioned in this topic.
zhernadi and zhulianhua like this.
CoenW is offline   Reply With Quote

Old   January 24, 2012, 10:30
Default
  #9
Senior Member
 
Daniele
Join Date: Feb 2010
Posts: 134
Rep Power: 7
Daniele111 is on a distinguished road
Hi all
Why in:

volScalarField AU = UEqn.A();
U = UEqn.H()/AU;

Is it neglected pressure term of semi-discretized momentum equation?

Thanks
Daniele111 is offline   Reply With Quote

Old   March 16, 2014, 16:19
Default
  #10
Member
 
yijin Mao
Join Date: May 2010
Location: Columbia, MO
Posts: 45
Rep Power: 7
alundilong is on a distinguished road
Quote:
Originally Posted by Daniele111 View Post
Hi all
Why in:

volScalarField AU = UEqn.A();
U = UEqn.H()/AU;

Is it neglected pressure term of semi-discretized momentum equation?

Thanks
Pressure contribution will be added after pressure equation is solved.
alundilong is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
No figure is plotted rinaoldek OpenFOAM Paraview & paraFoam 20 August 24, 2009 17:40
figure rati FLUENT 4 July 17, 2006 06:18
Can't figure which cell particle is going to -- AB am FLUENT 0 February 21, 2006 19:13
How to get data out of figure? Boying Lin Main CFD Forum 4 October 30, 2005 17:36
Can't figure which cell particle is going to rookie FLUENT 2 June 12, 2003 20:35


All times are GMT -4. The time now is 06:47.