CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   Understanding the viscous stress tensor (https://www.cfd-online.com/Forums/main/189395-understanding-viscous-stress-tensor.html)

Benben June 19, 2017 06:00

Understanding the viscous stress tensor
 
Hello,

i am having a hard time understanding the viscous stress tensor model.
For a compressible fluid in carthesian coordinates, the Navier Stokes equation can be written :

https://img15.hostingpics.net/pics/72700732NS.png
This seems to give results that are not physical. For exemple, considering a closed boxe containing a fluid.

https://img15.hostingpics.net/pics/969683schema.png

There is a gradient of velocity "v" along the x axis due to the no slip condition on lateral walls.
And so du to this term of the equations :
https://img15.hostingpics.net/pics/630764NS2.png
The velocity variation "dv" is not the same at point A and B.

This should obviously not be the case as the problem is symetrical.
Why is that so ? Is there missing absolute value in my equation ?

HectorRedal June 19, 2017 10:44

Hi,

I am not sure if I have understood correctly the problem you are describing.
But, if there are no external forcing acting in the box, this means that we are facing an static problem. In that case, the velocity at any point of the fluid is zero. Consequently the stress tensor is zero as well at all points of the domain.
This situation matches what you observe in a real physical problem.

Best regards,
Hector.

Benben June 19, 2017 15:38

Hello, thanks for the answer.

The three forces acting on my fluid are the gravity, the pressure and the viscosity stress tensor.
My fluid is compressible (even if in the equation cited rho is taken off the temporal derivative, because the equations don't come from my work)
The fluid is contained inside of a fully closed boxe and an equilibrium between the pressure and the pressure should establish. (As the fluid is pulled to the bottom of the boxe by the gravity, the pressure at the botom should rize until the gradient compensate the gravity).


At initial time :
The pressure forces are null/compensating as the pressure is the same everywhere.
The viscous stress tensor is null as i initialize the velocity at 0 everywhere.
The gravity pulls the fluid toward the bottom of the boxe.

Which gives this configuration immediatly after the first time step (the velocity is null at the lateral boundaries due to the no slip condition).

I am programming a litle code in C to solve the Navier Stokes equation in transient with a finite differences methode, using the definition of the stress tensor cited above.
However, right after the first time step, i end up in the configuration illustrated, and by definition of my viscous stress, A and B point dont get the same vertical acceleration.

best regards

FMDenaro June 19, 2017 15:57

Your question means almost nothing if you do not specify the full set of BC.s. For compressible flows, you have to consider also the density and the energy equations along with the state equation.
However, if your problem is at low-Mach, this is not the best formulation to work with.

Benben June 19, 2017 16:18

Hello,

Every side of my square is a wall (no slip : lateral velocity is null at the wall, and there is no mass flux through the wall).
I am using an equation of state (Peng Robinson to be precise) to get the pressure at a given density (and at the constant temperature).
The temperature is constant inside of the boxe, so i am not solving any energy equation for now.

Why is my formulation of the equation bad for solving at low mach numbers ? I took a very naïve aproach and just programmed what seemed the easyest to do.

I am solving the equations explicitly with a time marching algorithm. This way i dont have to use a numerical solver. (I am programming every thing from scratch)
I calculate the variation of density with the mass balance equation, and the velocity variation with the momentum balance equation, which gives me the velocity and density of the fluid at the next time step. And then i calculate the pressure with the equation of state, and the viscosity with another formula, and repeat the process.

FMDenaro June 19, 2017 16:30

Low-Mach flow means that you are working with a stiff problem where small density variations (due also to numerical errors) are amplified in the pressure variations.
If you have constant temperature, there is no buoyancy force, do you set an unstable density field to initialize the motion?

HectorRedal June 19, 2017 16:35

You have specified the intial boundary conditions and the initial state of equilibrium. Since the boundary condition does not change (null velocity at all walls, no slip conditions), the state of equilibrium won't. So, if at initial the stress tensor is null everywhre, this would remain as such at any subsequent time steps.
As you correctly state, the gravity force induces some kind of gradient or pressure inside the box. But that gradient of pressure does not cause a viscous tensor if there is not any movement in the fluid.
This is applicable to both incompressible and compressible flows.
https://en.wikipedia.org/wiki/Hydrostatics

Benben June 19, 2017 16:39

Quote:

Originally Posted by FMDenaro (Post 654027)
Low-Mach flow means that you are working with a stiff problem where small density variations (due also to numerical errors) are amplified in the pressure variations.
If you have constant temperature, there is no buoyancy force, do you set an unstable density field to initialize the motion?


Indeed the probleme is very stiff, i have to use time step of the ordre of 10^-8 so that the pressure doesnt skyrocket. This is not really a probleme because the objective of the code is to simulate explosions that happend in a very short time laps.

I am initializing the density at a constant value everywhere.

Numerical error on the density was also a probleme until i rounded off everything at 8 significant digit.

I dont think i can use another methode than the one i described because i have to use a proper equation of state for high temperatures (the objective is to simulate explosions, at high temperature, high pressure, i can't use the ideal gaz law), and the good equations of state (Peng Robinson , Soave Redlick Kwong, ...) give several solution of density for one pressure at a given temperature (one for liquid state, one for gaz state, and one that is not physical).

Quote:

Originally Posted by HectorRedal (Post 654029)
You have specified the intial boundary conditions and the initial state of equilibrium. Since the boundary condition does not change (null velocity at all walls, no slip conditions), the state of equilibrium won't. So, if at initial the stress tensor is null everywhre, this would remain as such at any subsequent time steps.
As you correctly state, the gravity force induces some kind of gradient or pressure inside the box. But that gradient of pressure does not cause a viscous tensor if there is not any movement in the fluid.
This is applicable to both incompressible and compressible flows.
https://en.wikipedia.org/wiki/Hydrostatics

True, but i have velocity at the center of my boxe and no velocity at the wall, so that makes a velocity gradient near my walls, where the viscosity has an effect.
The velocity at the center comes from the gravity, and the velocity at the walls is null because, even if gravity accelerates it, i set the velocity to 0 here. But the inside of my square isn't at a wall boundary (only the sides of the square) so it is free to fall.


Thanks for the answers.

FMDenaro June 19, 2017 16:44

Quote:

Originally Posted by Benben (Post 654031)
Indeed the probleme is very stiff, i have to use time step of the ordre of 10^-8 so that the pressure doesnt skyrocket. This is not really a probleme because the objective of the code is to simulate explosions that happend in a very short time laps.

I am initializing the density at a constant value everywhere.

Numerical error on the density was also a probleme until i rounded off everything at 8 significant digit.



True, but i have velocity at the center of my boxe and no velocity at the wall, so that makes a velocity gradient near my walls, where the viscosity has an effect.


Thanks for the answers.


Density constant means also pressure constant, there is no driving force to onset the motion...maybe you are not considering the equilibrium density rho0 such that if the difference from the density field is zero the gravity does not act

HectorRedal June 19, 2017 16:48

Quote:

Originally Posted by Benben (Post 654031)
True, but i have velocity at the center of my boxe and no velocity at the wall, so that makes a velocity gradient near my walls, where the viscosity has an effect.
The velocity at the center comes from the gravity, and the velocity at the walls is null because, even if gravity accelerates it, i set the velocity to 0 here.


Thanks for the answers.

The velocity at the center is depicted in the intial figure you provided. Where does that velocity come from? Is that a real velocity? Is that an initial value for the velocity field? Is that a boundary condition maintained over the time domai?

Benben June 19, 2017 16:58

Yes, you are right, i am not considering the equilibrium density rho0 with the gravity field. I am considering the density as the mass of fluid per unit of fluid volume. I solve it's value with a mass balance equation.

And the velocity at the center of my figure is coming from the gravity : At initial time the density and the velocity is the same everywhere, so there is no pressure or viscous effect, but the gravity is acting on the fluid. This means that every cingle cell gets a velocity of -9.81*dt after the first time step "dt".
However, in order to respect the boundary condition, the velocities at the side walls are set to 0 (no slip), and at the bottom wall too (no flux trough the wall).

FMDenaro June 19, 2017 17:04

Quote:

Originally Posted by Benben (Post 654038)
Yes, you are right, i am not considering the equilibrium density rho0 with the gravity field. I am considering the density as the mass of fluid per unit of fluid volume. I solve it's value with a mass balance equation.

And the velocity at the center of my figure is coming from the gravity : At initial time the density and the velocity is the same everywhere, so there is no pressure or viscous effect, but the gravity is acting on the fluid. This means that every cingle cell gets a velocity of -9.81*dt after the first time step "dt".
However, in order to respect the boundary condition, the velocities at the side walls are set to 0 (no slip), and at the bottom wall too (no flux trough the wall).



But physically there is no force due to gravity if density, temperature and pressure are homogeneous... the solution is the rest

Benben June 19, 2017 17:12

The reason why there is a pressure gradient in the water is the gravitation. Same for the air pressure that drops with altitude.
That's because the pressure equilibrate so that the gradient of pressure compensate the gravity.
In my exemple i took a box of fluid that has not reached the pressure gradient equilibrium, so the gravity has an effect. until i reach this steady state.

FMDenaro June 19, 2017 17:27

Quote:

Originally Posted by Benben (Post 654040)
The reason why there is a pressure gradient in the water is the gravitation. Same for the air pressure that drops with altitude.
That's because the pressure equilibrate so that the gradient of pressure compensate the gravity.
In my exemple i took a box of fluid that has not reached the pressure gradient equilibrium, so the gravity has an effect. until i reach this steady state.


The equilibrium is when dp/dy = rho *fy but the velocity field will be zero at the steady state. Do you reach such solution at the end of the computation?
However, for water I don't understand how your compressible model could be able to work...

arjun June 19, 2017 22:38

Quote:

Originally Posted by FMDenaro (Post 654041)
The equilibrium is when dp/dy = rho *fy but the velocity field will be zero at the steady state. Do you reach such solution at the end of the computation?
However, for water I don't understand how your compressible model could be able to work...


I am not sure if he is doing the simulation or not, but this small case could be tricky to solver. The standard momentum interpolation method produces non zero velocities near bottom and top walls. The body force weighted scheme (Fluent's) produce 0 (or approaching to 0) velocities.

FMDenaro June 20, 2017 02:47

I think that as dp/drho >> v^2 a small variation of density produces large pressure variation in the momentum and this is the reason to spurious velocity.
For this reason I worked on water flow with the effect of gravity using the incompressible model (div v=0) and the Bousinnesq approximation.

Benben June 20, 2017 03:29

Thank you very much for the help.

Yes, i am able to reach steady state solution where the velocity is close to zero (it never completly is when i stop my calculation, as it would take a lot of computation time, but the velocity is going smaller and smaller).

Sadly I can't use boussinesq's approximation, as i am working on a tool to modelize explosions, and i want to calculate precisely the pressure as a function of the density.
However it is likely that FMDenaro is right about the fact that the spurious velocity comes from numerical error, as i am not rounding the temporal momentum derivative after applying the effect of viscosity.

I was looking for an error in the equations but it might come from the implementation instead.
Thank you everyone for the help, i will try to solve this issue with the advices you gave me.

arjun June 20, 2017 05:54

Yes it is numerical error. If you want correct velocities (or 0 vel) in the start, then start with correct pressure. In this case the pressure gradient matches with gravity.

FMDenaro June 20, 2017 12:12

To check for numerical errors (or bugs in the code), I suggest to start from a stable stratified condition to see if the initial zero velocity field would be perturbed


All times are GMT -4. The time now is 07:47.