Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run MFNavierStokesPreconditionGMG in float #1319

Merged
merged 4 commits into from
Oct 19, 2024
Merged

Run MFNavierStokesPreconditionGMG in float #1319

merged 4 commits into from
Oct 19, 2024

Conversation

peterrum
Copy link
Collaborator

No description provided.

using OperatorType = NavierStokesOperatorBase<dim, double>;
using SmootherPreconditionerType = PreconditionBase<VectorType>;
using Number = double;
using MGNumber = float;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The place to switch between float and double.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might need a compiler flag to change this accordingly?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure how a compiler flag would help. Switching between float and double directly in the code could seems to be easy enough.

@blaisb
Copy link
Contributor

blaisb commented Oct 15, 2024

@peterrum I think the test that was breaking was breaking because the coarse grid solver was not a direct solver (for no reason at all). @lpsaavedra I think we should change the default behaviour of the coarse grid solver so that default is direct. In general, except in very particular cases, we should always use the direct solver I think.

@lpsaavedra
Copy link
Collaborator

I have been checking the reason why this test is not working and I realized that the same happens for the master version in both release and debug mode. It seems that the direct solver (as coarse grid solver) does not work when specifying a number of minimum cells for the levels. If we set this to -1, it works just fine. I can modify this accordingly... however, I need a long term solution for this, so I will keep looking.

@blaisb I agree with you that we should in fact change this to default and use it for all tests. I will try this change now and see if I encounter similar problems.

@lpsaavedra
Copy link
Collaborator

In any case, without specifying the minimum number of cells (i.e., using the coarsest level for the coarse solver), we do get the exact same values for the enstrophy for 1 second using both float and double. I guess this is good, but I think I will have to run a complete TGV problem to see what is the effect of changing this to float. I will keep you posted.

@blaisb
Copy link
Contributor

blaisb commented Oct 15, 2024

In any case, without specifying the minimum number of cells (i.e., using the coarsest level for the coarse solver), we do get the exact same values for the enstrophy for 1 second using both float and double. I guess this is good, but I think I will have to run a complete TGV problem to see what is the effect of changing this to float. I will keep you posted.

Perfect. Maybe that's because the direct solver would need the set pressure dirichlet to true to fix the pressure reference? In the end this is a periodic problem so the pressure reference can be illposed.

@lpsaavedra
Copy link
Collaborator

Yes, you are right, that seems to fix it as well. I will update the test in this branch. Do we want to keep the minimum number of cells or do we fix the pressure constant? Do you have any preference?

@blaisb
Copy link
Contributor

blaisb commented Oct 15, 2024

Yes, you are right, that seems to fix it as well. I will update the test in this branch. Do we want to keep the minimum number of cells or do we fix the pressure constant? Do you have any preference?

I don't have a preference, but I feel like fixing the pressure reference is a more robust solution. i'll trust your judgment here :)

@peterrum
Copy link
Collaborator Author

@lpsaavedra Thank you fixing the issue with the test. The issue seems to be unrelated to the current PR. What about extracting those changes in a seperate PR, which we first merge?

@lpsaavedra
Copy link
Collaborator

I have fixed the test in a different PR (#1321).

@blaisb
Copy link
Contributor

blaisb commented Oct 16, 2024

Perfect, we can rebase this PR.
I'm not sure I would make float the default for now until we have a better understanding of if this has consequences, but if you need help @lpsaavedra I can help you make it a compile flag

@lpsaavedra
Copy link
Collaborator

I have added a compiler flag for this feature

Copy link
Collaborator Author

@peterrum peterrum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx!

CMakeLists.txt Outdated Show resolved Hide resolved
@blaisb blaisb merged commit 294e433 into master Oct 19, 2024
11 checks passed
@blaisb blaisb deleted the float branch October 19, 2024 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants