CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

WENO Schemes for OpenFOAM v5

Register Blogs Community New Posts Updated Threads Search

Like Tree7Likes
  • 2 Post By mAlletto
  • 1 Post By Zeppo
  • 3 Post By tiam
  • 1 Post By tiam

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 19, 2019, 05:37
Default WENO Schemes for OpenFOAM v5
  #1
Senior Member
 
Nguyen Duy Trong
Join Date: Apr 2014
Posts: 124
Rep Power: 12
ndtrong is on a distinguished road
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
Attached Images
File Type: jpg Factorial.jpg (198.9 KB, 91 views)
ndtrong is offline   Reply With Quote

Old   July 20, 2019, 07:52
Default
  #2
Senior Member
 
Michael Alletto
Join Date: Jun 2018
Location: Bremen
Posts: 615
Rep Power: 15
mAlletto will become famous soon enough
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.
ndtrong and vivek05 like this.
mAlletto is offline   Reply With Quote

Old   July 20, 2019, 14:50
Default
  #3
Senior Member
 
Zeppo's Avatar
 
Sergei
Join Date: Dec 2009
Posts: 261
Rep Power: 21
Zeppo will become famous soon enough
Your library runs this code:
Code:
Foam::scalar Foam::geometryWENO::Fac(scalar x)
{
	if (x <= 0) return 1.0;	
	else
	{	
		return Foam::factorial(x);
	}
}
It is
Code:
Foam::factorial(x)
that fails to compile.
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 }
Try this to see if it works
Code:
return Foam::factorial(static_cast<uLabel>(x));
ndtrong likes this.
Zeppo is offline   Reply With Quote

Old   July 20, 2019, 15:20
Default
  #4
Senior Member
 
Timofey Mukha
Join Date: Mar 2012
Location: Stockholm, Sweden
Posts: 118
Rep Power: 14
tiam is on a distinguished road
Quote:
Originally Posted by ndtrong View Post
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

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.
louisgag, ndtrong and mAlletto like this.
tiam is offline   Reply With Quote

Old   July 23, 2019, 01:41
Default
  #5
Senior Member
 
Nguyen Duy Trong
Join Date: Apr 2014
Posts: 124
Rep Power: 12
ndtrong is on a distinguished road
Quote:
Originally Posted by tiam View Post
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.
Thank you very much with your information.
Could you please share with me some update, I also would like to read to get more understanding OpenFOAM.

Thanks and Best regards
ndtrong is offline   Reply With Quote

Old   November 18, 2019, 06:07
Default
  #6
Senior Member
 
Timofey Mukha
Join Date: Mar 2012
Location: Stockholm, Sweden
Posts: 118
Rep Power: 14
tiam is on a distinguished road
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
mAlletto likes this.
tiam is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 10:30.