Skip to content

Static mix - #161

Merged
malihass merged 54 commits into
mainfrom
static_mix
Sep 11, 2026
Merged

malihass merged 54 commits into
mainfrom
static_mix

Conversation

@malihass

@malihass malihass commented Sep 10, 2026 •

Copy link
Copy Markdown
Collaborator
  • Optimization code + loop reactor data
  • Loop velocity diagnostics + test
  • Non dimensional number post proc

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Several calculations can produce incorrect physical or statistical results, including a 3600× Sherwood error and invalid bootstrap uncertainty.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds mixer modeling, loop-flow diagnostics, dimensionless post-processing, and scale-up optimization workflows.

Changes:

  • Adds transport, Froude, Weber, Sherwood, and steady-state statistics with tests.
  • Adds scale-up case templates, mixer configurations, and loop-velocity tooling.
  • Adds surrogate selection, constrained optimization, plotting, and generated datasets.
File summaries
File Description
tests/postprocess/test_transport.py Tests turbulent diffusivity.
tests/postprocess/test_stats.py Tests steady-state statistics.
tests/postprocess/test_dimensionless.py Tests dimensionless quantities.
tests/io/test_read_global_vars.py Tests surface-tension parsing.
tests/io/test_read_foam_dict.py Tests gravity parsing.
papers/scaleup/SA_optimization/surrogate_selection.csv Stores selected surrogate results.
papers/scaleup/SA_optimization/README.md Documents optimization scripts.
papers/scaleup/SA_optimization/plot_marginal_gain.py Plots constrained optima.
papers/scaleup/SA_optimization/plot_design_schematic.py Draws optimized designs.
papers/scaleup/SA_optimization/model_selection.py Selects and caches surrogates.
papers/scaleup/SA_optimization/marginal_gain_results.csv Stores marginal-gain results.
papers/scaleup/SA_optimization/make_val_rmse_table.py Generates validation tables.
papers/scaleup/SA_optimization/make_hyperparam_tables.py Generates hyperparameter tables.
papers/scaleup/SA_optimization/load_data.py Loads and filters study data.
papers/scaleup/SA_optimization/get_optimal_constrained.py Runs constrained optimization.
papers/scaleup/SA_optimization/data/transfer.sh Transfers study datasets.
papers/scaleup/SA_optimization/data/study/study_0_4vvm_lev6/split.csv Defines lev6 data split.
papers/scaleup/SA_optimization/data/study/study_0_4vvm_lev6/qoi/hyperparams_qoi.json Stores lev6 QOI model results.
papers/scaleup/SA_optimization/data/study/study_0_4vvm_lev6/qoi/cfd_all_spargers.txt Stores lev6 CFD reference.
papers/scaleup/SA_optimization/data/study/study_0_4vvm_lev6/qoi/best_bootstrap_solution_nn_qoi.csv Stores lev6 QOI optimum.
papers/scaleup/SA_optimization/data/study/study_0_4vvm_lev6/qoi_sum/hyperparams_qoi_sum.json Stores lev6 QOI-sum model results.
papers/scaleup/SA_optimization/data/study/study_0_4vvm_lev6/qoi_sum/cfd_all_spargers.txt Stores lev6 QOI-sum reference.
papers/scaleup/SA_optimization/data/study/study_0_4vvm_lev6/qoi_sum/best_bootstrap_solution_nn_qoi_sum.csv Stores lev6 QOI-sum optimum.
papers/scaleup/SA_optimization/data/study/study_0_4vvm_lev6/qoi_sum_kla/hyperparams_qoi_sum_kla.json Stores lev6 combined-kLa results.
papers/scaleup/SA_optimization/data/study/study_0_4vvm_lev6/qoi_sum_kla/cfd_all_spargers.txt Stores lev6 combined-kLa reference.
papers/scaleup/SA_optimization/data/study/study_0_4vvm_lev6/qoi_sum_kla/best_bootstrap_solution_rbf_qoi_sum_kla.csv Stores lev6 combined-kLa optimum.
papers/scaleup/SA_optimization/data/study/study_0_4vvm_lev6/qoi_kla/hyperparams_qoi_kla.json Stores lev6 kLa model results.
papers/scaleup/SA_optimization/data/study/study_0_4vvm_lev6/qoi_kla/cfd_all_spargers.txt Stores lev6 kLa reference.
papers/scaleup/SA_optimization/data/study/study_0_4vvm_lev6/qoi_kla/best_bootstrap_solution_nn_qoi_kla.csv Stores lev6 kLa optimum.
papers/scaleup/SA_optimization/data/study/study_0_4vvm_lev1/split.csv Defines lev1 data split.
papers/scaleup/SA_optimization/data/study/study_0_4vvm_lev1/qoi/hyperparams_qoi.json Stores lev1 QOI model results.
papers/scaleup/SA_optimization/data/study/study_0_4vvm_lev1/qoi/best_bootstrap_solution_nn_qoi.csv Stores lev1 QOI optimum.
papers/scaleup/SA_optimization/data/study/study_0_4vvm_lev1/qoi_sum/hyperparams_qoi_sum.json Stores lev1 QOI-sum results.
papers/scaleup/SA_optimization/data/study/study_0_4vvm_lev1/qoi_sum/best_bootstrap_solution_nn_qoi_sum.csv Stores lev1 QOI-sum optimum.
papers/scaleup/SA_optimization/data/study/study_0_4vvm_lev1/qoi_sum_kla/hyperparams_qoi_sum_kla.json Stores lev1 combined-kLa results.
papers/scaleup/SA_optimization/data/study/study_0_4vvm_lev1/qoi_sum_kla/best_bootstrap_solution_nn_qoi_sum_kla.csv Stores lev1 combined-kLa optimum.
papers/scaleup/SA_optimization/data/study/study_0_4vvm_lev1/qoi_kla/hyperparams_qoi_kla.json Stores lev1 kLa model results.
papers/scaleup/SA_optimization/data/study/study_0_4vvm_lev1/qoi_kla/best_bootstrap_solution_nn_qoi_kla.csv Stores lev1 kLa optimum.
papers/scaleup/SA_optimization/data/study_pbe/study_0_4vvm_lev6/Y_data.csv Adds PBE response data.
papers/scaleup/SA_optimization/data/study_pbe/study_0_4vvm_lev6/X_data.csv Adds PBE design data.
papers/scaleup/SA_optimization/data/study_op/study_0_1vvm_lev6/Y_data.csv Adds operating-point responses.
papers/scaleup/SA_optimization/data/study_op/study_0_1vvm_lev6/X_data.csv Adds operating-point designs.
papers/scaleup/SA_optimization/data/study_fine/study_0_4vvm_lev6/Y_data.csv Adds fine-grid responses.
papers/scaleup/SA_optimization/data/study_fine/study_0_4vvm_lev6/X_data.csv Adds fine-grid designs.
papers/scaleup/generate_scaleup_runs/template/writeGlobalVars.py Writes generated case variables.
papers/scaleup/generate_scaleup_runs/template/test.foam Adds ParaView case marker.
papers/scaleup/generate_scaleup_runs/template/system/setFieldsDict Configures initial phase fields.
papers/scaleup/generate_scaleup_runs/template/system/mixers.json Defines template mixer placement.
papers/scaleup/generate_scaleup_runs/template/system/mesh.json Defines reactor mesh geometry.
papers/scaleup/generate_scaleup_runs/template/system/inlets_outlets.json Defines boundary geometry.
papers/scaleup/generate_scaleup_runs/template/system/fvSolution Configures solver algorithms.
papers/scaleup/generate_scaleup_runs/template/system/fvSchemes Configures discretization schemes.
papers/scaleup/generate_scaleup_runs/template/system/fvConstraints Adds field constraints.
papers/scaleup/generate_scaleup_runs/template/system/decomposeParDict Configures parallel decomposition.
papers/scaleup/generate_scaleup_runs/template/system/controlDict Configures simulation execution.
papers/scaleup/generate_scaleup_runs/template/script_post Adds post-processing job script.
papers/scaleup/generate_scaleup_runs/template/script Adds simulation job script.
papers/scaleup/generate_scaleup_runs/template/run.sh Adds direct solver launcher.
papers/scaleup/generate_scaleup_runs/template/read_history.py Extracts transient histories.
papers/scaleup/generate_scaleup_runs/template/presteps.sh Prepares generated cases.
papers/scaleup/generate_scaleup_runs/template/constant/thermophysicalProperties.liquid Defines liquid thermophysics.
papers/scaleup/generate_scaleup_runs/template/constant/thermophysicalProperties.gas Defines gas thermophysics.
papers/scaleup/generate_scaleup_runs/template/constant/phaseProperties_constantd Defines constant-diameter phases.
papers/scaleup/generate_scaleup_runs/template/constant/phaseProperties Defines population-balance phases.
papers/scaleup/generate_scaleup_runs/template/constant/momentumTransport.liquid Configures liquid turbulence.
papers/scaleup/generate_scaleup_runs/template/constant/momentumTransport.gas Configures gas momentum transport.
papers/scaleup/generate_scaleup_runs/template/constant/globalVars_temp Provides variable template.
papers/scaleup/generate_scaleup_runs/template/constant/globalVars Provides default case variables.
papers/scaleup/generate_scaleup_runs/template/constant/g Defines gravity.
papers/scaleup/generate_scaleup_runs/template/constant/fvModels Defines mixer source model.
papers/scaleup/generate_scaleup_runs/template/computeQOI.sh Runs QOI post-processing.
papers/scaleup/generate_scaleup_runs/template/Allclean Cleans generated cases.
papers/scaleup/generate_scaleup_runs/template/0.orig/Ydefault.liquid Defines default liquid composition.
papers/scaleup/generate_scaleup_runs/template/0.orig/Ydefault.gas Defines default gas composition.
papers/scaleup/generate_scaleup_runs/template/0.orig/U.liquid Defines liquid velocity field.
papers/scaleup/generate_scaleup_runs/template/0.orig/U.gas Defines gas velocity field.
papers/scaleup/generate_scaleup_runs/template/0.orig/T.liquid Defines liquid temperature.
papers/scaleup/generate_scaleup_runs/template/0.orig/T.gas Defines gas temperature.
papers/scaleup/generate_scaleup_runs/template/0.orig/p_rgh Defines hydrostatic pressure.
papers/scaleup/generate_scaleup_runs/template/0.orig/p Defines pressure field.
papers/scaleup/generate_scaleup_runs/template/0.orig/omega.liquid Defines liquid omega field.
papers/scaleup/generate_scaleup_runs/template/0.orig/omega.gas Defines gas omega field.
papers/scaleup/generate_scaleup_runs/template/0.orig/nut.liquid Defines liquid eddy viscosity.
papers/scaleup/generate_scaleup_runs/template/0.orig/nut.gas Defines gas eddy viscosity.
papers/scaleup/generate_scaleup_runs/template/0.orig/N2.gas Defines gas nitrogen fraction.
papers/scaleup/generate_scaleup_runs/template/0.orig/k.liquid Defines liquid turbulence energy.
papers/scaleup/generate_scaleup_runs/template/0.orig/k.gas Defines gas turbulence energy.
papers/scaleup/generate_scaleup_runs/template/0.orig/H2.liquid Defines dissolved hydrogen.
papers/scaleup/generate_scaleup_runs/template/0.orig/H2.gas Defines gas hydrogen.
papers/scaleup/generate_scaleup_runs/template/0.orig/f.gas Defines gas size fraction.
papers/scaleup/generate_scaleup_runs/template/0.orig/CO2.liquid Defines dissolved carbon dioxide.
papers/scaleup/generate_scaleup_runs/template/0.orig/CO2.gas Defines gas carbon dioxide.
papers/scaleup/generate_scaleup_runs/template/0.orig/alphat.liquid Defines liquid thermal diffusivity.
papers/scaleup/generate_scaleup_runs/template/0.orig/alphat.gas Defines gas thermal diffusivity.
papers/scaleup/generate_scaleup_runs/template/0.orig/alpha.liquid Defines liquid volume fraction.
papers/scaleup/generate_scaleup_runs/template/0.orig/alpha.gas Defines gas volume fraction.
papers/scaleup/generate_scaleup_runs/README.md Documents case generation.
papers/scaleup/generate_scaleup_runs/randsim.py Generates multi-scale studies.
bird/version.py Bumps package version.
bird/utilities/ofio/global_vars.py Adds surface-tension reading.
bird/utilities/ofio/foam_dict_io.py Adds gravity reading.
bird/utilities/ofio/__init__.py Exports new readers.
bird/postprocess/stats.py Adds tail-window statistics.
bird/postprocess/post_quantities/transport.py Adds turbulent diffusivity.
bird/postprocess/post_quantities/species.py Reuses density lookup helper.
bird/postprocess/post_quantities/phase.py Adds density, velocity, and area helpers.
bird/postprocess/post_quantities/dimensionless.py Adds dimensionless-number calculations.
bird/postprocess/post_quantities/__init__.py Exports new post-processing APIs.
applications/compute_loop_velocity.py Adds loop-velocity CLI.
Review details
  • Files reviewed: 129/139 changed files
  • Comments generated: 5
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread bird/postprocess/post_quantities/dimensionless.py Outdated
Comment thread bird/postprocess/post_quantities/phase.py Outdated
Comment thread bird/postprocess/stats.py Outdated
Comment thread papers/scaleup/SA_optimization/get_optimal_constrained.py
Comment thread papers/scaleup/SA_optimization/plot_marginal_gain.py

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Field caching corrupts generated time histories, and the new statistics and multi-species fitted-kL paths mishandle valid inputs.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (3)

