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

[CoSim] Incorrect residuals in ConvergenceCriteria #12394

Open
juancamarotti opened this issue May 21, 2024 · 4 comments
Open

[CoSim] Incorrect residuals in ConvergenceCriteria #12394

juancamarotti opened this issue May 21, 2024 · 4 comments

Comments

@juancamarotti
Copy link

juancamarotti commented May 21, 2024

Issue

During coupled simulations, the initial residual of subdomains is not updated between coupling iterations. The convergence criterion is using incorrect residuals.

Reproducer

To reproduce, run the FSI mok example setting the structural domain echo level to 4 and looking at how the initial residual norm changes between coupling iterations (Spoiler alert: it does not change).

Bug

The initial residual of ConvergenceCriteria is updated in ConvergenceCriteria::InitializeSolutionStep, which is in turn called when the structural solver's InitializeSolutionStep is called.

In the GaussSeidelStrongCoupledSolver, the ConvergenceCriteria of the structural domain is initialized once per time step (and not once per coupling iteration).

FYI @philbucher @KratosMultiphysics/technical-committee

@philbucher
Copy link
Member

nice catch!

No wonder it never really worked for us, we basically always used the other criteria

@juancamarotti
Copy link
Author

Yes! This issue is causing slow convergence with the non-linear shell elements we are using in our coupled simulations.

@matekelemen
Copy link
Contributor

The question is how to fix the bug. As far as I can tell, calling the solver's InitializeSolutionStep and FinalizeSolutionStep during coupling iterations is a no-go because it would flush the solution buffer and thus break time stepping.

A hackish solution I can think of is storing the initial residual in ProcessInfo or ModelPart's DataValueContainer and manually overriding it during coupling iterations, but I don't particularly like this fix.

Any other ideas?

@juancamarotti
Copy link
Author

juancamarotti commented May 23, 2024

After further analysis of the problem, I have concluded that this is not a CoSim issue. The bug is related to the strategy used. Let's consider the ResidualBasedNewtonRaphsonStrategy as an example:

  1. In ResidualBasedNewtonRaphsonStrategy::SolveSolutionStep, the method ConvergenceCriteria::InilitializeNonLinearIteration is called with the LHS and RHS even before invoking the BuilderAndSolver. This implies that the method is called with zero LHS and RHS vectors.

  2. The second issue is that inside ResidualCriteria, the ConvergenceCriteria::InitializeNonLinearIteration method is not overriden. The residual is calculated just once per time step inside ResidualCriteria::InitializeSolutionStep and not once per coupling iteration.

@KratosMultiphysics/technical-committee Why the ConvergenceCriteria::InilitializeNonLinearIteration is called before the BuilderAndSolver?

FYI @matekelemen @philbucher

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants