|
[Sponsors] |
November 6, 2015, 17:45 |
Conditional change of fvVectorMatrix content
|
#1 |
New Member
Algis Dziugys
Join Date: Apr 2015
Posts: 10
Rep Power: 11 |
Hi,
I need to change conditionally fvVectorMatrix (UEqn for example) independently on fvOptions. For example, can I do like that: Foam::fvVectorMatrix UEqn ( Foam::fvm::div(phi, U) - Foam::fvm::laplacian(nu, U) == fvOptions(U) ); if(f_include_turbulence) UEqn += Foam::turbulence->divDevReff(U); if(f_include_gravity) UEqn -= g; UEqn().relax(); Or in other words, how do "-=" and "+=" work for fvVectorMatrix, what rules are? How to be sure that operators "-=" and "+=" will change UEqn.A or UEqn.H, or rhs? Thanks in advance. Last edited by Algis; November 7, 2015 at 17:24. |
|
November 6, 2015, 18:07 |
|
#2 |
Senior Member
|
Hi,
it depends on rhs of += or -= operator. Since UEqn is fvVectorMatrix, look for meaning of operators, for example, at http://foam.sourceforge.net/docs/cpp...31bccd419a176b. Basically you are able to add another matrix, so it will be sum of matrices, or you can add volume field, in this case field will be added to equation source term. |
|
November 10, 2015, 12:32 |
|
#3 |
New Member
Algis Dziugys
Join Date: Apr 2015
Posts: 10
Rep Power: 11 |
Hi,
I did an experiment. Add gravity (defined as uniformDimensionedVectorField g) by two ways: 1) in definition of UEqn and 2) after definition of UEqn: 1) fvVectorMatrix UEqn_1 ( fvm::ddt(U) fvm::div(phi, U) - fvm::laplacian(nu, U) == -g ); 2) fvVectorMatrix UEqn_2 ( fvm::ddt(U) fvm::div(phi, U) - fvm::laplacian(nu, U) ); UEqn_2 -= g; and then compared both UEqn_1 and UEqn_2. The result was that A(), H1, source() and residual() were the same for UEqn_1 and UEqn_2, while H() was different. Why H() was different? Thank you very much in advance, Algis |
|
November 10, 2015, 15:38 |
|
#4 |
Member
Mattia de\' Michieli Vitturi
Join Date: Mar 2009
Posts: 51
Rep Power: 17 |
Hi Algis,
please can you try with: UEqn_2 += g; Ciao Mattia |
|
November 10, 2015, 17:17 |
|
#5 |
New Member
Algis Dziugys
Join Date: Apr 2015
Posts: 10
Rep Power: 11 |
Hi Mattia,
I did it and now there is no difference in H() and others. So, analog of fvVectorMatrix UEqn ( fvm::ddt(U) fvm::div(phi, U) - fvm::laplacian(nu, U) == -g ); is fvVectorMatrix UEqn_2 ( fvm::ddt(U) fvm::div(phi, U) - fvm::laplacian(nu, U) ); UEqn_2 += g; but not "UEqn_2 -= g"; Thanks Mattia, now I see in what was my misunderstanding. Best regards, Algis |
|
Tags |
fvvectormatrix |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Thermal phase change model | Piti | CFX | 1 | January 14, 2021 11:03 |
change the under-relaxation factors | hotboy | FLUENT | 4 | May 28, 2015 23:25 |
Mass Transfer without Phase Change in InterPhaseChangeFoam | Parisa_Khiabani | OpenFOAM Running, Solving & CFD | 5 | May 26, 2015 10:40 |
No density change - rhoSimplecFoam | krapic | OpenFOAM | 1 | November 29, 2014 19:39 |
Help with writing a macro/UDF_file/script to change BC at regular time step intervals | Codophobia | Fluent Multiphase | 0 | April 24, 2014 11:07 |