|
[Sponsors] |
July 19, 2019, 05:37 |
WENO Schemes for OpenFOAM v5
|
#1 |
Senior Member
Nguyen Duy Trong
Join Date: Apr 2014
Posts: 124
Rep Power: 12 |
Hi everyone,
I am trying to apply WENO scheme that is build based on OpenFOAM v2.3 to OpenFOAM v5. https://github.com/TobiasMartin/WENO...bWENOEXT-2.3.x However, when i compile the new library I got error as shown in the attached figure. It would be appreciate if could someone help me to fix this error. Thanks and Best regards |
|
July 20, 2019, 07:52 |
|
#2 |
Senior Member
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15 |
The definition of the factorial function changed from of 2.3 to 5. In 2.3 it takes a scalar as argument and returns a scalar. In 5 it takes a label (int) as argument and returns a label. So you have to change the function calls in the weno schemes accordingly.
|
|
July 20, 2019, 14:50 |
|
#3 |
Senior Member
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 21 |
Your library runs this code:
Code:
Foam::scalar Foam::geometryWENO::Fac(scalar x) { if (x <= 0) return 1.0; else { return Foam::factorial(x); } } Code:
Foam::factorial(x) There are 2 versions of overloaded function factorial in OpenFOAM, with function parameters being uLabel and label: Code:
54 Foam::uLabel Foam::factorial(uLabel n) 55 { 56 static uLabel factTable[13] = 57 { 58 1, 1, 2, 6, 24, 120, 720, 5040, 40320, 59 362880, 3628800, 39916800, 479001600 60 }; 61 62 #ifdef FULLDEBUG 63 if (n > 12) 64 { 65 FatalErrorInFunction 66 << "n value out of range (> 12)" 67 << abort(FatalError); 68 } 69 #endif 70 71 return factTable[n]; Code:
63 Foam::label Foam::factorial(label n) 64 { 65 static label factTable[13] = 66 { 67 1, 1, 2, 6, 24, 120, 720, 5040, 40320, 68 362880, 3628800, 39916800, 479001600 69 }; 70 71 #ifdef FULLDEBUG 72 if (n > 12 && n < 0) 73 { 74 FatalErrorInFunction 75 << "n value out of range" 76 << abort(FatalError); 77 } 78 #endif 79 80 return factTable[n]; 81 } Code:
return Foam::factorial(static_cast<uLabel>(x)); |
|
July 20, 2019, 15:20 |
|
#4 | |
Senior Member
Timofey Mukha
Join Date: Mar 2012
Location: Stockholm, Sweden
Posts: 118
Rep Power: 14 |
Quote:
I've been in contact with Tobias, the author of the library, and offered to upgrade the library so that it compiles across most version of OF and he agreed. I will get this done in the next month. That being said, I quickly patched the library to get it compiled on OFv1806, check the fork by timofeymukha on GitHub. The downside is that the tutorial crashed . I hope me and Tobias together can make things work. |
||
July 23, 2019, 01:41 |
|
#5 | |
Senior Member
Nguyen Duy Trong
Join Date: Apr 2014
Posts: 124
Rep Power: 12 |
Quote:
Could you please share with me some update, I also would like to read to get more understanding OpenFOAM. Thanks and Best regards |
||
November 18, 2019, 06:07 |
|
#6 |
Senior Member
Timofey Mukha
Join Date: Mar 2012
Location: Stockholm, Sweden
Posts: 118
Rep Power: 14 |
Dear all,
I am happy to say that after me and Tobias having put in some work, the library should now work for modern OpenFOAM versions, both .org and .com. Please feel free to test it. I should say directly that any questions regarding the functionality are better directed at Tobias, since I've only helped with the version upgrade, but now little about how the code functions. Best, Timofey |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Fundamental questions about numerical schemes | Obad | OpenFOAM Running, Solving & CFD | 1 | May 10, 2021 10:40 |
Transitional Flat Plate Simulation + WENO Schemes | hxaxtma | OpenFOAM | 1 | May 29, 2017 10:26 |
ENO and WENO schemes | sachinsiitkgp | Main CFD Forum | 12 | February 18, 2016 13:03 |
Sods problem: Oscillations with WENO schemes | Ironiker | System Analysis | 0 | May 31, 2015 16:57 |
ENO and WENO schemes | HaKu | Main CFD Forum | 1 | April 5, 2011 22:49 |