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

Conditional change of UEqn

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 6, 2015, 16:45
Default Conditional change of fvVectorMatrix content
  #1
New Member
 
Algis Dziugys
Join Date: Apr 2015
Posts: 10
Rep Power: 11
Algis is on a distinguished road
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 16:24.
Algis is offline   Reply With Quote

Old   November 6, 2015, 17:07
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
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.
alexeym is offline   Reply With Quote

Old   November 10, 2015, 11:32
Default
  #3
New Member
 
Algis Dziugys
Join Date: Apr 2015
Posts: 10
Rep Power: 11
Algis is on a distinguished road
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
Algis is offline   Reply With Quote

Old   November 10, 2015, 14:38
Default
  #4
Member
 
Mattia de\' Michieli Vitturi
Join Date: Mar 2009
Posts: 50
Rep Power: 17
demichie is on a distinguished road
Hi Algis,
please can you try with:

UEqn_2 += g;


Ciao
Mattia
demichie is offline   Reply With Quote

Old   November 10, 2015, 16:17
Default
  #5
New Member
 
Algis Dziugys
Join Date: Apr 2015
Posts: 10
Rep Power: 11
Algis is on a distinguished road
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

Quote:
Originally Posted by demichie View Post
Hi Algis,
please can you try with:

UEqn_2 += g;


Ciao
Mattia
Algis is offline   Reply With Quote

Reply

Tags
fvvectormatrix


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
Thermal phase change model Piti CFX 1 January 14, 2021 10:03
change the under-relaxation factors hotboy FLUENT 4 May 28, 2015 22:25
Mass Transfer without Phase Change in InterPhaseChangeFoam Parisa_Khiabani OpenFOAM Running, Solving & CFD 5 May 26, 2015 09:40
No density change - rhoSimplecFoam krapic OpenFOAM 1 November 29, 2014 18:39
Help with writing a macro/UDF_file/script to change BC at regular time step intervals Codophobia Fluent Multiphase 0 April 24, 2014 10:07


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