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

How to add implicit terms to the momentum equation?

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 1 Post By MaryBau
  • 1 Post By MaryBau

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 23, 2014, 17:01
Default How to add implicit terms to the momentum equation?
  #1
Member
 
Join Date: Jul 2010
Posts: 52
Rep Power: 15
MaryBau is on a distinguished road
Hi all;

I want to solve a free homogeneous shear case. So I am trying to add the following terms to the momentum equation in pisoFoam:

a) U1 & grad(U1)
b) U1 & grad(U)
c) U & grad(U1)

where U is the velocity and U1 is a known volVectorField. (It represents the constant mean velocity obtained by the imposed shear.)

This is what I did:

Code:
fvVectorMatrix UEqn
            (
                fvm::ddt(U)
              + fvm::div(phi, U)
              + turbulence->divDevReff(U)
//Added terms:
              -(U1 & fvc::grad(U1))       // term (a) explicit
	      -fvm::div(U1phi, U)-fvm::Sp(fvc::div(U1phi), U)  //term (b) implicit
              -(U & fvc::grad(U1))        /term (c) explicit??
            );
Term (a) can be added explicitly. For term (b) I have to do a bit of math to be able to solve grad(U) implicitly as it is done normally in OF. But I am not sure if I am doing the correct thing for term (c).

-Does term (c) has to be defined implicitly too?
-How can I do it because Su, SuSp nor Sp accept tensor fields?

I ran that case and the simulation converges. But the results are not what I expected, so I am trying to figure out were could the problem be.

Thanks,

Mary
Kummi likes this.
MaryBau is offline   Reply With Quote

Old   December 7, 2014, 13:48
Default
  #2
Member
 
Join Date: Jul 2010
Posts: 52
Rep Power: 15
MaryBau is on a distinguished road
Hi everyone;

I am still struck with the case that I mentioned in the previous post. I will give more details to see if someone has any suggestions.

The case is a free homogenous shear flow. So I have no walls and periodic boundary conditions everywhere. I am imposing a known mean shear S=dU1/dz, so velocity is not periodic in the z direction. But doing a bit of math I can decompose U_total=U1+U, where U1 is the mean velocity and U are the velocity FLUCTUATIONS (I said that wrong in the previous post.), and rewrite the momentum equations. I am trying to do something similar to Rogallo (1981) but in LES instead of DNS with spectral methods.

The velocity fluctuations U are periodic in all direction and the mean velocity U1 is known, so I can solve the equations for the velocity fluctuations. The equation that I get are in the previous post.

I am getting some instabilities in my simulations in the top and bottom boundaries (see pic and remember Ux is the velocity fluctuations). I think it could be because I am solving the term "c" explicitly, but I am not sure. Could that be the problem?

Does anyone know how to add the term U & grad(U1) implicitly? or any other suggestion of why I am getting those instabilities?

Thanks a lot,

Mary
Attached Images
File Type: jpg instabilities.jpg (14.1 KB, 26 views)

Last edited by MaryBau; December 7, 2014 at 14:56.
MaryBau is offline   Reply With Quote

Old   December 8, 2014, 00:10
Default
  #3
Senior Member
 
T. Chourushi
Join Date: Jul 2009
Posts: 321
Blog Entries: 1
Rep Power: 17
Tushar@cfd is on a distinguished road
Quote:
Originally Posted by MaryBau View Post
Hi all;

I want to solve a free homogeneous shear case. So I am trying to add the following terms to the momentum equation in pisoFoam:

a) U1 & grad(U1)
b) U1 & grad(U)
c) U & grad(U1)

where U is the velocity and U1 is a known volVectorField. (It represents the constant mean velocity obtained by the imposed shear.)

This is what I did:

Code:
fvVectorMatrix UEqn
            (
                fvm::ddt(U)
              + fvm::div(phi, U)
              + turbulence->divDevReff(U)
//Added terms:
              -(U1 & fvc::grad(U1))       // term (a) explicit
          -fvm::div(U1phi, U)-fvm::Sp(fvc::div(U1phi), U)  //term (b) implicit
              -(U & fvc::grad(U1))        /term (c) explicit??
            );
Term (a) can be added explicitly. For term (b) I have to do a bit of math to be able to solve grad(U) implicitly as it is done normally in OF. But I am not sure if I am doing the correct thing for term (c).

-Does term (c) has to be defined implicitly too?
-How can I do it because Su, SuSp nor Sp accept tensor fields?

I ran that case and the simulation converges. But the results are not what I expected, so I am trying to figure out were could the problem be.

Thanks,

Mary

Dear MaryBau,

First of all, your discretized equations is in vector form. And the term for (c) explicit, is a vector. You can add this term implicitly by considering it as a source like this:

Let,
U2 = (U & fvc::grad(U1));

