Factors for the cubic inerpolation scheme in OpenFOAM
Dear all,
I have a question regarding the used factors for the cubic interpolation scheme in OpenFOAM. Below you can see a part of the code for the cubic interpolation scheme: Code:
virtual bool corrected() const phi_E=lambda*phi_P+(1lambda)*phi_N+kSc*phi_PkSc*phi_N+kVecP*gradPhi_P+kVecN*gradphi_N Here phi_P and phi_N are the values at the owner and neighbor point and gradphi_P and gradphi_N the gradients at the mentioned points.But by the use of a normal cubic polynomial function (f(x)=ax³+bx²+cx+d) for the interpolation of the surface value with given values and gradients for the owner and neighbor points as conditions I get another correlation with the defined factors in the above code: phi_E=lambda*phi_P+(1lambda)*phi_NkSc*phi_P+kSc*phi_NkVecN*gradPhi_PkVecP*gradphi_N The differences are the opposite signs and the exchange of the factors. I have tried lot of other numerical interpolation ways to come on the same correlation as used in OpenFOAM but i wasnt sucessful till yet. Does anyone knows how one gets the correlation which is used in OpenFOAM respectively which interpolation technique gives this correlation with the given values and gradients at the owner and neighbor point? Thanks in advance for answers and hopefully someone can give me an advise regarding this problem. 
I have no deep look into the problem but I am also interesting in that. When lambda is equal to 0.5 both formulas give the same result. Could you post your derivation of the formula please? Of course if it does not cause you any inconvenience :)

Cubic scheme derivation
Hey, guys. I have found the same problem as Hoshang met. I post my derivation of cubic interpolation here, if someone can find any errors, plz feel free to point out.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Given the value of the variable and its gradient at point P and N, assume a cubic polynomial variation in the section PN, derive the variable value at the face f. https://github.com/DanielUCAS/image...e.jpg?raw=true thus a,b,c,d can be solved, then the variation of in PN can be expressed as %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% The last equation is what exactly Hoshang gave, which is not the same implemented in OpenFOAM. Best wishes Yu Cheng 
Hello, Yu Cheng!
I have checked your derivation and found it to be correct, except one misprint in the formula for : it should be equal to . I think one should report the bug (https://bugs.openfoam.org/bug_report_page.php). 
Change the misspelling
Yes, you are right, I have changed the original formula, and I think I should better report this to the OpenFOAM official. Thank you.
Best wishes. Yu Cheng 
Bug report: https://bugs.openfoam.org/view.php?id=2650

Hi Alexander,
Thank you for the report. Best wishes, Yu Cheng 
Gradients in cubic
Hello everyone!
This is my first post in this awsome forum. I hope this question would not be considered as offtopic, as it is related to the cubic scheme. I started to use openFoam recently, and I'm sure, it is possible to find the answer from the code, but I can't. Therefore I'd gratefull, if anyone could tell me how the gradients are calculated for the cubic scheme. I mean, are the schemes used from fvSchemes, or are they 'hard wired' in the code for this interpolation scheme. Thanks in advance. 
Quote:
The scheme for gradient evaluation is hardcoded for cubic interpolation and it is Gauss. 
Quote:
What do you think, is it possible to change it to fourth for instance? Is it enough to modify the lines: #include "gaussGrad.H" to #include "fourthGrad.H" and >::interpolate ( fv::gaussGrad to >::interpolate ( fv::fourthGrad ? Or use some limiting somehow? 
Quote:

Quote:

Quote:

Quote:

Hi Sahas,
I read your bug report and the comments. Interesting fact. Right now I could imagine that if you have shockwave propagation, the results might be different based on the gradients of neighbor/owner which are way much more pronounced in such cases than normal ones. Which cases did you check out for your report? 
Quote:
I have also seen that report. However, I'm not completely sure about my derivation, but if you change how λ is defined above, from f(x=1λ) to f(x=λ), the same coefficients as implemented in openFoam currently can be derived. 
Quote:
I have tried a simple unsteady case of 1D flow with sinusoidal varying velocity at inlet, using uniform and nonuniform grids. The difference between realizations of the cubic scheme is observed only on nonuniform grid and it is quite small (switching to linear or linearUpwind scheme has greater effect). As for shockwave case, due to the fact that cubic scheme is central scheme it would be hard to get nonoscillating solution for this case. And again, differences in realizations can be only seen on nonuniform grids, where other numerical errors begin to play the role. To summarize, the current implementation gives small errors in a final solution. Perhaps, the effect is strong in the some cases of DNS of turbulence. But DNS is not very suitable to be a simple test case :) 
All times are GMT 4. The time now is 04:36. 