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

??fvVectorMatrix+fvVectorField??

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

Like Tree1Likes
  • 1 Post By ngj

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 17, 2013, 16:52
Default ??fvVectorMatrix+fvVectorField??
  #1
New Member
 
Alexander
Join Date: Dec 2009
Location: Saint-Petersburg
Posts: 29
Rep Power: 16
Svensson is on a distinguished road
Send a message via Skype™ to Svensson
Hello All!


I try to remake the icoFoam solver to an solver for stratified almost incompressible liquid and I've an following problem:

I added a new term to momentum equation, which is defined as: - rhoMin+f*(rhoMax-rhoMin)-rho0)/rho0*g
(where rhoMin, rhoMax, rho0 are a constants)

And if I write the momentum equation a intuitive way:

Quote:

fvVectorMatrix UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
- fvm::laplacian(nu, U)
);
solve(UEqn == -fvc::grad(p)+ (rhoMin+f*(rhoMax-rhoMin)-rho0)/rho0*g );

dimensionedScalar ks=nu/1000;

fvScalarMatrix SEqn
(
fvm::ddt(f)
+ fvm::div(phi, f)
- fvm::laplacian(ks, f)
);
SEqn.solve();
Solver doesn't work well (velocity is induced, but scalar f isn't transfered)

But if we write the equation as follows

Quote:
fvVectorMatrix UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
- fvm::laplacian(nu, U)

/////////////////////////////////////////////////////////////////////////////////
- rhoMin+f*(rhoMax-rhoMin)-rho0)/rho0*g
////////////////////////////////////////////////////////////////////////////////
);

solve(UEqn == -fvc::grad(p));/////////////////////////////////////////////////

dimensionedScalar ks=nu/1000;

fvScalarMatrix SEqn
(
fvm::ddt(f)
+ fvm::div(phi, f)
- fvm::laplacian(ks, f)
);
SEqn.solve();
Solver works normally!

And for me it's realy strange, because expression - fvm::laplacian(nu, U)- rhoMin+f*(rhoMax-rhoMin)-rho0)/rho0*g means that we add matrix coefficient to vector.
Svensson is offline   Reply With Quote

Old   February 18, 2013, 01:53
Default
  #2
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 21
Bernhard is on a distinguished road
All of the terms are vectors, i.e. the Laplacian of a vector is a vector and your custom term is also a vector, since you include g. Is this what your confusion is about?
Bernhard is offline   Reply With Quote

Old   February 18, 2013, 02:18
Default
  #3
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hi Alexander,

I suppose that you question is about two "identical" modifications to the momentum equation, however, you get two different results on the flow field, correct?

The second implementation is the correct one to choose, simply because you are otherwise solving a pressure equation, which do not know about the additional source term. When you put the source inside fvVectorMatrix, it works correctly with respect to the pressure-velocity coupling.

Kind regards

Niels
sharonyue likes this.
ngj 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



All times are GMT -4. The time now is 15:33.