CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   FvVectorMatrix questions (

stephan February 1, 2006 07:29

hi all, i try to change the
hi all,

i try to change the piso algorithm for incomp. flows (zero divergence condition) to a piso for incomp. flow with a given divergence that is non zero but constant for one timestep. ( the value will change over time but is known)
in this forum it was mentioned that
UEqn.H() gives something like \sum_n a_n u_n.
is the pressure gradient and the old-value for the velocity U included in Ueqn.H()???
Does UEqn.H change the a_n if U changes or are the coefficients constant for one timestep.
and if the pressure gradient in included in UEqn.H(), does UEqn.H() change when the pressure changes?
i hope somebody can help me..
thanx in advance

niklas February 1, 2006 10:08

Continuity Eq: div(U) = 0 and
Continuity Eq: div(U) = 0
and with source term: div(U) = S

Discretised momentum eq. A*U = H - grad(p)
U = H/A -(1/A)*grad(p) = Ustar - (1/A)*grad(p)
H/A is the momentum-predictor value of U, ie Ustar.
if we insert this in the continuity eq. it yields

div(U) = div(Ustar - (1/A)*grad(p)) = S
div(Ustar) - laplacian(1/A, p) = S
laplacian(1/A, p) = -S + div(phi)
where phi is Ustar evaluated on faces.
have a look at icoFoam and you will easily see where to insert S.


stephan February 1, 2006 10:36

hi niklas, at first: thanx
hi niklas,

at first: thanx a lot!!
i was just concerned if i have to include the source once(first corrector step) in the pressure equation or twice(in the second corrector-step) , what just depends on how it is implemented - the paper of Issa(1985) - the first PISO-paper i guess
- has two different approaches for the solution of such systems.
i would be still interested in whether the discretised flux changes when i do something like the following lines or not:
do something..
U=somthing else
does a_n change with U()-changes?
i hope the questions are not too ... - sorry but i am pretty new in c++ in still new into Foam

niklas February 1, 2006 10:54

1. The first step is based on
1. The first step is based on the momentum, so
if you want to add a force, you should do this here.
2. The 'second' step solves pressure to satisfy the continuity eq. and after updates U. If you have a source term due to mass transfer, this should be added here.
So do not add the same source to both steps, since Im guessing that it will not be the same mass and momentum source.

If UEqn.A() changes....
This is so easy to check for yourself.
In fact, I suggest you answer this yourself as an exercise.
If you run the cavity example with only, lets say 2x2x1 cells and write out the U, UEqn.A() and UEqn.H() after each of the above steps you will find out for yourself.

I.e. just add:
Info << U << endl;
Info << UEqn.A() << endl;
Info << UEqn.H() << endl;

at suitable positions in the code

stephan February 1, 2006 11:01

hi niklas, i will exercise
hi niklas,

i will exercise that

Erik May 4, 2007 06:08

Hi, So if I change the mome

So if I change the momentum equation for solving U (first step) I wont need to change the form of the semi discretised momentum equation in step 2? Does the change follow the A and H matrixes?


hartinger May 4, 2007 06:23

yep, the discretised momentum
yep, the discretised momentum equation is generic. Meaning, that however you construct the momentum equation itself, you don't need to change the discretised equation.
'A' contains the diagonal matrix coefficients, 'H' contains the off-diagonal coefficients times velocity. So, any change in the matrix setup will be reflected in 'A' and 'H'

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