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

[CompressiblePotentialFlowApp] Adding Line Search Strategy to settings #11575

Merged
merged 2 commits into from
Sep 21, 2023

Conversation

Marco1410
Copy link
Contributor

📝 Description
This PR adds the use of the line search strategy in the application.

The use of this method provides better stability in nonlinear problems even in those with strong nonlinearities as occurs in a transonic flow with strongs shocks.

This also allows obtaining better results in cases in which it would not converge using only Newton Raphson.

🆕 Changelog

  • Changed "potential_flow_solver.py"

@Marco1410 Marco1410 requested a review from a team as a code owner September 19, 2023 10:52
Copy link
Contributor

@marcnunezc marcnunezc left a comment

Choose a reason for hiding this comment

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

Looks good to me!

I would just suggest to check if any of the functions
_CreatePotentialFlowLinearStrategy
_CreatePotentialFlowNewtonRaphsonStrategy
_CreatePotentialFlowLineSearchStrategy

can be derived from fluid_solver.py to avoid code duplication, for instance:

def _CreateNewtonRaphsonStrategy(self):
computing_model_part = self.GetComputingModelPart()
time_scheme = self._GetScheme()
convergence_criterion = self._GetConvergenceCriterion()
builder_and_solver = self._GetBuilderAndSolver()
return KratosMultiphysics.ResidualBasedNewtonRaphsonStrategy(
computing_model_part,
time_scheme,
convergence_criterion,
builder_and_solver,
self.settings["maximum_iterations"].GetInt(),
self.settings["compute_reactions"].GetBool(),
self.settings["reform_dofs_at_each_step"].GetBool(),
self.settings["move_mesh_flag"].GetBool())

@Marco1410
Copy link
Contributor Author

Hi @marcnunezc, thanks for the comment.

For the Newton Raphson I see that it would not be a problem, the line search I think is not included in the fluid_solver.py and for the linear strategy I see that has the option to calculate the norm set to false by default.

Screenshot from 2023-09-20 09-50-17

I could use the Newton Raphson and the linear strategy but I should also remove that option from the settings. I don't know if we need to be able to configure this option.

Screenshot from 2023-09-20 09-53-28

I think that would be the only problem.

@marcnunezc
Copy link
Contributor

Hi @marcnunezc, thanks for the comment.

For the Newton Raphson I see that it would not be a problem, the line search I think is not included in the fluid_solver.py and for the linear strategy I see that has the option to calculate the norm set to false by default.

I could use the Newton Raphson and the linear strategy but I should also remove that option from the settings. I don't know if we need to be able to configure this option.

I think that would be the only problem.

Ok! Then I would try to use those functions from the fluid_solver.py, so only the line_search should be on the potential solver.

Regarding the calculate_solution_norm setting, I think we are always using it as false, so it will not affect us. Actually it seems only the potential solver had a setting for it (it was there from the first commit of the file!). The rest of solvers that use it have this option hardcoded.

@Marco1410
Copy link
Contributor Author

Perfect, I already uploaded the changes.

So I think it's ready.

Copy link
Contributor

@marcnunezc marcnunezc left a comment

Choose a reason for hiding this comment

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

Great! thanks

@Marco1410 Marco1410 merged commit f7313b0 into master Sep 21, 2023
@Marco1410 Marco1410 deleted the line_search_for_potential_flow_app branch September 21, 2023 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants