CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Strange DNS results (http://www.cfd-online.com/Forums/openfoam/89416-strange-dns-results.html)

LijieNPIC June 12, 2011 04:59

Strange DNS results
 
2 Attachment(s)
Hi foamers, especially DNSers,

I need your help. I have modified channelFoam to perform DNS of pipe flow. L/D=5, D=0.01m, bulk velocity is 0.53m/s, viscosity is 1e-6, so Re based on D is 5300. The mesh is 4 million, time step is 0.0001. At inlet and outlet boundaries, I set cyclic boundary condition. After 10000 time steps, I sampled the main axial velocity(z direction), very 500 time steps I get 1 sample, so there are 10 samples. I averaged the velocity, and get the following result, seen graph1 attached, the axial velocity seems to oscillate in the radial direction. This behavior will more obvious in instantaneous velocity, seen in graph2. What is more, the inlet instantaneous velocity differs from outlet instantaneous velocity. It is strange, because I applied cyclic bc at the two boundaries. Anyone who has do DNS simulation experience such problem. Please give me your hands, thanks

morard June 13, 2011 04:08

Hello,

I have no experience with DNS, but I think that your results are not that strange. Ten samples are not enough. For time averaging use function in controlDict.
In this kind of simulations I always start averaging after about 15 flow-through times.

Regards,
Dejan

LijieNPIC June 13, 2011 07:29

Thanks for your reply, Dejan. Today my simulation complete at 59000 time steps. Then I sample the fields again. I sample very 1000 time steps, and get 49 samples. The average axial velocity also seems to oscillate in the radial direction, and the Reynold stress derivate largely from previous results. What is more, my inlet velocity fields are not the same as the outlet velocity

LijieNPIC June 13, 2011 07:30

Quote:

Originally Posted by morard (Post 311730)
Hello,

I have no experience with DNS, but I think that your results are not that strange. Ten samples are not enough. For time averaging use function in controlDict.
In this kind of simulations I always start averaging after about 15 flow-through times.

Regards,
Dejan

How to average use function in controlDict?

morard June 13, 2011 08:04

Quote:

Originally Posted by LijieNPIC (Post 311763)
How to average use function in controlDict?

Just add this function at the end of your controlDict file:

functions
{
fieldAverage1
{
type fieldAverage;
functionObjectLibs ( "libfieldFunctionObjects.so" );
enabled true;
outputControl outputTime;
fields
(
U
{
mean on;
prime2Mean on;
base time;
}

p
{
mean on;
prime2Mean on;
base time;
}
);
}
}

and keep it running for at least 15 flow-through time (time needed for fluid to complete distance from inlet to outlet). Than check your profiles. Maybe you will need 100 time steps, or 1000 (depends on your geometry).
Hope this helps.

morard June 13, 2011 08:19

Hi once again,

in channelFoam tutorial you have example of controlDict.

LijieNPIC June 13, 2011 09:05

Dejan, I sample after 10000 time steps. So I think my simulation should be fully developed. But the results are bad, especially the u'v' or Urms. Besides, the inlet instantaneous velocity differs from outlet instantaneous velocity

morard June 13, 2011 09:53

Ok, I see that your flow is fully developed, but you cannot do averaging in time just by sampling 10, or 50 or 100 time steps. Continue with simulation for another 10000 steps, let say from time 1 to time 2 (use function in controlDict I told you - also gives you UPrime2Mean values) and then check your profile. That function does averaging; just imagine that you have sampled 10000 time steps instead of 49! Than, at least your velocity profiles should be ok.

Regarding instantaneous velocities, I have no idea where could be the problem.

How did you calculate Urms values?

LijieNPIC June 13, 2011 10:15

Quote:

Originally Posted by morard (Post 311783)
Ok, I see that your flow is fully developed, but you cannot do averaging in time just by sampling 10, or 50 or 100 time steps. Continue with simulation for another 10000 steps, let say from time 1 to time 2 (use function in controlDict I told you - also gives you UPrime2Mean values) and then check your profile. That function does averaging; just imagine that you have sampled 10000 time steps instead of 49! Than, at least your velocity profiles should be ok.

Regarding instantaneous velocities, I have no idea where could be the problem.

How did you calculate Urms values?

I am sorry that maybe my expression is not clear. The total time of my simulation is 59000 time steps, and I sample after 10000 time steps. I sample every 1000 steps, so there are 49 samples. Urms=sqrt(sum(U-Uaver)/N)

morard June 13, 2011 12:01

I understand what have you done. But, you do not have to do that since OpenFOAM provides easy and the right way. It means you do not have to save 49 steps and try to find average value; first: you need a lot of disk space, and second: 49 steps is far from enough in your case - it does not matter if you take every, or every 10000 steps.
Maybe I am not able to explain this clearly. I suggest you to try channelFoam tutorial and to check the output. You will see that mean and rms values are automatically calculated, because functions for that are specified in controlDict.

Btw, did you try on the way I told you?

LijieNPIC June 13, 2011 20:41

Quote:

Originally Posted by morard (Post 311804)
I understand what have you done. But, you do not have to do that since OpenFOAM provides easy and the right way. It means you do not have to save 49 steps and try to find average value; first: you need a lot of disk space, and second: 49 steps is far from enough in your case - it does not matter if you take every, or every 10000 steps.
Maybe I am not able to explain this clearly. I suggest you to try channelFoam tutorial and to check the output. You will see that mean and rms values are automatically calculated, because functions for that are specified in controlDict.

Btw, did you try on the way I told you?

I will try the way you told me later, and let you know the results

LijieNPIC June 14, 2011 02:31

Quote:

Originally Posted by morard (Post 311771)
Just add this function at the end of your controlDict file:

functions
{
fieldAverage1
{
type fieldAverage;
functionObjectLibs ( "libfieldFunctionObjects.so" );
enabled true;
outputControl outputTime;
fields
(
U
{
mean on;
prime2Mean on;
base time;
}

p
{
mean on;
prime2Mean on;
base time;
}
);
}
}

and keep it running for at least 15 flow-through time (time needed for fluid to complete distance from inlet to outlet). Than check your profiles. Maybe you will need 100 time steps, or 1000 (depends on your geometry).
Hope this helps.

Hi, morard. I have tried the method how to average the filed and get statistics. The averaged field is what I want, but from prime2Mean, I can't get Reynolds stresses or Urms

morard June 14, 2011 03:13

Hi LijieNPIC,

I'm glad to hear that! :)
You can extract all components of UPrime2Mean tensor by using foamCalc. If you don't know how to use it, just type the following:

foamCalc components UPrime2Mean

This will extract UPrime2Meanxx UPrime2Meanxy UPrime2Meanxz UPrime2Meanyy UPrime2Meanyz UPrime2Meanzz (u'u' u'v' u'w' v'v' v'w' w'w').

LijieNPIC June 14, 2011 04:28

Quote:

Originally Posted by morard (Post 311899)
Hi LijieNPIC,

I'm glad to hear that! :)
You can extract all components of UPrime2Mean tensor by using foamCalc. If you don't know how to use it, just type the following:

foamCalc components UPrime2Mean

This will extract UPrime2Meanxx UPrime2Meanxy UPrime2Meanxz UPrime2Meanyy UPrime2Meanyz UPrime2Meanzz (u'u' u'v' u'w' v'v' v'w' w'w').

Morard, thank you very much. Your suggestion is very helpful to me.

morard June 14, 2011 04:30

You are welcome :)


All times are GMT -4. The time now is 23:57.