JICF cleanup: remove MIB dead code and mesh dependence (#98, #99)#106
Open
jjhans wants to merge 2 commits into
Open
JICF cleanup: remove MIB dead code and mesh dependence (#98, #99)#106jjhans wants to merge 2 commits into
jjhans wants to merge 2 commits into
Conversation
The MIB progress-variable / chemical-energy profiles were computed and stored but never used at runtime. Removes the dead code: - JICModel.calc_MIB_profile and C_E_CHEM_avg_MIB (generate.py) - the load_MIB_profile flag and its __init__ handling - FuelInjector.get_MIB_profiles (source.py) - the corresponding load_MIB_profile arguments in the HyShot II and 04_jicf_heat_release_profile examples
The Z_avg/Z_var profiles were generated on the simulation mesh and their interpolators rebuilt against `self.xc`, forcing a full regeneration whenever the mesh changed. Now the generation mesh is stored with the profiles and the interpolators are built on that stored mesh (with linear extrapolation for out-of-range query points such as ghost cells), so the model is decoupled from the simulation grid. Also replaces the collection of per-array `.npy` cache files and the three `load_*` boolean flags with a single HDF5 file (`jicf_model.h5`). Cached tables are auto-detected per group (Z_3D, Z_profiles, chemical_sources) and any missing tables are computed and written. Examples updated to pass `datadir` instead of the removed load flags.
7bd1cd6 to
c529835
Compare
TimothyEDawson
requested changes
Jul 7, 2026
TimothyEDawson
left a comment
Collaborator
There was a problem hiding this comment.
This looks great, thank you! Just two minor adjustments and then I'd be happy to merge it in.
| if self.xc[i] > self.x_noz: | ||
| # Record the mesh the profiles are generated on so the interpolators can | ||
| # be rebuilt independently of the simulation mesh. | ||
| self.x_profile = np.asarray(self.xc, dtype=float) |
Collaborator
There was a problem hiding this comment.
This works, but it would also be nice to have some control over what mesh is being used. We could even use the stretched grid already present in self.x_3D_data. Can you try that?
| self.alpha = alpha if alpha is not None else 1e6 | ||
| self.datadir = Path(datadir) | ||
| self.datadir.mkdir(exist_ok=True) | ||
| self.model_file = ( |
Collaborator
There was a problem hiding this comment.
Defaulting to None and using this sort of ternary logic is a good pattern, but in this case we now have an unused datadir which can point to a different location than the model_file. Instead, let's make the model_file input a str with default value of "jicf_model.h5", then on this line make self.model_file = self.datadir / model_file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cleanup work under the JICF umbrella (#95), covering two sub-issues.
#99 — Remove unused mixed-is-burned (MIB) model
The MIB progress-variable / chemical-energy profiles were computed and stored but never used at runtime. Removed
JICModel.calc_MIB_profile,C_E_CHEM_avg_MIB,FuelInjector.get_MIB_profiles, theload_MIB_profileflag and its handling, and the corresponding example arguments (~118 lines).#98 — Remove mesh dependence of Z profiles; consolidate to HDF5
Z_avg_profile/Z_var_profileand build the interpolators on that stored mesh (with linear extrapolation for out-of-range query points such as ghost cells), decoupling the model from the simulation grid — no more full regeneration when the mesh changes..npycache files and the threeload_*boolean flags with a single HDF5 file (jicf_model.h5), auto-detecting cached groups (Z_3D,Z_profiles,chemical_sources) and computing any that are missing. Examples passdatadirinstead of the removed flags.Verification
ruff+py_compileclean; thejicfpackage imports fine.Not included (separate blocker)
Full end-to-end verification of the HyShot FPV run is still blocked by the injector-origin divide-by-zero in
profile.py(AnalyticJICF), which poisonsZ_3Dwith NaN — see #105. That lives in the analytic model (arguably #104 territory), not this mesh/HDF5 cleanup.Note:
examples/04_jicf_heat_release_profilehas a pre-existingJICModelsignature mismatch (passesfuel=, omitsphi_inj) unrelated to this PR.Relates to #95, #98, #99.