Skip to content

refactor: couple of issues in launch fluent#4990

Open
mayankansys wants to merge 31 commits into
mainfrom
refactor/couple_issues_launch_fluent
Open

refactor: couple of issues in launch fluent#4990
mayankansys wants to merge 31 commits into
mainfrom
refactor/couple_issues_launch_fluent

Conversation

@mayankansys

@mayankansys mayankansys commented Mar 12, 2026

Copy link
Copy Markdown
Collaborator

Context

Case/case-data files should be handled before journal files, and in lightweight mode journal reading should finish before sync starts.

Change Summary

This PR fixes the launch order in launch_fluent(). It makes sure case/case-data loading happens before journal processing, and in lightweight mode it delays sync until journal execution is complete.

Impact

This affects Fluent launch behavior when using case files, case-data files, journal files, and lightweight mode. Tests were added to cover these cases.

@github-actions github-actions Bot added the enhancement Improve any current implemented feature label Mar 12, 2026
@codacy-production

codacy-production Bot commented Apr 1, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@mayankansys mayankansys linked an issue Jun 16, 2026 that may be closed by this pull request
@mkundu1

mkundu1 commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

@mayankansys Is the following happening in the lightweight-mode?

bg session: read case + settings -> read journals -> make this as the main session -> apply changes that user made in the fg session
fg session: read settings -> start accepting changes from user -> shutdown after the main session is transferred

The journals should be read in the background session which reads the full mesh before it.

Additionally, I think the journals should be read in the foreground session also, because use will expect the journal is already read when they start making change in the activated foreground session. But I'm not sure if the journal has, e.g., a solve call, whether that will be a no-op when only settings are read.

@mayankansys

Copy link
Copy Markdown
Collaborator Author

@mayankansys Is the following happening in the lightweight-mode?

bg session: read case + settings -> read journals -> make this as the main session -> apply changes that user made in the fg session fg session: read settings -> start accepting changes from user -> shutdown after the main session is transferred

The journals should be read in the background session which reads the full mesh before it.

Additionally, I think the journals should be read in the foreground session also, because use will expect the journal is already read when they start making change in the activated foreground session. But I'm not sure if the journal has, e.g., a solve call, whether that will be a no-op when only settings are read.

Thanks @mkundu1 for the question and to make sure I understand before I rework on this:

The PR fixes the ordering but you're pointing at a separate problem which was, In lightweight mode the journals currently run on the foreground settings whihc doesn't have mesh.
I agree that's wrong for the mesh-dependent journals. A journal that calls the solve needs the mesh, so should I run on the background session that reads the full mesh matching the order which you described.

If the journal has solver call then I expect a solve in settings only session to either error or no-op which is more evidence the journals belong on the bg session. Kindly let me know what's you take on it.

One issue while implementation can be the bg session is inside read_case_lightweight() but journal reading currently happens in the launchers process_case_data_and_journals which has no handle to the bg session.
For doing this properly I think we need to move the journal reading into the lightweight read path.

Before I move forwards kindly let me know:

  • Am I understading the thing properly and am I on the correct path ?
  • Should Journals run only on the bg session or is there a case where they also need to run in the fg session ?

@github-actions github-actions Bot added documentation Documentation related (improving, adding, etc) examples Publishing PyFluent examples maintenance General maintenance of the repo (libraries, cicd, etc) dependencies Related to dependencies CI/CD labels Jun 17, 2026
@mayankansys mayankansys requested a review from mkundu1 June 22, 2026 18:20
@mkundu1

mkundu1 commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

@mayankansys For the case/data+journal combination we can pass the case file name via the -case command line flag of Fluent (there is also -data command line flag for data files), Fluent will figure out how to read the case/data+journal combination and we can avoid any client-side logic/assumptions.

You can start Fluent with -help command line flag to see all supported command line flags.

Comment thread src/ansys/fluent/core/launcher/error_warning_messages.py Outdated
@mkundu1

mkundu1 commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

@mayankansys For the case/data+journal combination we can pass the case file name via the -case command line flag of Fluent (there is also -data command line flag for data files), Fluent will figure out how to read the case/data+journal combination and we can avoid any client-side logic/assumptions.

You can start Fluent with -help command line flag to see all supported command line flags.

Was this considered? My primary intention is to avoid any client-side duplication of logic for the read-sequence.

We can use the command-line flags all the time even if only case or only journal name is provided. We can get rid of all the defered_journal_read logic in the current PR.

@mkundu1

mkundu1 commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator
Launch argument Implementation
case/data journals(s) lightweight_mode
FALSEFALSEFALSENo-op
FALSEFALSETRUEWarn and ignore lightweight_mode, then no-op
FALSETRUEFALSEPass -i to Fluent
FALSETRUETRUEWarn and ignore lightweight_mode, then pass -i to Fluent
TRUEFALSEFALSEPass -case/-data to Fluent
TRUEFALSETRUEKeep current implementation with fg/bg sessions
TRUETRUEFALSEPass -case/-data and -i to Fluent
TRUETRUETRUEWarn and ignore lightweight_mode, then pass -case/-data and -i to Fluent
Above is the implementation plan in my mind.

@mayankansys mayankansys marked this pull request as ready for review July 9, 2026 06:22
"journal_file_names"
):
warn(LIGHTWEIGHT_MODE_IGNORED_WITH_JOURNAL, UserWarning)
self.argvals["lightweight_mode"] = False

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Similar to the earlier conversations on this method (see below), this continues a pattern I've flagged before: accumulation of low-level, untested branching logic. I understand this follows the existing style of the method, but each addition makes the eventual refactor larger and the method harder to review as a whole.

I'd like to see argument-validation branches like this (and the timeout-string construction from before) extracted into small, testable methods rather than added inline. Given this has come up multiple times now, including in internal meetings, please treat this as a standing convention going forward, not a case-by-case judgment call.

Image

Final changes to the same method in same PR:

Image

@seanpearsonuk seanpearsonuk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

As per my comment.

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

Labels

CI/CD dependencies Related to dependencies documentation Documentation related (improving, adding, etc) enhancement Improve any current implemented feature examples Publishing PyFluent examples maintenance General maintenance of the repo (libraries, cicd, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Couple of issues in launch_fluent

4 participants