Skip to content

Thermochemically consistent backflow treatment for FGM#2818

Open
joshkellyjak wants to merge 6 commits into
developfrom
feature_inc_outflow_backflow
Open

Thermochemically consistent backflow treatment for FGM#2818
joshkellyjak wants to merge 6 commits into
developfrom
feature_inc_outflow_backflow

Conversation

@joshkellyjak
Copy link
Copy Markdown
Contributor

Proposed Changes

Added thermochemically consistent backflow treatment for FGM calculations to stabilise early convergence in the presence of reversed-velocity at the outlet. In the flow solver, reversed-velocity ghost states at outlet faces are corrected by reflecting the normal velocity component. In the flamelet scalar solver, a new BC_Outlet override blends the enthalpy ghost state between the interior value and a thermodynamically consistent inlet enthalpy, computed via Newton iteration on the FGM LUT, while clamping the progress variable to it's unburnt value and preventing burned scalars from re-entering the domain and pushing FGM lookups outside manifold bounds. The backflow prevention deactivates automatically after a user-specified number of outer iterations, allowing physically real backflow to develop once the solution has stabilised.

Related Work

N/A

PR Checklist

  • I am submitting my contribution to the develop branch.
  • My contribution generates no new compiler warnings (try with --warnlevel=3 when using meson).
  • My contribution is commented and consistent with SU2 style (https://su2code.github.io/docs_v7/Style-Guide/).
  • I used the pre-commit hook to prevent dirty commits and used pre-commit run --all to format old commits.
  • I have added a test case that demonstrates my contribution, if necessary.
  • I have updated appropriate documentation (Tutorials, Docs Page, config_template.cpp), if necessary.

Comment on lines +104 to +109
std::cerr << std::endl << std::endl;
std::cerr << "Error in \"" << FunctionName << "\": " << std::endl;
std::cerr << "-------------------------------------------------------------------------" << std::endl;
std::cerr << ErrorMsg << std::endl;
std::cerr << "------------------------------ Error Exit -------------------------------" << std::endl;
std::cerr << std::endl << std::endl;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

revert please

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oops this must've slipped through

Comment on lines +2866 to +2874
/*--- Print a warning if backflow was detected on this outlet marker. ---*/
BEGIN_SU2_OMP_SAFE_GLOBAL_ACCESS {
if (nBackflow_loc > 0) {
cout << "WARNING [Rank " << rank << "]: Backflow detected at outlet marker \""
<< Marker_Tag << "\": " << static_cast<unsigned long>(nBackflow_loc)
<< " face(s) have reversed normal velocity." << endl;
}
}
END_SU2_OMP_SAFE_GLOBAL_ACCESS
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't like this type of debug output we have in wall functions too and it's a pain when it goes off on multiple ranks, you come back to your terminal and can even scroll back to find where the problem started.
The right way to do this is to store the count as a solver member, then the output class can do an MPI reduction and report it as an output, which you can choose to have on screen or not. Then if you want to print a concise warning when files are written out, like we do for non physical points, that's also not a bad idea.

Comment on lines +2686 to +2687
SU2_OMP_ATOMIC
nBackflow_loc += 1;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This variable is thread-local because all threads already enter this function and thus get their own copy of all local variables.
You need to make it static, or if you make it a class member like I mention in the other commend it also works (because the solver is not created by all threads so solver members are shared).

Comment on lines +518 to +538
// Compute a manifold-consistent enthalpy state for backflow faces.
// V_ref is the inlet bulk velocity; used to normalise the blending weight so that
// alpha -> 0 for marginal backflow and alpha -> 1 for strong backflow.
string Inlet_Tag;
bool found_inlet = false;
for (auto iMarker = 0u; iMarker < config->GetnMarker_CfgFile(); iMarker++) {
const string tag = config->GetMarker_CfgFile_TagBound(iMarker);
if (config->GetMarker_CfgFile_KindBC(tag) == INLET_FLOW) {
Inlet_Tag = tag;
found_inlet = true;
break;
}
}
if (!found_inlet) {
/*--- No inlet boundary defined — nothing to blend against; fall back to Neumann. ---*/
CSpeciesSolver::BC_Outlet(geometry, solver_container, conv_numerics, visc_numerics, config, val_marker);
return;
}

const su2double T_inlet = config->GetInletTtotal(Inlet_Tag);
const su2double V_ref = config->GetInletPtotal(Inlet_Tag) / config->GetVelocity_Ref();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This needs hardening. What if you have multiple inlets? What about the type of inlet?
The robust thing to do is to either have the backflow values specified or derive them some other way (which is possible, but I can't say what I've done in other places).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants