Skip to content

[FXC-4677] [25.10] Add a toggle to monitor output for dumping the result only at the last pseudo step#1894

Open
angranl-flex wants to merge 10 commits intomainfrom
angran/FXC-4670v2
Open

[FXC-4677] [25.10] Add a toggle to monitor output for dumping the result only at the last pseudo step#1894
angranl-flex wants to merge 10 commits intomainfrom
angran/FXC-4670v2

Conversation

@angranl-flex
Copy link
Contributor

@angranl-flex angranl-flex commented Mar 13, 2026

Note

Medium Risk
Adds a new solver-facing toggle that changes when monitor data is written and introduces new validation rules tied to steady/unsteady time stepping, which could affect convergence monitoring and existing workflows if misused.

Overview
Adds output_at_final_pseudo_step_only to monitor-style outputs (ProbeOutput, SurfaceProbeOutput, SurfaceIntegralOutput, ForceOutput) to suppress intermediate pseudo-step writes and only dump results at the final pseudo step.

Propagates the toggle through solver translation (outputAtFinalPseudoStepOnly), includes it in output hashing, and tightens validation: disallow combining the toggle with moving_statistic in steady runs and prevent steady StoppingCriterion from referencing monitors with the toggle enabled.

Updates probe field typing to allow BET metrics (VolumeProbeFieldNames) and refreshes JSON refs plus new unit tests covering validation and translation behavior.

Written by Cursor Bugbot for commit debedb2. This will update automatically on new commits. Configure here.

``output_at_final_pseudo_step_only`` is redundant and not supported."""
if v and cls.__name__.startswith("TimeAverage"):
raise ValueError(
f"`output_at_final_pseudo_step_only` is not supported on {cls.__name__}."
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's not add a base mixin class just for this field. Inline output_at_final_pseudo_step_only into the applicable models.

The problem with the current implementation is that you ended up having a field(output_at_final_pseudo_step_only) that is always invalid in the schema. And then you have to write this validator to check if the invalid model is used.

This is the problem with hierarchical class design. We should really jus separate the TimeAvg classes from the non-TimeAvg classes. The benefit of reducing duplicate definition is drown by the rapid diverge due to feature requirements.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I removed the mixing class and add the field in each class.



# ---------------------------------------------------------------------------
# Field acceptance on the 4 monitor output classes
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you think these tests are necessary? They are more like Pydantic unit test to see if a defined field is actually in the schema.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

@benflexcompute benflexcompute changed the title [FXC-4677] Add a toggle to monitor output for dumping the result only at the last pseudo step [FXC-4677] [25.10] Add a toggle to monitor output for dumping the result only at the last pseudo step Mar 16, 2026
angranl-flex and others added 9 commits March 19, 2026 15:07
Introduce _MonitorOutputSettings mixin with the toggle field and apply it
to SurfaceIntegralOutput, ForceOutput, ProbeOutput, SurfaceProbeOutput.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add field_validator in _MonitorOutputSettings that rejects the toggle
when output_type starts with "TimeAverage".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…nly toggle

Add contextual_field_validator on StoppingCriterion.monitor_output that
rejects monitors with output_at_final_pseudo_step_only=True.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Forbid toggle + StoppingCriterion in steady simulations only
  (unsteady is fine since both write and check happen per physical step)
- Forbid toggle + MovingStatistic in steady simulations
  (only one data point would be produced)
- Add docstrings to all new validators

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pass the toggle through to solver JSON config for probe, surface probe,
and surface integral monitor groups.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add 14 validation tests covering field acceptance, TimeAverage
  rejection, StoppingCriterion interaction, and MovingStatistic
  interaction in steady/unsteady modes
- Add translator test verifying outputAtFinalPseudoStepOnly emission
- Fix _forbid_final_pseudo_step_only_on_time_average: use cls.__name__
  instead of info.data["output_type"] which is unavailable due to
  Pydantic field ordering
- Update reference JSONs with new output_at_final_pseudo_step_only field
- Allow VolumeFieldNames in ProbeOutput for betDiskMetrics support

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Restrict ProbeOutput.output_fields to BET-relevant volume fields
(betMetrics, betMetricsPerDisk) plus common fields, instead of the
full VolumeFieldNames which includes solver-internal fields.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Base automatically changed from develop to main March 20, 2026 19:51
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