Conversation
b95c48e to
cad073d
Compare
|
@codex review |
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
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
thermallyPerfectGasModeland exportsfluidProperties(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.
There was a problem hiding this comment.
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.
flow360/component/simulation/validation/validation_simulation_params.py
Outdated
Show resolved
Hide resolved
0112dfc to
24e02bb
Compare
flow360/component/simulation/validation/validation_simulation_params.py
Outdated
Show resolved
Hide resolved
2f1f1f6 to
f9a67c9
Compare
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>
f9a67c9 to
bcd077d
Compare
There was a problem hiding this comment.
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>
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
ThermallyPerfectGasmaterial interface (viaNASA9CoefficientSet/NASA9CoefficientsandFrozenSpecies) and wires it intoAir, including temperature-dependentgammacomputation and configurable laminar/turbulent Prandtl numbers.Updates the solver translator to always emit
thermallyPerfectGasModelandfluidPropertiesforAir, including mass-fraction mixing across species, coefficient non-dimensionalization, and ana7correction to keep internal energy consistent at the reference temperature.Introduces validation to block temperature-dependent NASA9 coefficients when using the
CompressibleIsentropicsolver (allowing constant-gammacoefficients 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.