CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Oscillating drag coefficient (https://www.cfd-online.com/Forums/openfoam-solving/148337-oscillating-drag-coefficient.html)

gamma_user February 9, 2015 19:37

Oscillating drag coefficient
 
3 Attachment(s)
Hello,

I am new to OpenFOAM and I am trying to simulate the supersonic flow of air (Mach 3) past a circular cone of semi-angle 10 degrees. When I plot the drag coefficient (Cd) as a function of the number of iterations, Cd seems to converge, but when I zoom in, some oscillation appears. How can I increase the precision of the calculation in order to reduce this oscillation? The main files are attached.

Attachment 37079

Attachment 37080

Attachment 37081

thiagopl February 10, 2015 12:43

Notice that you write your results with writePrecision 6 and your oscillations are of 0.0001. Try to increase the writePrecision.

The oscillations are of 0.05%, do you need more than this? :)

gamma_user February 10, 2015 14:39

1 Attachment(s)
Quote:

Originally Posted by thiagopl (Post 531268)
Notice that you write your results with writePrecision 6 and your oscillations are of 0.0001. Try to increase the writePrecision.

The oscillations are of 0.05%, do you need more than this? :)

I changed writePrecision from 6 to 12 and tolerance (fvSolution) from 1e-3 to 1e-9, but the solution is still the same. Indeed, I need a numerical solution with minimal iteration error in order to estimate its discretization error and its order of accuracy (verification procedure).

Attachment 37102

Blanco February 11, 2015 06:04

If you want to avoid precision-writing issues then it's better if you change your writeFormat to binary. I suggest also to change tolerance to something like 1e-16, if you really need to have this high precision in the results.
Try changing fvSchemes dict and use higher precision schemes.
But, again, as thiagopl said you are getting oscillations that are 0,05% the mean value...

gamma_user February 11, 2015 08:10

1 Attachment(s)
Quote:

Originally Posted by Blanco (Post 531354)
If you want to avoid precision-writing issues then it's better if you change your writeFormat to binary. I suggest also to change tolerance to something like 1e-16, if you really need to have this high precision in the results.
Try changing fvSchemes dict and use higher precision schemes.
But, again, as thiagopl said you are getting oscillations that are 0,05% the mean value...

I followed your instructions (except by the schemes) and increased the number of iterations, but the oscillations are still there...

Attachment 37116

I agree that for some applications the precision of 0.05% is enough, but for verification, it is not.

Blanco February 11, 2015 08:33

You'll never obtain a smooth horizontal line for your Cd, probably. This can be caused by different things: turbulence model (obviously), mesh quality, mesh resolution, approximation used to model the problem, etc.

You said you are doing a verification test, therefore your goal is to compare CFD results with analytic results coming from some equation, on a very simple geometry I guess. For the reference, how far is your CFD result from the analytic result? Moreover, are you monitoring only the Cd value? Please consider that this is a "global" value, I would suggest to consider the pressure distribution along the geometry, or some local variable, to do a verification of a model implementation in the CFD code.

We have also to remember that sometimes we are modeling things as "stady-state" but this is only an approximation (i.e. turbulence is never a steady state phenomenon). That's why we judge converge of the sim by looking at some important overall value, waiting until it is "smooth enough", were this "enough" has be decided (considered with care) by the analyst.

Regards

Blanco February 11, 2015 08:36

Quote:

Originally Posted by gamma_user (Post 531377)
...

I agree that for some applications the precision of 0.05% is enough, but for verification, it is not.

Well, 0,05% can be accepted or not for a verification case, you're the one that have to decide in this case.

As a reference...I think NASA people would accept 0,05% error in a verification case, look here

HTML Code:

http://turbmodels.larc.nasa.gov/flatplate_w06.html

gamma_user February 11, 2015 15:26

Hello, Andreas and Thiago,

I appreciate your help very much, but my problem is not solved yet.

I believe I am not using a turbulence model. I set "simulationType laminar;" in the turbulenceProperties dictionary. Is it right?
The only reason I am using the turbulence dictionary is that the calculation of the drag coefficient depends on that (I could not remove this dictionary).

Anyway, I think the iteration error should reduce to the machine precision as the number of iterations increase, independently of the mesh, as can be seen in the following paper (figure 7):
* Roy, C.; McWherter-Payne, M. & Oberkampf, W. Verification and validation for laminar hypersonic flowfields, part 1: Verification AIAA Journal, {2003}, {41}, {1934-1943}

The iteration error at the n-th iteration is defined as
E_n = phi_n-phi_inf,
where phi_n is the numerical solution at the n-th iteration and phi_inf is the exact solution to the linear system.

Is there any other suggestion about this question? What kind of scheme should I use?

Blanco February 11, 2015 17:31

Hi,

I've given a look at the reference you cited and I've noticed, as expected, that local flow variables are considered to calculate iterative convergence error, not a global variable like Cd. This because a global variable can't tell you all you need to know to assure that your code is validated. So again, I suggest you to move to local variables if you are interested in a verification of your code (which, for reference, require to compute numerical error and not just iterative convergence error. You'll have to work also on grid error and grid refinements, my previous suggestion related to the grid was done while supposing that you were looking at the numerical error).

The only figure which is referred to cd is figure 9, but you can see that 400k iterations are needed in that case to reach 1e-12% iterative convergence error, in the best case, on the finer grid! Therefore if you would like to reach this kind of iterative convergence error I warmly suggest you to use high order precision schemes for your fvSchemes dict and prepare for a long sim. Please, consider the detail of the solver you are using (segregated?) and search in the fvschemes the best one that can help you in speeding up the convergence rate.

Btw, have you tried to compute your actual iterative convergence error? I would suggest you to try to evaluate it using eq.s 5 and 6 and NOT considering the exact solution of the analytic model...this because you are using a grid for your sim, therefore you will have a discretization error affecting your results, but you don't know how much it is and you don't want to mix the discretization error with the iterative convergence error. Using eq 5 and 6 you are indirectly computing the "exact" solution and the error from the last 3 results in the iterative scheme, therefore the discretization error is transparent in this case and you'll obtain only the iterative convergence error. Moreover, what is the magnitude of the residuals that you have reached? Are the tolerances low enough to keep the solver iterating in each time step (so no 0 iterations are obtained)?

Best


All times are GMT -4. The time now is 12:38.