LimitedScheme source code understanding

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

 August 1, 2014, 12:42 LimitedScheme source code understanding #1 Member   Lianhua Zhu Join Date: Aug 2011 Location: Wuhan, China Posts: 35 Rep Power: 13 Hi! all, I'm reading the source code of the van Leer limiter based surface interpolation scheme. I think I need your help to understand some of the code below: Code: ```template class vanLeerLimiter : public LimiterFunc { public: vanLeerLimiter(Istream&) {} scalar limiter ( const scalar, const scalar faceFlux, const typename LimiterFunc::phiType& phiP, const typename LimiterFunc::phiType& phiN, const typename LimiterFunc::gradPhiType& gradcP, const typename LimiterFunc::gradPhiType& gradcN, const vector& d ) const { scalar r = LimiterFunc::r ( faceFlux, phiP, phiN, gradcP, gradcN, d ); return (r + mag(r))/(1 + mag(r)); } };``` Where can I find the source code for the definition of function r() and the phiType/gradPhiType? Thanks, Lianhua Last edited by zhulianhua; August 1, 2014 at 12:43. Reason: typo

August 1, 2014, 12:45
The link to the code above
#2
Member

Lianhua Zhu
Join Date: Aug 2011
Location: Wuhan, China
Posts: 35
Rep Power: 13
The code in the post is from here:

https://github.com/OpenFOAM/OpenFOAM...Leer/vanLeer.H

Quote:
 Originally Posted by zhulianhua Hi! all, I'm reading the source code of the van Leer limiter based surface interpolation scheme. I think I need your help to understand some of the code below: Code: ```template class vanLeerLimiter : public LimiterFunc { public: vanLeerLimiter(Istream&) {} scalar limiter ( const scalar, const scalar faceFlux, const typename LimiterFunc::phiType& phiP, const typename LimiterFunc::phiType& phiN, const typename LimiterFunc::gradPhiType& gradcP, const typename LimiterFunc::gradPhiType& gradcN, const vector& d ) const { scalar r = LimiterFunc::r ( faceFlux, phiP, phiN, gradcP, gradcN, d ); return (r + mag(r))/(1 + mag(r)); } };``` Where can I find the source code for the definition of function r() and the phiType/gradPhiType? Thanks, Lianhua

 August 2, 2014, 09:03 #3 Senior Member   Niels Gjoel Jacobsen Join Date: Mar 2009 Location: Copenhagen, Denmark Posts: 1,894 Rep Power: 35 Hallo Lianhua, Note that the file you have shown is a templated class in the type name "LimiterFunc", why you cannot directly find that class. I believe that this is a template in e.g. the NVDTVD and NVDTVDV definitions, which you will find here: https://github.com/OpenFOAM/OpenFOAM...eme/NVDVTVDV.H and https://github.com/OpenFOAM/OpenFOAM...cheme/NVDTVD.H These are then invoked through the macros in e.g. vanLeer.C. I am not 100% sure that this is the correct understanding of the source code, as it borders my current understanding of the C++ language. I hope, nonetheless, that this will help you on your way. Kind regards, Niels __________________ Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.

 August 2, 2014, 10:42 #4 Member   Lianhua Zhu Join Date: Aug 2011 Location: Wuhan, China Posts: 35 Rep Power: 13 Hello, Neils Thanks for your reply. It really helps me. Yes, I have never seen such C++ usage on textbooks and web -- The base class is a template! I even don't know how to google this kind of usage. Best, Lianhua

 August 2, 2014, 11:48 #5 Senior Member   Niels Gjoel Jacobsen Join Date: Mar 2009 Location: Copenhagen, Denmark Posts: 1,894 Rep Power: 35 Yes, I know. It is pretty advanced stuff Kind regards, Niels __________________ Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.

 August 4, 2014, 13:43 #6 New Member   Vahid E. Join Date: Jul 2014 Posts: 6 Rep Power: 10 I wanted to add a new limiter scheme such as "stacs" in openFOAM. I've already written the codes, however, I dont know how shall i compile and add it to openFOAM. please note that I'm new in openFOAM environment and the interface is unfamiliar for me. thanks a million.

August 5, 2014, 10:01
#7
Member

Jibran
Join Date: Oct 2012
Location: UK
Posts: 61
Blog Entries: 1
Rep Power: 13
Quote:
 Originally Posted by yourvahid I wanted to add a new limiter scheme such as "stacs" in openFOAM. I've already written the codes, however, I dont know how shall i compile and add it to openFOAM. please note that I'm new in openFOAM environment and the interface is unfamiliar for me. thanks a million.
Hi,

I suppose you have already added the .C and .H files in the relevant folder (for ex. \src\finiteVolume\interpolation\surfaceInterpolati on....). Then edit the 'files' and 'options' files in the 'Make' folder in \src\finiteVolume. Then compile it with 'wclean libso && wmake libso'. Finally make sure that your solver picks up the newly compiled library.

Jibran