
[Sponsors] 
February 21, 2007, 20:53 
So, I've been writing up my di

#1 
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 partlyrelaxed 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 predictorcorrector is to add the pressure effect in the corrector step? (My guess: this version adds the oldtimestep 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 volumecorrected 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 facenormal (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 newlycomputed 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! 

February 22, 2007, 10:56 
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: 700
Rep Power: 12 
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 

February 22, 2007, 14:15 
You can find details also in t

#3 
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,895
Rep Power: 26 
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 

February 22, 2007, 14:36 
It may also be useful to look

#4 
New Member
Maryse Page
Join Date: Mar 2009
Posts: 8
Rep Power: 8 
It may also be useful to look at the icoFoam page on the OpenFOAM wiki http://openfoamwiki.net/index.php/IcoFoam


February 22, 2007, 18:07 
>This is the part that I'm mos

#5 
Senior Member
kumar
Join Date: Mar 2009
Posts: 112
Rep Power: 8 
>This is the part that I'm most confused about >what, exactly, are A() and H()?
Hi Brooks, See page p157 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 

February 22, 2007, 18:25 
About H and U, from Hrv thesis

#6 
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,895
Rep Power: 26 
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. 

February 22, 2007, 18:36 
Thanks for the suggestions and

#7 
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.


November 23, 2009, 09:41 

#8 
New Member
Coen Wit
Join Date: Jul 2009
Posts: 5
Rep Power: 8 
And again I'm kicking an old topic...
lots of searchwork 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 916 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. 

January 24, 2012, 10:30 

#9 
Senior Member
Daniele
Join Date: Feb 2010
Posts: 134
Rep Power: 7 
Hi all
Why in: volScalarField AU = UEqn.A(); U = UEqn.H()/AU; Is it neglected pressure term of semidiscretized momentum equation? Thanks 

March 16, 2014, 16:19 

#10 
Member
yijin Mao
Join Date: May 2010
Location: Columbia, MO
Posts: 46
Rep Power: 7 

Thread Tools  
Display Modes  


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 