-
Notifications
You must be signed in to change notification settings - Fork 849
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
[WIP] Preconditioning for multicomponent flows #2426
base: develop
Are you sure you want to change the base?
Conversation
/*! | ||
* \brief Virtual member. | ||
* \param[in] val_enthalpy - Enthalpy value at the point. | ||
*/ | ||
virtual void ComputeTempFromEnthalpy(su2double val_enthalpy, su2double* val_temperature, | ||
const su2double* val_scalars = nullptr) {} |
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.
This seems inconsistent with the SetTDState_* functions.
Should this be SetTDState_h and then you use GetTemperature to get the temperature?
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.
In the pull request made by evert regarding preferential diffusion, he also used the same function for the flamelet solver. The only difference is that that function is in the CSpeciesFlameletSolver.cpp and I cannot access to that function when I set the primitives in SetPrimVar in CIncNSVariable.cpp
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.
My point is again to keep an abstract interface.
Evert's function is a private function of a specific solver which is perfectly fine, and it uses the fluid model... If you need a similar function, move it somewhere higher up in the hierarchy to make it accessible. For example the scalar solver. Or even the fluid model but implemented in a way that keeps it useful for all fluids.
/*! | ||
* \brief Compute Enthalpy given the temperature and scalars. | ||
*/ | ||
su2double ComputeEnthalpyFromT(const su2double val_temperature, const su2double* val_scalars); |
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.
Why doesn't this use TDState_T
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.
We compute the enthalpy from the temperature and the species mass fractions. That function is used for setting the enthalpy at the inlets.
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.
And why don't you compute the enthalpy in that function too instead of adding another function?
The idea with generic classes like CFluidModel is to have a concise abstract interface. Having specific functions that only a few subclasses implement defeats the purpose of a generic interface.
@@ -434,7 +434,7 @@ void CFVMFlowSolverBase<V, R>::Viscous_Residual_impl(unsigned long iEdge, CGeome | |||
const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); | |||
const bool tkeNeeded = (config->GetKind_Turb_Model() == TURB_MODEL::SST); | |||
|
|||
CVariable* turbNodes = nullptr; | |||
CVariable* turbNodes = nullptr; |
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.
Please setup your IDE to remove trailing spaces.
@@ -212,13 +212,43 @@ su2double CFluidScalar::ComputeMeanSpecificHeatCp(const su2double* val_scalars) | |||
return mean_cp; | |||
} | |||
|
|||
su2double CFluidScalar::ComputeEnthalpyFromT(const su2double val_temperature, const su2double* val_scalars){ | |||
su2double val_Enthalpy = Cp * (val_temperature - 298.15); |
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.
Isn't T0 a config option? It is bad practice to hard code constants like this.
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.
https://ansyshelp.ansys.com/public/account/secured?returnurl=////Views/Secured/corp/v242/en/flu_th/flu_th_sec_hxfer_theory.html this is the theory related to the enthalpy equation for multicomponent gases. T_ref is always 298.15 K for this equation
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.
Then make it a constant, not a hard-coded value everywhere.
val_Proj_Jac_Tensor[3][0] = val_scale * ((*val_temperature) * proj_vel / (*val_betainc2)); | ||
val_Proj_Jac_Tensor[3][1] = val_scale * ((*val_temperature) * val_normal[0] * (*val_density)); | ||
val_Proj_Jac_Tensor[3][2] = val_scale * ((*val_temperature) * val_normal[1] * (*val_density)); | ||
val_Proj_Jac_Tensor[3][3] = | ||
val_scale * ((*val_temperature) * (*val_dRhodT) + (*val_density)) * proj_vel; |
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.
What is happening here? Is temperature being used for enthalpy?
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.
the energy can be
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.
then some renaming is in order and you need to come up with a better solution to switch between formulations than to have an if statement everytime Cp is used (for example making Cp=1, or encapsulating the computation of enthalpy in a function).
Proposed Changes
This pull request aims to extend the preconditioning for incompressible multicomponent flows, specifically when FLUID_MIXTURE model is used and energy equation is solved. Changes introduced in this pull request aim to solve directly for the sensible enthalpy instead of temperature. Specifically, the energy equation that is going to be solved for multicomponent flows is given as follows:
and the sensible enthalpy is:
Currently$C_{p}$ does not depend on temperature for FLUID_MIXTURE, but it depends on the mixture composition. So the sensible enthalpy simplifies to $C_{p}*(T-T_{0})$ . For problems where $C_{p}$ strongly depends on the temperature, Cantera library will be coupled to SU2. After this pull request is completed, a pull request with a fluid model using Cantera will be done where an energy equation for the total enthalpy will be solved.
A pdf document will be attached in the coming days for giving more details about this pull request.
Related Work
Currently fluid mixture does not work correctly when the energy equation is on, this is mainly due to the fact that the energy equation that must be solved for multicomponent flows is the one mentioned above for the sensible enthalpy and not the energy equation for a perfect gas that is currently solved in SU2.
PR Checklist
pre-commit run --all
to format old commits.