So, I've been writing up my di
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! 
You need to read papers like t
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 
You can find details also in t
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 
It may also be useful to look
It may also be useful to look at the icoFoam page on the OpenFOAM wiki http://openfoamwiki.net/index.php/IcoFoam

>This is the part that I'm mos
>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 
About H and U, from Hrv thesis
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. 
Thanks for the suggestions and
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.

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. 
Hi all
Why in: volScalarField AU = UEqn.A(); U = UEqn.H()/AU; Is it neglected pressure term of semidiscretized momentum equation? Thanks 
Quote:

All times are GMT 4. The time now is 10:52. 