Then you can try something like this:
fvm::Sp(rho, U2);

I think it will work.

-
Best Luck!
Tushar@cfd is offline   Reply With Quote

Old   December 8, 2014, 21:13
Default
  #4
Member
 
Join Date: Jul 2010
Posts: 52
Rep Power: 15
MaryBau is on a distinguished road
Hi Tushar and all;

Thanks so much for the advise. Unfortunately I tried and it does not work, because I can only have one variable that is being solved implicitly. OpenFoam does not know if it should solve for U or U2.

The solver compiles, but when I try to run the case I get this error:

Code:
--> FOAM FATAL ERROR: 
incompatible fields for operation 
    [U] + [(U&grad(U1))]
Thanks again!
MaryBau is offline   Reply With Quote

Old   December 8, 2014, 22:58
Default
  #5
Senior Member
 
T. Chourushi
Join Date: Jul 2009
Posts: 321
Blog Entries: 1
Rep Power: 17
Tushar@cfd is on a distinguished road
You are correct, OpenFOAM will show error.

Try the following formulation, I hope this will work.

fvm::Sp(rho, (U & fvc::grad(U1)));

Or,

If you wish you can upload your case files (including solver) here that will help you resolve your query faster.

-
Best Luck!
Tushar@cfd is offline   Reply With Quote

Old   December 9, 2014, 07:23
Default
  #6
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 18
chriss85 will become famous soon enough
I don't think this will work, as far as I know the second argument of a fvm function needs to be a single field to solve for. I believe this is required so OF can know which field needs to be solved.
chriss85 is offline   Reply With Quote

Old   December 9, 2014, 23:01
Default
  #7
Senior Member
 
T. Chourushi
Join Date: Jul 2009
Posts: 321
Blog Entries: 1
Rep Power: 17
Tushar@cfd is on a distinguished road
Hmmm interesting, any other idea? anyone?

-
Best Regards!
Tushar@cfd is offline   Reply With Quote

Old   December 11, 2014, 15:20
Default
  #8
Member
 
Join Date: Jul 2010
Posts: 52
Rep Power: 15
MaryBau is on a distinguished road
Hi all;

I have tried what you all have suggested plus a couple more things, but no luck so far. I still have those instabilities at the top and bottom boundaries (which are defiened as periodic). I know is term c that is causing those instabilities, but not sure why.

I am attaching my solver and my case. I am not including the original files for the initial turbulent field because they are too big. And Ushear in my solver is U1 in this post.

Thank for your help and suggestions!

Mary
Attached Files
File Type: gz freeHomoShearCase.tar.gz (3.9 KB, 10 views)
File Type: gz pisoFoamHomoShear_v2.tar.gz (6.6 KB, 14 views)
MaryBau is offline   Reply With Quote

Old   December 12, 2014, 00:39
Default
  #9
Senior Member
 
T. Chourushi
Join Date: Jul 2009
Posts: 321
Blog Entries: 1
Rep Power: 17
Tushar@cfd is on a distinguished road
Before going for the solver correction, I would advice you to first try with these settings:

For fvSchemes files:

gradSchemes
{
default none;
grad(p) Gauss linear;
grad(U) Gauss linear;
grad(k) Gauss linear;
grad(omega) Gauss linear;
}

divSchemes
{
default none;
div(phi,U) Gauss upwind;
div(phi,k) Gauss upwind;
div(phi,omega) Gauss upwind;
div((nuEff*dev(T(grad(U))))) Gauss linear;
}

laplacianSchemes
{
default none;
laplacian(nuEff,U) Gauss linear corrected;
laplacian((1|A(U)),p) Gauss linear corrected;
laplacian(DomegaEff,omega) Gauss linear corrected;
laplacian(DkEff,k) Gauss linear corrected;
}

snGradSchemes
{
default corrected;
}

For fvSolution file:

PISO
{
nCorrectors 3;
nNonOrthogonalCorrectors 2;
....
}

I hope it will work.

-
Best Luck!
Tushar@cfd is offline   Reply With Quote

Old   December 20, 2014, 12:24
Default
  #10
Member
 
Join Date: Jul 2010
Posts: 52
Rep Power: 15
MaryBau is on a distinguished road
Hi Tushar and all,

Sorry for the late reply, I was traveling. Thanks a lot for your help.

I tried what you suggested. I definitely reduces the instabilities that I have in the top/bottom boundaries. But I think it also kills all the turbulence in general. Specially if I put "div(phi,U) Gauss upwind", isn't too dissipative for Smagorinsky?

I also not sure if "nNonOrthogonalCorrectors 2" and "corrected" in the "laplacianSchemes" does much if my mesh is all orthogonal.

Thanks,

Mary
Attached Images
File Type: jpg ux.jpg (15.1 KB, 35 views)
openfoam_aero likes this.
MaryBau is offline   Reply With Quote

