New tabulation framework#23
Open
EvertBunschoten wants to merge 43 commits into
Open
Conversation
…fluid data interpolation function
…to fix_LUT_twophase
…g flamelets for a single equivalence ratio
5 tasks
There was a problem hiding this comment.
Pull request overview
This PR introduces a new object-oriented tabulation framework (shared base + per-application generators) and updates tutorials/tests/docs to use the new API, aiming to make table generation/refinement extensible for NICFD and FGM workflows.
Changes:
- Adds a new shared
SU2TableGenerator_Baseand new meshing utilities to support 2D/3D tables, refinement criteria, smoothing, and VTK export. - Refactors NICFD/FGM table generators to build on the base implementation and updates call sites to the new method names.
- Updates documentation, tutorials, and regression/test cases to demonstrate the new framework and behaviors.
Reviewed changes
Copilot reviewed 37 out of 58 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| Tutorials/FGM/01_methane_tabulation/01_generate_config.py | Adds tutorial script to generate an FGM config for methane LUT workflow. |
| Tutorials/FGM/01_methane_tabulation/02_accumulate_flamelets.py | Adds tutorial script to concatenate flamelet point-cloud data for LUT generation. |
| Tutorials/FGM/01_methane_tabulation/03_generate_table.py | Adds tutorial script using new FGM table generator API (refinement/smoothing/export). |
| TestCases/NICFD/LUT_Twophase/generate_table.py | Updates NICFD two-phase LUT test to new generator API and refinement options. |
| TestCases/LUT/Flamelet_Table_H2/0_generate_config.py | Adds H2 LUT test config generator script. |
| TestCases/LUT/Flamelet_Table_H2/1_generate_flamelet_data.py | Adds H2 LUT flamelet data generation script (with thread limiting). |
| TestCases/LUT/Flamelet_Table_H2/2_optimize_progress_variabele.py | Adds PV optimization script for H2 LUT test case. |
| TestCases/LUT/Flamelet_Table_H2/3_collect_flamelet_data.py | Adds flamelet concatenation script for H2 LUT test case. |
| TestCases/LUT/Flamelet_Table_H2/4_generate_table.py | Adds LUT generation/export script for H2 LUT test case. |
| TestCases/LUT/Flamelet_Table_H2/.gitignore | Ignores generated flamelet_data directory for H2 LUT test case. |
| TestCases/LUT/Flamelet_Table_CH4_phi080/3_generate_table.py | Replaces legacy CH4 LUT generator usage with new TableGenerator_FGM workflow. |
| TestCases/Flamelet_Table_H2/generate_table.py | Renames legacy API calls to new generateTableNodes() / writeSU2Table() methods. |
| TestCases/FGM/hydrogen_LUT/1_generate_config.py | Adds hydrogen FGM config generator script using new config API. |
| TestCases/FGM/hydrogen_LUT/3_accumulate_flamelets.py | Adds hydrogen flamelet concatenation script with PV definition loading. |
| TestCases/FGM/hydrogen_LUT/3_generate_table.py | Adds hydrogen LUT generation script using new FGM generator API. |
| RegressionTests/TableGeneration/NICFD/twophase_lut.py | Updates regression test table generation to new NICFD generator API and exports. |
| RegressionTests/FluidTraining/MM_PINN/train_MLP.py | Adjusts training regression test (removes inline data generation, tweaks grid size). |
| RegressionTests/FluidTraining/MM_PINN/SU2_MLP.mlp | Updates stored MLP weights/normalization used in regression tests. |
| RegressionTests/FluidTraining/MM_PINN/SU2_MLP_ref.mlp | Updates reference MLP weights/normalization used in regression tests. |
| RegressionTests/FluidTraining/MM_PINN/fluid_data_test.csv | Adds fixed fluid dataset for regression testing/training. |
| RegressionTests/FluidTraining/MM_PINN/.gitignore | Stops ignoring fluid_data files (to allow committed test dataset). |
| Manifold_Generation/LUT/MeshTools.py | Adds new gmsh-based 2D meshing utilities (hull, refinement callback, saturation handling). |
| Manifold_Generation/LUT/LUTGenerators.py | Refactors NICFD/FGM table generators onto the new base generator architecture. |
| Manifold_Generation/LUT/LUTGenerator_Base.py | Adds new shared base class implementing table-level meshing, interpolation, smoothing, and export. |
| Manifold_Generation/LUT/FlameletTableGeneration.py | Updates legacy flamelet-table generator to new Invdisttree API/method naming. |
| Documentation/source/Tutorials/NICFD/tablegeneration.rst | Updates NICFD tutorial to new API and adds sections on limits/refinement/smoothing. |
| Documentation/source/Tutorials/FGM/methane_LUT/methane_LUT_tutorial.rst | Adds a new methane FGM LUT end-to-end tutorial for the new framework. |
| Documentation/source/Tutorials/FGM/index.rst | Adds methane LUT tutorial to the FGM tutorials index. |
| Documentation/source/documentation/tabulation/tabulationbase.rst | Adds base tabulation documentation page for the new framework. |
| Documentation/source/documentation/tabulation/NICFD.rst | Updates NICFD tabulation docs to new API names and refinement methods. |
| Documentation/source/documentation/tabulation/index.rst | Adds tabulation base page to the tabulation documentation index. |
| Data_Generation/DataGenerator_NICFD.py | Adjusts NICFD data generation (transport indentation fix, saturation sampling parameter). |
| Data_Generation/DataGenerator_FGM.py | Handles equal mixture bounds by generating a single mixture point instead of linspace. |
| Common/Interpolators.py | Refactors inverse-distance interpolator API (Invdisttree.query, fluidDataInterpolator). |
| Common/DataDrivenConfig.py | Changes FGM config synchronization to auto-select 2D vs 3D controlling variables. |
| Common/CommonMethods.py | Moves shared geometry/math utilities (shoelace, finite-difference derivative) into common module. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+122
to
+129
| def __format_query_input(self, unformatted_query_samples:np.ndarray[float]): | ||
| number_of_dimensions = unformatted_query_samples.ndim | ||
| if number_of_dimensions == 1: | ||
| self.__single_query_sample = True | ||
| return np.expand_dims(unformatted_query_samples, -1) | ||
| else: | ||
| self.__single_query_sample = False | ||
| return unformatted_query_samples |
Comment on lines
+37
to
+48
| def generateMesh(self): | ||
| self.__checkPlanarCoords() | ||
|
|
||
| self._initializeGmesh() | ||
| self.__createGeometry() | ||
|
|
||
| if self.__use_target_node_count: | ||
| self.__optimizeMeshResolution() | ||
|
|
||
| self.__meshNodes, self.__connectivity, self.__hullNodeIDs = self.__mesh2D() | ||
| self._gmsh_geo.synchronize() | ||
| return |
Comment on lines
+157
to
+161
| def __filterNansFromPointCloud(self, point_cloud_3D:np.ndarray[float]): | ||
| unique_pts_init = np.unique(point_cloud_3D, axis=0) | ||
| nans = np.isnan(unique_pts_init).all(1) | ||
| pts_wo_nans = unique_pts_init[np.invert(nans)] | ||
| return pts_wo_nans |
Comment on lines
+389
to
+392
| hull_pts_orig = concave_hull(self._pointCloud_hullNodes, length_threshold=self._base_cell_size) | ||
| ref_area = shoelace(hull_pts_orig) | ||
| within_hull = np.zeros(len(self.__saturation_curve_points),dtype=np.bool) | ||
|
|
Comment on lines
+405
to
+422
| def __writeParaViewVTK(self, cv_coordinates:np.ndarray[float], table_data:pandas.DataFrame, connectivity:np.ndarray[int], file_name_out:str): | ||
|
|
||
| pts = cv_coordinates | ||
| conn = np.asarray(connectivity, dtype=np.int64) | ||
| if conn.min() == 1: | ||
| conn = conn - 1 | ||
| point_data = {} | ||
| for var in self._table_vars: | ||
| point_data[var] = np.asarray(table_data[var]) | ||
|
|
||
| mesh = meshio.Mesh( | ||
| points=pts, | ||
| cells=[("triangle", conn)], | ||
| point_data=point_data | ||
| ) | ||
| mesh.write("%s.vtk" % file_name_out) | ||
|
|
||
| return |
Comment on lines
+928
to
+931
| if self.__mix_status_lower==self.__mix_status_upper: | ||
| self.SetControllingVariables([FGMVars.ProgressVariable.name, FGMVars.EnthalpyTot.name]) | ||
| else: | ||
| self.SetControllingVariables([FGMVars.ProgressVariable.name, FGMVars.EnthalpyTot.name, FGMVars.MixtureFraction.name]) |
| @@ -0,0 +1,22 @@ | |||
| # Generate flamelet data for a single phi = 0.80 methane-air flame | |||
Comment on lines
+7
to
+13
| # Methane-air flamelets at a single equivalence ratio phi = 0.80 | ||
| Config.SetFuelDefinition(fuel_species=["H2"], fuel_weights=[1.0]) | ||
| Config.SetReactionMechanism('h2o2.yaml') | ||
|
|
||
| # Single phi = 0.80 → single mixture fraction point (min == max) | ||
| Config.SetMixtureBounds(0.30, 2.0) | ||
| Config.SetNpMix(20) |
Comment on lines
201
to
205
| # nnear nearest neighbours of each query point -- | ||
| q = np.asarray(q) | ||
| max_nnear = max(max(nnear_vals), 2) | ||
| qdim = q.ndim | ||
| if qdim == 1: |
Comment on lines
+111
to
+115
| def __createHullPerimiter(self): | ||
| self._pointCloud_hullNodes = self.__findHullNodes() | ||
| planeCurvLoop, perimiterTags = self.__createHullCurvLoop(self._pointCloud_hullNodes) | ||
| self.__perimiter_tag = self._gmsh_geo.addPhysicalGroup(1, perimiterTags, name="perimiter") | ||
| return planeCurvLoop, perimiterTags |
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.
Proposed Changes
Improved the code structure for table generation, made the table generators for NICFD and FGM more object-oriented, allowing for easier integration of new refinement methods and applications, and makes the code easier to read and use.
New features to the tabulation base class:
New features to the FGM tabulation class:
PR Checklist
Put an X by all that apply. You can fill this out after submitting the PR. If you have any questions, don't hesitate to ask! We want to help. These are a guide for you to know what the reviewers will be looking for in your contribution.