WENO-OF / WENOEXT

Weighted essentially non-oscillatory library for the framework of OpenFOAM
GNU General Public License v3.0
119 stars 64 forks source link

Invalid cells and stencils using Version 4.1 #47

Open JanGaertner opened 2 years ago

JanGaertner commented 2 years ago

Discussed in https://github.com/WENO-OF/WENOEXT/discussions/46

Originally posted by **Fracturist** June 29, 2022 Hello, I have recently noticed appearance of extra invalid cells and stencils in my own test case when using Version 4.1. ![image](https://user-images.githubusercontent.com/103815630/176339304-c7e76fca-fabc-4981-8cb9-5368174fa682.png) Then I checked the log file stored previously for same case using Version 4.0. It seems that everything is fine. ![image2](https://user-images.githubusercontent.com/103815630/176340699-87ce16e2-eb94-428b-af72-92cf3ee60969.png) So I did a rerun for tutorial case using Version 4.1. Serial Cavity case is OK but parallel Cavity case showed an extra invalid cell. Moreover, all cells in Wedge case seem invalid. I am pretty sure that these case was fine with Version 4.0. ![Selection_004](https://user-images.githubusercontent.com/103815630/176341985-62e374e2-03b5-40b6-90a5-cee8365ecb2b.png) The log fie for tutorial cases is here [log.txt](https://github.com/WENO-OF/WENOEXT/files/9006906/log.txt) Can someone give me a hint as to how these happened? Is it due to my compilation or some feature related to new version?
JanGaertner commented 2 years ago

From Version 4.0 to 4.1 the own math functions to calculate the reference space have changed. Before the function to calculate the eigenvalues of a matrix was not generally valid for all 3x3 matrices. This has been fixed in Version 4.1 and now mirrors more the behavior of the LAPACK library. Therefore maybe something small changed with the reference frame, which then changes the transformation matrices.

When I run the test with OpenFOAM v2012 I have no invalid cells for the cavity tutorial. For the wedge case I get the same message of 100% invalid. This is however due to the wedge mesh and I have encountered this error also for previous versions. To circumvent this the checkCondition option can be set to false, then the condition of the central stencil is not checked. If the simulations still run stable it is also no problem to set this option.

If you want you can also check if the result changes when you use the LAPACK library.

Hope this helps understanding it better.

Fracturist commented 2 years ago

Hello Jan,

Thank you for reply and suggestion 😄 . Based on your recommendation, I am running some tests and glad to share my progress with you here.

I tested OpenFOAM v2012/v2106 and WENOEXT 4.0(b6f4978)/4.1(f45593a)

a. You are right. Using the LAPACK library, the cavity case run by both v2012 and v2106 with 4.0/4.1 show no invalid cells. It seems that this problem does relate to the math function. b. For wedge case, I got 100% invalid cells for all the tests as well. This is quite interesting. I am still tring to figure out why. c. I build my own test case of classical incompressible periodic channel flow (PCF). I tested it on my local machine with a small mesh version (200k cells) but got the same number of invalid cells both with 4.0 and 4.1 (LAPACK ON, v2106). The mesh have passed the checkmesh test. Right now I'm not sure if the problem is due to the grid or boundary condition. And I'm not so sure that invalid cells would affect the results. Therefore, I plan to run a full version on our HPC platform with v2012 and 4.1 next week. Hopefully I'll have some valuable results to share by then. log.PCF.WENO4.0.txt log.PCF.WENO4.1.txt d. There is a computation error in the PCF case of 4.0, but I think it is not relevant to the current problem and plan to leave it to be solved in the future if I have time .

To further determine the cause and effect of invalid cells, I may need some of your help. The relevant files under WENOBase seem to be stored in binary format. I used some tools to convert them to ASCIl, but none of them work. Is there any way to make these files human-readable? In addition, I found that when the number of invalid cells exceeded a certain number, the log stopped printing the cell ID. Is there a way to output complete information about these cells so I can locate them, for example in ParaView?

Best,

Fracturist

JanGaertner commented 2 years ago

Hello Fracturist,

the binary format should be able to be converted back into OpenFOAM ASCII lists. However, even in ASCII format the files are very difficult to read, especially the matrices, due to the List of Lists format OpenFOAM uses. But you can do the following:

Fracturist commented 2 years ago

Thank you very much, Jan. This information is very helpful 👍

Once I have any progress I will post here.

linysh1997 commented 10 months ago

Hello, Jan. I have also encountered this problem. My case is simulating a 1D traveling sine wave in periodic domain using scalarTransportFoam without diffusion. The result shows very high numerical dissipation compared to the linear scheme. Is it actually not performing weno scheme if I have the '100% invalid cells' message? I guess it was performing upwind scheme, because the upwind scheme also had very high numerical dissipation result.

Fracturist commented 10 months ago

Hello, Jan. I have also encountered this problem. My case is simulating a 1D traveling sine wave in periodic domain using scalarTransportFoam without diffusion. The result shows very high numerical dissipation compared to the linear scheme. Is it actually not performing weno scheme if I have the '100% invalid cells' message? I guess it was performing upwind scheme, because the upwind scheme also had very high numerical dissipation result.

Hi, Lin. If your case is the linear advection equation with sine wave as the initial value, I suggest you make a comparison between upwind scheme and a series of WENOUpwindFit schemes after some periods. If the results are basically the same at different time, this is a fast way to check whether WENOEXT performed well or not.

JanGaertner commented 10 months ago

Hello,

have you switched off the condition check in the control settings as stated in the README?

If it is switched on then you will have an Upwind Scheme.

checkCondition  false;// Check the condition of the pseudo inverse matrix
                          // If the central stencil has at least one zero entry
                          // the matrix is removed for all stencils of this cell.
linysh1997 commented 10 months ago

Hello,

I previously tried to turn checkCondition off, but at that time I thought the it only ignored the message. Now after turning the checkCondition to false again and visualizing the wave, the numerical dissipation looks as expected. Thank you!