CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)

 sharonyue June 4, 2013 09:56

Hi All,

This is UEqn code in icoFoam:
Code:

```fvVectorMatrix UEqn         (             fvm::ddt(U)           + fvm::div(phi, U)           - fvm::laplacian(nu, U)         );```
AFAIK,momentum equation can be devided into three components,this three components u v w should be calculated in three algebraic equations,see equation 6.8 and 6.10 in H K Versteeg's book.so why is there only UEqn's matrix?where is VEqn and WEqn?

 ngj June 4, 2013 11:37

Hi Forrest,

The key point is the type of the matrix, namely

Code:

`fvVectorMatrix`
This tells you that you are solving for a matrix variable, which in this case is the velocity vector U, which has a component for each of the three Cartesian directions.

Kind regards

Niels

 sharonyue June 4, 2013 19:40

Quote:
 Originally Posted by ngj (Post 431972) Hi Forrest, The key point is the type of the matrix, namely Code: `fvVectorMatrix` This tells you that you are solving for a matrix variable, which in this case is the velocity vector U, which has a component for each of the three Cartesian directions. Kind regards Niels
Thanks Niels,

Can you tell me in this situations below,what is the fvvectormatrix?
If there were just three nodes,after dixcretisation of the governing equation.I have:
Code:

```1 2 3  u_1    2 4 5 6  u_2  = 3 7 8 9  u_3    4 11 22 33  v_1    22 44 55 66  v_2  = 33 77 88 99  v_3    44 111 222 333  w_1    222 444 555 666  w_2  = 333 777 888 999  w_3    444```
I think UEqn should not be this:
Code:

```1    2    3  4    5    6  7    8    9  11  22  33  44  55  66  77  88  99  111 222 333  444 555 666  777 888 999```
this looks good which only can be solved for v_1 v_2 v_3:
Code:

``` 11  22  33  44  55  66  77  88  99```
Where am I wrong?Thanks alot!

 sharonyue June 6, 2013 00:02

Any ideas?

 sharonyue June 6, 2013 22:44

I try to print the UEqn:

Code:

```fvVectorMatrix UEqn         (             fvm::ddt(U)           + fvm::div(phi, U)             );         Info<< UEqn << endl;```
I got this in a 2*2 mesh:

Code:

```Lower triangle = 4(-0.05 -0 -0 -0.05) diagonal = 4(0.05 0 0.05 0) Upper triangle = 4{0} [0 4 -2 0 0 0 0] 4{(0 0 0)} 3 ( 2{(0 0 0)} 6{(0 0 0)} 0() ) 3 ( 2{(0 0 0)} 6((0.05 0 0) (0.05 0 0) (-0.05 0 0) (-0.05 0 0) (0 0 0) (0 0 0)) 0() )```
3*2 mesh:
Code:

```Lower triangle = 7(-0.05 -0 -0.05 -0 -0 -0.05 -0.05) diagonal = 6(0.05 0.05 0 0.05 0.05 0) Upper triangle = 7{0} [0 4 -2 0 0 0 0] 6{(0 0 0)} 3 ( 3{(0 0 0)} 7{(0 0 0)} 0() ) 3 ( 3{(0 0 0)} 7((0.05 0 0) (0.05 0 0) (-0.05 0 0) (-0.05 0 0) (0 0 0) (0 0 0) (0 0 0)) 0() )```
But I cannot see anything from this..

 sharonyue June 12, 2013 19:37

no one is here?

 sharonyue June 20, 2013 04:00

1 Attachment(s)
[LaTeX Error: Syntax error]

In this formula, I think the left equation in Jasak's thesis page.145 eqn(3.136) have three componets, so there are three equations, but why is there only one matrix:Ueqn?where is Veqn and Weqn?

 sharonyue June 27, 2013 22:06

Still does not get anywhere now.

 sharonyue June 30, 2013 21:15

Code:

```Lower triangle = 7(-0.05 -0 -0.05 -0 -0 -0.05 -0.05) diagonal = 6(0.05 0.05 0 0.05 0.05 0)```
especially this: In a matrix, if the diagonal coefficients are 6, is the upper and lower triangle coefficients should be (5+4+3+2+1)=15?

 sharonyue June 30, 2013 22:48

1 Attachment(s)
This is a piece in Fabian Peng Karrholm's Ph.D thesis, :see the image.

OpenFOAM use A.22 to represent this three equations: A.18 A.19 A.20.
But in this thesis there are no more explanations regarding this.

 santiagomarquezd July 2, 2013 23:27

Hi, the matrix coefficients for the momentum equation are the same, so you have only one matrix. The source term has different values in each direction. Check lines 143-208 in http://foam.sourceforge.net/docs/cpp/a04765_source.html

Regards.

 sharonyue July 2, 2013 23:44

Quote:
 Originally Posted by santiagomarquezd (Post 437436) Hi, the matrix coefficients for the momentum equation are the same, so you have only one matrix. The source term has different values in each direction. Check lines 143-208 in http://foam.sourceforge.net/docs/cpp/a04765_source.html Regards.
Hi,

After a long struggle, I just made a discretisation of momentum equation manully and found you are right, so I know why there was only one matrix.but I still have many problems so I didnot update this.

While do you know why Ueqn.A() do not equal to the diag.term of Ueqn?http://www.cfd-online.com/Forums/ope...term-ueqn.html

And why is this Ueqn looks so mass. Its not like a matrix.

BTW, I read your note regarding to interFoam solve. Its totally wonderful and help me alot.