Skip to content

Comments

John/generic gas#1668

Merged
johnmoore4 merged 15 commits intomainfrom
john/genericGas
Feb 4, 2026
Merged

John/generic gas#1668
johnmoore4 merged 15 commits intomainfrom
john/genericGas

Conversation

@johnmoore4
Copy link
Contributor

@johnmoore4 johnmoore4 commented Dec 19, 2025

Adds interface for specifying a ThermallyPerfectGas model.


Note

Medium Risk
Changes core gas-property modeling and solver JSON translation (including energy/enthalpy coefficient handling), which can affect simulation results if coefficients or non-dimensionalization are incorrect.

Overview
Adds a new ThermallyPerfectGas material interface (via NASA9CoefficientSet/NASA9Coefficients and FrozenSpecies) and wires it into Air, including temperature-dependent gamma computation and configurable laminar/turbulent Prandtl numbers.

Updates the solver translator to always emit thermallyPerfectGasModel and fluidProperties for Air, including mass-fraction mixing across species, coefficient non-dimensionalization, and an a7 correction to keep internal energy consistent at the reference temperature.

Introduces validation to block temperature-dependent NASA9 coefficients when using the CompressibleIsentropic solver (allowing constant-gamma coefficients only), and refreshes/extends tests and reference JSON outputs to cover the new schema and translator output.

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

Cursor Bugbot reviewed your changes and found no issues for commit dc82811

@benflexcompute
Copy link
Collaborator

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 829ff6eb57

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for specifying a thermally perfect gas model (NASA 9-coefficient polynomials and multi-species mixtures) and translating it into solver JSON, along with validation to prevent unsupported combinations.

Changes:

  • Introduces NASA9CoefficientSet/NASA9Coefficients, FrozenSpecies, and ThermallyPerfectGas material models (plus exports/aliases).
  • Adds solver translation for thermallyPerfectGasModel and exports fluidProperties (Prandtl numbers) for liquid/TPG cases.
  • Adds validation preventing temperature-dependent gas properties with the CompressibleIsentropic solver, plus extensive unit/translation tests and updated reference JSONs.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/simulation/translator/test_solver_translator.py Adds translation-focused tests for NASA9 and ThermallyPerfectGas behavior (including a7 correction).
tests/simulation/translator/ref/Flow360_user_variable.json Updates expected solver JSON to include fluidProperties for liquid cases.
tests/simulation/translator/ref/Flow360_liquid_rotation_dd_with_ref_vel.json Updates expected solver JSON to include fluidProperties for liquid cases.
tests/simulation/translator/ref/Flow360_liquid_rotation_dd.json Updates expected solver JSON to include fluidProperties for liquid cases.
tests/simulation/translator/ref/Flow360_liquid.json Updates expected solver JSON to include fluidProperties for liquid cases.
tests/simulation/ref/value_or_expression/time_stepping_with_expression.json Updates expected solver JSON to include fluidProperties for liquid cases.
tests/simulation/ref/value_or_expression/ref_area_with_expression.json Normalizes JSON formatting and adds fluidProperties for liquid cases.
tests/simulation/ref/value_or_expression/liquid_op_vel_mag.json Updates expected solver JSON to include fluidProperties for liquid cases.
tests/simulation/ref/value_or_expression/angular_velocity_with_expression.json Updates expected solver JSON to include fluidProperties for liquid cases.
tests/simulation/ref/simulation_with_project_variables.json Adds NASA9 coefficients + Prandtl numbers in serialized simulation inputs.
tests/simulation/params/test_validators_material.py New unit tests for NASA9/TPG validators and constant-gamma detection.
tests/simulation/converter/ref/ref_monitor.json Updates expected numeric formatting + adds NASA9/Prandtl fields in serialized material.
tests/ref/simulation/service_init_volume_mesh.json Updates expected serialized service-init payloads with NASA9/Prandtl fields.
tests/ref/simulation/service_init_surface_mesh.json Updates expected serialized service-init payloads with NASA9/Prandtl fields.
tests/ref/simulation/service_init_geometry.json Updates expected serialized service-init payloads with NASA9/Prandtl fields.
flow360/component/simulation/validation/validation_simulation_params.py Adds validation to disallow temperature-dependent gas models with CompressibleIsentropic.
flow360/component/simulation/translator/solver_translator.py Implements NASA9/TPG translation, a7 correction, and fluidProperties export.
flow360/component/simulation/simulation_params.py Wires new validation into SimulationParams validators.
flow360/component/simulation/services.py Minor import formatting change.
flow360/component/simulation/models/material.py Adds NASA9/TPG models + gamma utilities; updates Air to support NASA9/TPG-based gamma.
flow360/init.py Exports new material models and legacy aliases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@NasserFlexCompute NasserFlexCompute marked this pull request as ready for review January 29, 2026 18:53
@johnmoore4 johnmoore4 force-pushed the john/genericGas branch 2 times, most recently from 2f1f1f6 to f9a67c9 Compare February 4, 2026 19:26
John Moore and others added 5 commits February 4, 2026 19:43
Human reviewer comments addressed:
- yifan-flex: Move compute_enthalpy_no_a7 to translator, remove nasa_9_coefficients
  field from Air (use thermally_perfect_gas with default CPG coefficients instead),
  add get_coefficients_at_temperature method to NASA9Coefficients class
- NasserFlexCompute: Raise mass fraction tolerance to 1e-3 and re-normalize
- benflexcompute: Add min<max validation for temperature ranges, remove unused
  legacy type aliases, add species name uniqueness validation, add type_name
  discriminators to new classes

Bot comments addressed:
- Fix out-of-range temp handling via fallback in get_coefficients_at_temperature
- Fix gasConstant to use correct temperature range containing T_nd=1
- Fix a7 correction to use single global shift for enthalpy continuity

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Updated all material sections in reference JSON files to use the new
thermally_perfect_gas structure with FrozenSpecies and NASA9Coefficients
instead of the deprecated nasa_9_coefficients field.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The C++ solver now computes gasConstant (R = 1/gamma_ref) internally
from the NASA coefficients at T=1, so there's no need to pass it from
the Python client. This avoids potential inconsistencies between Python
and C++ computations.

Also always output thermallyPerfectGasModel and fluidProperties for Air
materials, even for CPG (constant gamma=1.4) cases. This ensures the
solver always has explicit gas model parameters rather than relying on
defaults.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove unused specific_heat_ratio property from Air class
- Add @pd.validate_call decorator to get_coefficients_at_temperature
- Use direct assignment instead of object.__setattr__ for mass fraction
- Change model_validator to field_validator for NASA9CoefficientSet
- Remove unused translate_nasa9_coefficients function from translator
- Combine nested if statements in validation_simulation_params.py
- Add unit tests for temperature range, species uniqueness, mass fraction
- Update reference JSON files with fluidProperties and thermallyPerfectGasModel

Co-Authored-By: Claude Opus 4.5 <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.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

These were defined but never used anywhere in the codebase.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@johnmoore4 johnmoore4 merged commit 374b4ab into main Feb 4, 2026
21 checks passed
@johnmoore4 johnmoore4 deleted the john/genericGas branch February 4, 2026 21:26
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.

5 participants