Skip to content

Conversation

@Cristopher-Morales
Copy link
Contributor

@Cristopher-Morales Cristopher-Morales commented Jan 18, 2025

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:

image

and the sensible enthalpy is:
image

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 containing further details about this pull request is available at the following link:
preconditioning_general_approach.pdf

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

  • 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.

@Cristopher-Morales Cristopher-Morales changed the title [WIP] Preconditioning fro multicomponent flows [WIP] Preconditioning for multicomponent flows Jan 18, 2025
const su2double Ref_Temperature; /*!< \brief Reference temperature. */
const su2double GasConstant_Ref; /*!< \brief Gas constant reference needed for Nondimensional problems. */
const su2double Prandtl_Number; /*!< \brief Prandlt number.*/
const su2double Schmidt_Turb_Number; /*!< \brief Prandlt number.*/
Copy link
Member

Choose a reason for hiding this comment

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

Wrong doc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi!

Thanks for your comment,

I have added the right documentation,

please let me know any additional comment/suggestion about it.

Thanks in advance!!

viscous, /*!< \brief Viscous incompressible flows. */
energy; /*!< \brief computation with the energy equation. */
energy, /*!< \brief computation with the energy equation. */
multicomponent; /*!< \brief multicomponent incompressible flows. */
Copy link
Member

Choose a reason for hiding this comment

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

Not needed anymore?

Copy link
Contributor Author

@Cristopher-Morales Cristopher-Morales Oct 27, 2025

Choose a reason for hiding this comment

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

Hi!

thanks for you comment,

I added that boolean multicomponent because for axisymmetric flows, there is an additional term that comes from the enthalpy diffusion which is only needed for multicomponent flows (term in blue)

image

I thought that It should only be computed and added when it is needed because when the FLUID_MODEL is different than FLUID_MIXTURE, the species mass fractions become passive scalars, so the term in blue becomes zero.

Please let me know what you think about it.

Thank you so much in advance!!!

Comment on lines 291 to 292
su2double Mean_Thermal_Conductivity; /*!< \brief Mean value of the effective thermal conductivity. */
su2double Mean_Heat_Capacity; /*!< \brief Mean value of the heat capacity. */
Copy link
Member

Choose a reason for hiding this comment

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

Can we avoid intermediate su2doubles as class members?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi!

Thanks for the comment!

I have removed this line because with the previous pull request about conductivity for compressible flows #2420, the mean heat capacity is now a member of the CAvgGrad_Base in the flow_diffussion.hpp, so there was no need to re-declare it in the CAvgGradInc_Flow.
Please let me know any additional comment about it.

Thanks in advance!!

Comment on lines 213 to 214
* \param[in,out] primitive - Primitive variables.
* \param[in] scalar - scalar variable.
Copy link
Member

Choose a reason for hiding this comment

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

order doesn't match function signature

Copy link
Contributor Author

Choose a reason for hiding this comment

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

HI!

Thanks for the comment!

I switched the order of them according to the function.

Please let me know if that was needed to address this comment.

Thanks in advance!!!

Comment on lines +120 to +123
void CFluidFlamelet::SetTDState_h(su2double val_enthalpy, const su2double* val_scalars) {
SetTDState_T(val_enthalpy, val_scalars);
}

Copy link
Member

Choose a reason for hiding this comment

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

This looks comment-worthy, why can you pass enthalpy as temperature?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi!

thanks for the comment!!,

when the SPECIES_FLAMELET solver is used, one of the scalar equation is for total enthalpy, specifically the one with index 1.
As you can see from the picture in SetTDState_T added by Nijso and Evert, if I am not mistaken, the temperature (which is the current variable that is being solved in SU2) is a passive value, it is not used in that function because with the val_scalars (which are the variables used in the manifold for the Flamelet generated Manifold (FGM) approach) the temperature and any other thermochemical property are retrieved from the lookup table as you can see from lines 131.

image

So, as you might remember, in a previous developer meeting I mentioned that if we solve for the enthalpy in the preconditioning, we can eventually move the enthalpy equation solved in the SPECIES FLAMELET solver to the INC_EULER_SOLVER. This is not done in the current pull request because then the pull request will become even much larger as it is.
Please let me know if I should add a comment above these two functions explaining why enthalpy and temperature are passive values when the SPECIES_FLAMELET solver is used.

In a future pull request, we plan to move the enthalpy equation to the INC_EULER_SOLVER, so the SPECIES_FLAMELET solver can be reduced and used only for solving the additional transport equations needed for the FGM approach.

Thank you so much in advance!!!


/*!
* \brief Get enthalpy diffusivity terms.
*/
Copy link
Member

Choose a reason for hiding this comment

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

document the arguments, what size is the array expected to have, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi!

Thank you so much for your comment,

I have added a documentation of arguments and the size of the array expected by this function.

Please let me know what you think about it.

Thanks!

Comment on lines 329 to 343
su2double EnthalpyDiffusion_i[MAXNVAR_SPECIES]{0.0};
su2double GradEnthalpyDiffusion_i[MAXNVAR_SPECIES]{0.0};
FluidModel->SetTDState_T(nodes->GetPrimitive(iPoint)[prim_idx.Temperature()], Species_i);
FluidModel->SetEddyViscosity(nodes->GetPrimitive(iPoint)[prim_idx.EddyViscosity()]);
FluidModel->GetEnthalpyDiffusivity(EnthalpyDiffusion_i);
if (implicit) FluidModel->GetGradEnthalpyDiffusivity(GradEnthalpyDiffusion_i);

/*--- Repeat the above computations for jPoint. ---*/

su2double EnthalpyDiffusion_j[MAXNVAR_SPECIES]{0.0};
su2double GradEnthalpyDiffusion_j[MAXNVAR_SPECIES]{0.0};
FluidModel->SetTDState_T(nodes->GetPrimitive(jPoint)[prim_idx.Temperature()], Species_j);
FluidModel->SetEddyViscosity(nodes->GetPrimitive(jPoint)[prim_idx.EddyViscosity()]);
FluidModel->GetEnthalpyDiffusivity(EnthalpyDiffusion_j);
if (implicit) FluidModel->GetGradEnthalpyDiffusivity(GradEnthalpyDiffusion_j);
Copy link
Member

Choose a reason for hiding this comment

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

use a lambda to avoid the copy paste

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi!

Thank you so much for your comment,

I have added the lambda function for this part.

Please let me know what you think about it.

Thanks!

@bigfooted
Copy link
Contributor

Hi @Cristopher-Morales , do the pywrapper testcases work correctly or is there still some issue?

@Cristopher-Morales
Copy link
Contributor Author

Hi @Cristopher-Morales , do the pywrapper testcases work correctly or is there still some issue?

Hi @bigfooted,

Thanks for your comment!!

the test case pywrapper_zimont does not work correctly, the other one regarding custom source buoyancy works fine.
Could you share with me information about this test case?
so I can see the energy equation that is used for this test case.
It might need some additional adaption this test case.

Thank you so much in advance!!!

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.

4 participants