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

Trying to figure out the details of simpleFoam

Register Blogs Community New Posts Updated Threads Search

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

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   February 21, 2007, 19: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 and C. Okubo like this.
  Reply With Quote

 


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
Can't figure which cell particle is going to rookie FLUENT 3 December 8, 2017 09:07
[OpenFOAM] No figure is plotted rinaoldek ParaView 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 18:13
How to get data out of figure? Boying Lin Main CFD Forum 4 October 30, 2005 16:36


All times are GMT -4. The time now is 00:24.