Previously missed (2) — in code that hasn't changed since the last review.

bird/postprocess/stats.py:236

  • Partially missing windows are not handled: a single NaN reaches calc_mean, whose mean and autocorrelation then become NaN even when valid samples remain. Filter NaN samples (and their corresponding times) before the size/constant checks.
    bird/postprocess/post_quantities/kla.py:344
  • The annotation declares a two-item tuple, but every return path produces (kl_spec, cstar_spec, field_dict) and callers unpack three values. Correct the public return type so static checking and generated API documentation match the implementation.

This issue also appears on line 639 of the same file.

bird/postprocess/post_quantities/kla.py:642

  • This new API accepts multiple species and forwards them to compute_fitted_kla, but that function stores c_history[species_name][itime] after its species loop, so only the final species receives data and all earlier species are fitted against zeros. Move that assignment into the inner loop (and cover a two-species call) before exposing multi-species fitted kL results.
    kla_spec, cstar_spec, field_dict = compute_fitted_kla(
        case_folder,
        species_names,
        n_cells=n_cells,
  • Files reviewed: 133/143 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment on lines +55 to +59
field_dict = {}
for itime, time in enumerate(time_float_sorted):
time_folder = time_str_sorted[itime]
print(f"\tTime : {time_folder}")
_, field_dict = read_cell_volumes(case_folder)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

No field dict cache is actually not used

@malihass
malihass merged commit 6c3a941 into main Sep 11, 2026
15 checks passed
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