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

Adding implicit source term in UEq

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 15, 2022, 04:07
Default Adding implicit source term in UEq
  #1
New Member
 
Ahmed Hafez
Join Date: Jul 2018
Posts: 26
Rep Power: 7
AhmedHafez is on a distinguished road
Hello All,

I want to add a source term in form of +(fvc::grad(U) & U) to momentum equation (UEq)
First, I implemented it explicitly however the residuals raise significantly.
Is there any way or trick to do it implicitly as I know that fvm::SuSp & fvm::Sp accept only volScalarField.

Thank you.
AhmedHafez is offline   Reply With Quote

Old   January 16, 2022, 15:45
Default
  #2
New Member
 
Ahmed Hafez
Join Date: Jul 2018
Posts: 26
Rep Power: 7
AhmedHafez is on a distinguished road
Any help ?
AhmedHafez is offline   Reply With Quote

Old   January 17, 2022, 07:55
Default
  #3
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Quote:
Originally Posted by AhmedHafez View Post
Hello All,

I want to add a source term in form of +(fvc::grad(U) & U) to momentum equation (UEq)
First, I implemented it explicitly however the residuals raise significantly.
Is there any way or trick to do it implicitly as I know that fvm::SuSp & fvm::Sp accept only volScalarField.

Thank you.

SuSp will only put the the cells implicit with a negative sign. All others are treated explicitly. Hence, you are not 100 % sure if you treat anything implicit. The gradient of U can - in my opinion - not be treated implicitly.

What type of source term is it? Looks a bit similar to the deformation tensor but you have grad(U) product with U. So no idea what it represents out of the box.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   January 20, 2022, 01:22
Post
  #4
New Member
 
Ahmed Hafez
Join Date: Jul 2018
Posts: 26
Rep Power: 7
AhmedHafez is on a distinguished road
Quote:
Originally Posted by Tobi View Post
SuSp will only put the the cells implicit with a negative sign. All others are treated explicitly. Hence, you are not 100 % sure if you treat anything implicit. The gradient of U can - in my opinion - not be treated implicitly.

What type of source term is it? Looks a bit similar to the deformation tensor but you have grad(U) product with U. So no idea what it represents out of the box.
Thank you for your reply. Actually this term rise in continuous adjoint equations as grad(U)&Ua where Ua is adjoint velocity. I understand that that SuSp(A,B) will add implicit source term if A is negative.

My question in different form, can we add different implicit source terms for momentum equation according to direction i.e.
Sx for x-momentum
And Sy for y-momentum
AhmedHafez is offline   Reply With Quote

Old   January 20, 2022, 08:27
Default
  #5
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Not sure if I got your question right.

So you can, of course, add different contributions to Ux, Uy, Uz, based on the vector you apply. However, you cannot always guarantee that this is treated implicitly or explicitly. So you could use SuSp() for that. The source is a vector you want to provide. The SuSp() function will take care if the single part can be added explicitly or implicitly.


If I got you more precisely, you want to add single contributions rather than one vector.
So I am not sure if the SuSp() will consider each component separately and decide if it is taken implicit or explicit.

You also could try to add two contributions Vector1 (x,0,0) and Vector2 (0,y,0). To give the correct answer, one should check the code and how it works.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   January 20, 2022, 09:05
Default
  #6
New Member
 
Ahmed Hafez
Join Date: Jul 2018
Posts: 26
Rep Power: 7
AhmedHafez is on a distinguished road
Quote:
Originally Posted by Tobi View Post
Not sure if I got your question right.

So you can, of course, add different contributions to Ux, Uy, Uz, based on the vector you apply. However, you cannot always guarantee that this is treated implicitly or explicitly. So you could use SuSp() for that. The source is a vector you want to provide. The SuSp() function will take care if the single part can be added explicitly or implicitly.


If I got you more precisely, you want to add single contributions rather than one vector.
So I am not sure if the SuSp() will consider each component separately and decide if it is taken implicit or explicit.

You also could try to add two contributions Vector1 (x,0,0) and Vector2 (0,y,0). To give the correct answer, one should check the code and how it works.
Thank you, However, I'm bit confused. For example if: Sx = A*Ux and Sy = B * Uy. so in UEq.H file should I write it as following:
tmp<fvVectorMatrix> tUEqn
(
fvm::div(phi, U)
+ turbulence->divDevReff(U)
+fvm::SuSP(A,U&vector(1,0,0)) + fvm::SuSP(B,U&vector(0,1,0))
);
AhmedHafez is offline   Reply With Quote

Old   January 21, 2022, 08:47
Default
  #7
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Yes exactly, despite I would expect that A and B has to be extended with the vectors rather than the field you are solving for. However, as I told, I am not sure if this is identical to putting just one source term.

The resulting matrix does not care about the source terms. They are placed accordingly to the sign. The only difference which I am not aware right now is, if the source term of the vector is treated as single-component in SuSp or is the vector itself used.

Lets check...
The SuSp function is only implemented by taking a <volScalarField> as argument. Hence, the code you presented should give an error despite, the volVectorField is split first into three volScalarFields automatically.

I would go into the code but I have no time for investigating into that.
Tobi
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   January 22, 2022, 02:53
Default
  #8
New Member
 
Ahmed Hafez
Join Date: Jul 2018
Posts: 26
Rep Power: 7
AhmedHafez is on a distinguished road
Quote:
Originally Posted by Tobi View Post
Yes exactly, despite I would expect that A and B has to be extended with the vectors rather than the field you are solving for. However, as I told, I am not sure if this is identical to putting just one source term.

The resulting matrix does not care about the source terms. They are placed accordingly to the sign. The only difference which I am not aware right now is, if the source term of the vector is treated as single-component in SuSp or is the vector itself used.

Lets check...
The SuSp function is only implemented by taking a <volScalarField> as argument. Hence, the code you presented should give an error despite, the volVectorField is split first into three volScalarFields automatically.

I would go into the code but I have no time for investigating into that.
Tobi
Thank you for your help
AhmedHafez is offline   Reply With Quote

Reply


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
[OpenFOAM.org] Error creating ParaView-4.1.0 OpenFOAM 2.3.0 tlcoons OpenFOAM Installation 13 April 20, 2016 17:34
Problem compiling a custom Lagrangian library brbbhatti OpenFOAM Programming & Development 2 July 7, 2014 11:32
OpenFOAM without MPI kokizzu OpenFOAM Installation 4 May 26, 2014 09:17
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 19:08
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51


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