Old   December 23, 2014, 06:45
Default
  #11
Senior Member
 
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 838
Rep Power: 17
sharonyue is on a distinguished road
Quote:
Originally Posted by MaryBau View Post
Hi all;

I want to solve a free homogeneous shear case. So I am trying to add the following terms to the momentum equation in pisoFoam:

a) U1 & grad(U1)
b) U1 & grad(U)
c) U & grad(U1)

where U is the velocity and U1 is a known volVectorField. (It represents the constant mean velocity obtained by the imposed shear.)
I dont know what the result should be. I got this, is this rite?

Code:
 fvVectorMatrix UEqn
            (
                fvm::ddt(U)
              + fvm::div(phi, U)
              + turbulence->divDevReff(U)
//Explicit terms
              +(Ushear & fvc::grad(Ushear)) //Term a //not solving for Ushear so explicit!
              //+(Ushear & fvc::grad(U))    //Term b 
	      //+(U & fvc::grad(Ushear))    //Term c 
              //+ fvc::div(phi, Ushear)-fvc::Sp(fvc::div(phi), Ushear)    //Term c
//or Implicit terms
	      //+ fvm::div(Ushearphi, Ushear)-fvm::Sp(fvc::div(Ushearphi), Ushear)  //Term a 
	      + fvm::div(Ushearphi, U) //- fvm::Sp(fvc::div(Ushearphi), U)              //Term b //solving for U so it has to be implicit
              //+ fvm::div(phi, Ushear)-fvm::Sp(fvc::div(phi), Ushear)        //Term c //All this term does not work because it is solving for Ushear!
              //+ (U & fvm::SuSp(p1,Ushear))
	      //As Pascal::	+ fvc::div(phi, Ushear) + fvm::div(Ushearphi, U) + fvc::div(Ushearphi, Ushear)
            );
Attached Images
File Type: jpg 1.jpg (25.0 KB, 22 views)
sharonyue is offline   Reply With Quote

Old   December 26, 2014, 21:46
Default
  #12
Member
 
Join Date: Jul 2010
Posts: 52
Rep Power: 15
MaryBau is on a distinguished road
Hi sharonyue;

Ushear is an imposed/known variable, what you get is the default value that I set up in the solver.

U is what it's important, that is the variable I am solving for. For U I should get values close to zero (positive and negative) because U in the solver represents the fluctuations.

Thanks,

Mary
MaryBau is offline   Reply With Quote

Old   July 3, 2022, 05:22
Default
  #13
Member
 
Uttam
Join Date: May 2020
Location: Southampton, United Kingdom
Posts: 34
Rep Power: 5
openfoam_aero is on a distinguished road
Quote:
Originally Posted by MaryBau View Post
Hi all;

I want to solve a free homogeneous shear case. So I am trying to add the following terms to the momentum equation in pisoFoam:

a) U1 & grad(U1)
b) U1 & grad(U)
c) U & grad(U1)

where U is the velocity and U1 is a known volVectorField. (It represents the constant mean velocity obtained by the imposed shear.)

This is what I did:

Code:
fvVectorMatrix UEqn
            (
                fvm::ddt(U)
              + fvm::div(phi, U)
              + turbulence->divDevReff(U)
//Added terms:
              -(U1 & fvc::grad(U1))       // term (a) explicit
	      -fvm::div(U1phi, U)-fvm::Sp(fvc::div(U1phi), U)  //term (b) implicit
              -(U & fvc::grad(U1))        /term (c) explicit??
            );
Term (a) can be added explicitly. For term (b) I have to do a bit of math to be able to solve grad(U) implicitly as it is done normally in OF. But I am not sure if I am doing the correct thing for term (c).

-Does term (c) has to be defined implicitly too?
-How can I do it because Su, SuSp nor Sp accept tensor fields?

I ran that case and the simulation converges. But the results are not what I expected, so I am trying to figure out were could the problem be.

Thanks,

Mary
Hi I am facing an EXACT same problem. I have the exact same terms as well.

Please can you tell me how you solved the problem?
__________________
Best Regards
Uttam

-----------------------------------------------------------------

“When everything seem to be going against you, remember that the airplane takes off against the wind, not with it.” – Henry Ford.
openfoam_aero is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
solving the momentum equation in UEqn. callahance OpenFOAM 2 October 18, 2012 09:38
Implicit treatment of advection terms and pressure correction nikosb Main CFD Forum 0 January 17, 2010 16:07
Viscosity and the Energy Equation Rich Main CFD Forum 0 December 16, 2009 14:01
Derivation of Momentum Equation in Integral Form Demonwolf Main CFD Forum 2 October 29, 2009 19:53
Momentum equation used by mixture model George FLUENT 0 May 19, 2005 13:07


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