-
Notifications
You must be signed in to change notification settings - Fork 9
first pass at creating interface for navier stokes krylov solver #1823
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2242,6 +2242,20 @@ def get_solver_json( | |
| ) | ||
| translated["navierStokesSolver"] = dump_dict(model.navier_stokes_solver) | ||
|
|
||
| ns_dict = translated["navierStokesSolver"] | ||
| ls_dict = ns_dict.setdefault("linearSolver", {}) | ||
| if not model.navier_stokes_solver.use_krylov_solver: | ||
| ls_dict.pop("maxPreconditionerIterations", None) | ||
| elif "maxPreconditionerIterations" not in ls_dict: | ||
| ls_dict.setdefault("maxPreconditionerIterations", 25) | ||
| ls_dict.setdefault("krylovRelativeTolerance", 0.05) | ||
| if "lineSearch" not in ns_dict: | ||
| ns_dict["lineSearch"] = { | ||
| "residualGrowthThreshold": 0.85, | ||
| "maxResidualGrowth": 1.1, | ||
| "activationStep": 100, | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Duplicated Krylov defaults in validator and translatorLow Severity The Additional Locations (1) |
||
|
|
||
| replace_dict_key(translated["navierStokesSolver"], "typeName", "modelType") | ||
| if isinstance(op, LiquidOperatingCondition) and not ( | ||
| model.navier_stokes_solver.private_attribute_dict is not None | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translator doesn't strip Krylov fields when solver disabled
Medium Severity
When
use_krylov_solverisFalse, the translator only popsmaxPreconditionerIterationsfromls_dictbut doesn't stripkrylovRelativeTolerancefromls_dictorlineSearchfromns_dict. The model validator in_populate_krylov_defaultswarns that these values "will be ignored" (without raising an error), so a user can set them and they survive throughdump_dictinto the translated output — contradicting the warning and potentially causing unexpected solver behavior.Additional Locations (1)
flow360/component/simulation/models/solver_numerics.py#L210-L220