-
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?
Changes from 22 commits
ca9083e
0487a68
dd369bb
5076f9d
09fe6f4
851b13f
f258308
63a8f37
cb1d3ef
30d0b88
dd22fcd
7f92730
fdbb9b9
c0b10a6
911c996
2af10c3
d0d0221
a1f526c
c469d32
ef2dc5f
94bd0b0
1c44044
912642b
a6ce2d4
e9d1e1f
127df29
211dda0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,6 +91,11 @@ class CFluidScalar final : public CFluidModel { | |
*/ | ||
su2double ComputeMeanSpecificHeatCp(const su2double* val_scalars); | ||
|
||
/*! | ||
* \brief Compute Enthalpy given the temperature and scalars. | ||
*/ | ||
su2double ComputeEnthalpyFromT(const su2double val_temperature, const su2double* val_scalars); | ||
Comment on lines
+94
to
+97
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. Why doesn't this use TDState_T 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. 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 commentThe 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? |
||
|
||
/*! | ||
* \brief Compute gas constant for mixture. | ||
*/ | ||
|
@@ -137,6 +142,22 @@ class CFluidScalar final : public CFluidModel { | |
*/ | ||
inline su2double GetMassDiffusivity(int ivar) override { return massDiffusivity[ivar]; } | ||
|
||
/*! | ||
* \brief Get enthalpy diffusivity terms. | ||
*/ | ||
void GetEnthalpyDiffusivity(su2double* enthalpy_diffusions) override; | ||
|
||
/*! | ||
* \brief Get gradient enthalpy diffusivity terms. | ||
*/ | ||
void GetGradEnthalpyDiffusivity(su2double* grad_enthalpy_diffusions) override; | ||
|
||
/*! | ||
* \brief Compute Temperature from Enthalpy and scalars. | ||
*/ | ||
void ComputeTempFromEnthalpy(const su2double val_enthalpy, su2double* val_temperature, | ||
const su2double* val_scalars) override; | ||
|
||
/*! | ||
* \brief Set the Dimensionless State using Temperature. | ||
* \param[in] t - Temperature value at the point. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. Please setup your IDE to remove trailing spaces. |
||
if (tkeNeeded) turbNodes = solver_container[TURB_SOL]->GetNodes(); | ||
|
||
/*--- Points, coordinates and normal vector in edge ---*/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Then make it a constant, not a hard-coded value everywhere. |
||
return val_Enthalpy; | ||
} | ||
|
||
void CFluidScalar::ComputeTempFromEnthalpy(const su2double val_enthalpy, su2double* val_temperature, | ||
const su2double* val_scalars) { | ||
MassToMoleFractions(val_scalars); | ||
su2double val_cp = ComputeMeanSpecificHeatCp(val_scalars); | ||
*val_temperature = val_enthalpy / val_cp + 298.15; | ||
} | ||
|
||
void CFluidScalar::GetEnthalpyDiffusivity(su2double* enthalpy_diffusions) { | ||
for (int iVar = 0; iVar < n_species_mixture - 1; iVar++) { | ||
enthalpy_diffusions[iVar] = Density * | ||
(specificHeat[iVar] * massDiffusivity[iVar] - | ||
specificHeat[n_species_mixture - 1] * massDiffusivity[n_species_mixture - 1]) * | ||
(Temperature - 298.15); | ||
} | ||
} | ||
|
||
void CFluidScalar::GetGradEnthalpyDiffusivity(su2double* grad_enthalpy_diffusions){ | ||
for (int iVar = 0; iVar < n_species_mixture - 1; iVar++) { | ||
grad_enthalpy_diffusions[iVar] = Density * | ||
(specificHeat[iVar] * massDiffusivity[iVar] - | ||
specificHeat[n_species_mixture - 1] * massDiffusivity[n_species_mixture - 1]); | ||
} | ||
} | ||
|
||
void CFluidScalar::SetTDState_T(const su2double val_temperature, const su2double* val_scalars) { | ||
MassToMoleFractions(val_scalars); | ||
ComputeGasConstant(); | ||
Temperature = val_temperature; | ||
Density = Pressure_Thermodynamic / (Temperature * Gas_Constant); | ||
Cp = ComputeMeanSpecificHeatCp(val_scalars); | ||
Cv = Cp - Gas_Constant; | ||
Enthalpy = ComputeEnthalpyFromT(Temperature, val_scalars); | ||
|
||
if (wilke) { | ||
Mu = WilkeViscosity(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.
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.