Repository navigation
Implicit progress variable source Jacobian for flamelet solver #3025
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
bigfooted
wants to merge
24
commits into
develop
Choose a base branch
from
fix_unsteady_flamelet
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+291
−28
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
8bd6c74
Implicit progress variable source Jacobian for flamelet solver
bigfooted b1387fa
Update flamelet regression values for the implicit PV source Jacobian
bigfooted 899ab14
update monitor for unsteady plotting
bigfooted 5cbf7a2
Merge branch 'develop' into fix_unsteady_flamelet
EvertBunschoten b2cd7c9
Move the progress variable source Jacobian into CFluidFlamelet
bigfooted 99fff93
Merge remote-tracking branch 'origin/fix_unsteady_flamelet' into fix_…
bigfooted 6dabf0c
Merge branch 'develop' into fix_unsteady_flamelet
bigfooted 0e34254
Apply black formatting to the monitor script and its tests
bigfooted 2fdac90
Flamelet LUT: extrapolate linearly beyond the outer table levels
bigfooted 9f36808
Flamelet: block Jacobian of the preferential diffusion terms
bigfooted c91ac9b
Flamelet: keep the burnt state of the flame front initialization insi…
bigfooted 2215935
Update flamelet regression values for the preferential diffusion Jaco…
bigfooted 971ee6f
Merge branch 'develop' into fix_unsteady_flamelet
bigfooted a34cb00
Merge branch 'fix_unsteady_flamelet' of https://github.com/su2code/su…
bigfooted 1652a6d
Potential fix for pull request finding 'CodeQL / Multiplication resul…
bigfooted ceb8532
Move the SU2_MON changes to their own pull request
bigfooted c3bc995
Flamelet: clamp outside the mixture fraction range, robust PV source …
bigfooted 4dd35f6
Update the flame initialization and premixed hydrogen regression values
bigfooted 76d548e
Fix the preferential diffusion Jacobian step in AD builds
bigfooted 2ee8857
Flamelet: thermal PD Jacobian with its own diffusivity, guard off-man…
bigfooted 645ae90
Merge branch 'develop' into fix_unsteady_flamelet
bigfooted 16203e5
Merge branch 'develop' into fix_unsteady_flamelet
bigfooted 7fa2ba5
Flamelet: divide the auxiliary species source Jacobian by density
bigfooted 0974dd4
Merge branch 'develop' into fix_unsteady_flamelet
bigfooted File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -114,6 +114,7 @@ CFluidFlamelet::~CFluidFlamelet() { | |
| delete iomap_TD; | ||
| delete iomap_Sources; | ||
| delete iomap_LookUp; | ||
| delete iomap_SourceJacobian; | ||
| delete lookup_mlp; | ||
| if (preferential_diffusion) delete iomap_PD; | ||
| } | ||
|
|
@@ -244,6 +245,11 @@ void CFluidFlamelet::PreprocessLookUp(CConfig* config) { | |
| iomap_PD = new MLPToolbox::CIOMap(controlling_variable_names, varnames_PD); | ||
| lookup_mlp->PairVariableswithMLPs(*iomap_PD); | ||
| } | ||
| iomap_SourceJacobian = | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: this runs the source network a second time. Adding the Jacobian query to |
||
| new MLPToolbox::CIOMap(controlling_variable_names, {varnames_Sources[I_PROGVAR]}); | ||
| iomap_SourceJacobian->AddQueryJacobian(varnames_Sources[I_PROGVAR], controlling_variable_names[I_PROGVAR], | ||
| &source_pv_jac); | ||
| lookup_mlp->PairVariableswithMLPs(*iomap_SourceJacobian); | ||
| #endif | ||
| } else { | ||
| for (auto iVar = 0u; iVar < varnames_TD.size(); iVar++) { | ||
|
|
@@ -322,6 +328,12 @@ unsigned long CFluidFlamelet::EvaluateDataSet(const vector<su2double>& input_sca | |
| SU2_MPI::Error(string("Output vector size incompatible with manifold lookup operation."), CURRENT_FUNCTION); | ||
| if (include_mixture_fraction) { | ||
| inside = look_up_table->LookUp_XYZ(LUT_idx, output_refs, val_prog, val_enth, val_mixfrac); | ||
| /*--- Beyond the outer levels, beta_Z - Z keeps its boundary value. ---*/ | ||
| if (lookup_type == FLAMELET_LOOKUP_OPS::PREFDIF) { | ||
| const auto limits_z = look_up_table->GetTableLimitsZ(); | ||
| const su2double mixfrac_bound = min(max(val_mixfrac, limits_z.first), limits_z.second); | ||
| output_refs[FLAMELET_PREF_DIFF_SCALARS::I_BETA_MIXFRAC] += val_mixfrac - mixfrac_bound; | ||
| } | ||
| } else { | ||
| inside = look_up_table->LookUp_XY(LUT_idx, output_refs, val_prog, val_enth); | ||
| } | ||
|
|
@@ -342,3 +354,42 @@ unsigned long CFluidFlamelet::EvaluateDataSet(const vector<su2double>& input_sca | |
| AD::EndPreacc(); | ||
| return extrapolation; | ||
| } | ||
|
|
||
| su2double CFluidFlamelet::GetProgVarSourceJacobian(const vector<su2double>& input_scalar) { | ||
| const su2double val_prog = input_scalar[I_PROGVAR], val_enth = input_scalar[I_ENTH]; | ||
| const su2double val_mixfrac = include_mixture_fraction ? input_scalar[I_MIXFRAC] : 0.0; | ||
| switch (Kind_DataDriven_Method) { | ||
| case ENUM_DATADRIVEN_METHOD::LUT: { | ||
| const su2double delta = 1e-6; | ||
| const unsigned long idx = LUT_idx_Sources[I_PROGVAR]; | ||
| auto lookup = [&](const su2double pv, su2double& source) { | ||
| if (include_mixture_fraction) return look_up_table->LookUp_XYZ(idx, &source, pv, val_enth, val_mixfrac); | ||
| return look_up_table->LookUp_XY(idx, &source, pv, val_enth); | ||
| }; | ||
| /*--- Forward difference, backward at the manifold edge, zero for a point outside. ---*/ | ||
| su2double source, source_pert; | ||
| if (!lookup(val_prog, source)) { | ||
| source_pv_jac = 0.0; | ||
| } else if (lookup(val_prog + delta, source_pert)) { | ||
| source_pv_jac = (source_pert - source) / delta; | ||
| } else if (lookup(val_prog - delta, source_pert)) { | ||
| source_pv_jac = (source - source_pert) / delta; | ||
| } else { | ||
| source_pv_jac = 0.0; | ||
| } | ||
| break; | ||
| } | ||
| case ENUM_DATADRIVEN_METHOD::MLP: { | ||
| #ifdef USE_MLPCPP | ||
| su2double source; | ||
| vector<su2double*> refs_vars{&source}; | ||
| if (!lookup_mlp->Predict(*iomap_SourceJacobian, input_scalar, refs_vars)) source_pv_jac = 0.0; | ||
| #endif | ||
| break; | ||
| } | ||
| default: | ||
| source_pv_jac = 0.0; | ||
| break; | ||
| } | ||
| return source_pv_jac; | ||
| } | ||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
GetChemicalSourceJacobian(iVar)andSpeciesSourceJacobianalready hold the same kind of source Jacobian for Cantera. Could the flamelet solver reuse them, instead of adding a new virtual and array?