|
[Sponsors] |
August 1, 2014, 11:42 |
LimitedScheme source code understanding
|
#1 |
Member
Lianhua Zhu
Join Date: Aug 2011
Location: Wuhan, China
Posts: 35
Rep Power: 15 |
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 LimiterFunc> 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)); } }; Thanks, Lianhua Last edited by zhulianhua; August 1, 2014 at 11:43. Reason: typo |
|
August 1, 2014, 11:45 |
The link to the code above
|
#2 | |
Member
Lianhua Zhu
Join Date: Aug 2011
Location: Wuhan, China
Posts: 35
Rep Power: 15 |
The code in the post is from here:
https://github.com/OpenFOAM/OpenFOAM...Leer/vanLeer.H Quote:
|
||
August 2, 2014, 08:03 |
|
#3 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,901
Rep Power: 37 |
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, 09:42 |
|
#4 |
Member
Lianhua Zhu
Join Date: Aug 2011
Location: Wuhan, China
Posts: 35
Rep Power: 15 |
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, 10:48 |
|
#5 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,901
Rep Power: 37 |
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, 12:43 |
|
#6 |
New Member
Vahid E.
Join Date: Jul 2014
Posts: 6
Rep Power: 12 |
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, 09:01 |
|
#7 | |
Member
|
Quote:
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. For more information please read the chapter 3.2 of the OF User Manual Jibran |
||
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] swak4foam building problem | GGerber | OpenFOAM Community Contributions | 54 | April 24, 2015 16:02 |
OpenFOAM without MPI | kokizzu | OpenFOAM Installation | 4 | May 26, 2014 09:17 |
Help for the small implementation in turbulence model | shipman | OpenFOAM Programming & Development | 25 | March 19, 2014 10:08 |
centOS 5.6 : paraFoam not working | yossi | OpenFOAM Installation | 2 | October 9, 2013 01:41 |
pisoFoam compiling error with OF 1.7.1 on MAC OSX | Greg Givogue | OpenFOAM Programming & Development | 3 | March 4, 2011 17:18 |