hystrath / hyStrath

Hypersonic / Rarefied gas dynamics code developments (GPL-3.0)
https://hystrath.github.io/
GNU General Public License v3.0
225 stars 109 forks source link

hy2Foam: Updated turbulent terms and Mach number calculation #141

Open alexlshepherd opened 1 year ago

alexlshepherd commented 1 year ago

Turbulent Terms and Mach Number Calculation

Changes

Writes out the heat capactiy ratio, gamma, as a volScalarField, this is useful for post-processing. Calculation of gamma, and subsequently the Mach number, were modified to use the total (translational, rotational, vibrational, etc.) heat capacities. This revised calculation aligns with the common definition of speed of sound. The current release of hy2Foam uses only the tranlstional-rotational heat capacities to calculate the speed of sound, the reasons for this are unclear despite the provided.

The species conservation equation is modified to now include turbulent terms, making use of the turbulent Schmidt number defined in the transportProperties dictionary:

transportModels
{
  ...
  diffusionModelParameters
  {
    ...
    TurbulentSchmidtNumber   0.7;
  }
}

The viscous energy equation now includes turbulent thermal diffusivity terms. These changes have been only applied to the single temperature equations, so further modifications may need to be made to work with a two temperature model.

Known Issues

The turbulent Schmidt number must be defined in all cases, currently this parameter has no default value, and is still used in the laminar case, however since the turbulent viscosity mut() is zero this shouldn't be an issue. An error is occasionally raised when this fork is initially run, the simulation will then proceed as normal and can be largely ignored without issue. It has been observed that a case using "too many" or "too little" processors , when running a case in parallel with adjustableRunTime enabled, will start with timesteps on the order of 1e-100s. This behaviour has not been observed in hy2Foam (unmodified), and to mitigate it one can start with a fixed time step initially and change back later, or just simply change the number of processors.

Changes to Data Files

Reaction rate constants, variable A, were off by a few orders of magnitude in hTCReactionsES. This is likely a mistake due to unit conversion. This change was only made to one file for clarity, and should be updated in the other tutorial folders.

Molecular data in thermoDEM_TRVE was updated. Comments in that file elaborate on this. This change was only made to one file for clarity, and should be updated in the other tutorial folders as well as the variants: thermoDEM, thermoDEM_TR, etc.

sunny7bit commented 1 year ago

nice job!

LDK29 commented 11 months ago

Very useful work!!!

LDK29 commented 11 months ago

Turbulent Terms and Mach Number Calculation

Changes

Writes out the heat capactiy ratio, gamma, as a volScalarField, this is useful for post-processing. Calculation of gamma, and subsequently the Mach number, were modified to use the total (translational, rotational, vibrational, etc.) heat capacities. This revised calculation aligns with the common definition of speed of sound. The current release of hy2Foam uses only the tranlstional-rotational heat capacities to calculate the speed of sound, the reasons for this are unclear despite the provided.

The species conservation equation is modified to now include turbulent terms, making use of the turbulent Schmidt number defined in the transportProperties dictionary:

transportModels
{
  ...
  diffusionModelParameters
  {
    ...
    TurbulentSchmidtNumber   0.7;
  }
}

The viscous energy equation now includes turbulent thermal diffusivity terms. These changes have been only applied to the single temperature equations, so further modifications may need to be made to work with a two temperature model.

Known Issues

The turbulent Schmidt number must be defined in all cases, currently this parameter has no default value, and is still used in the laminar case, however since the turbulent viscosity mut() is zero this shouldn't be an issue. An error is occasionally raised when this fork is initially run, the simulation will then proceed as normal and can be largely ignored without issue. It has been observed that a case using "too many" or "too little" processors , when running a case in parallel with adjustableRunTime enabled, will start with timesteps on the order of 1e-100s. This behaviour has not been observed in hy2Foam (unmodified), and to mitigate it one can start with a fixed time step initially and change back later, or just simply change the number of processors.

Changes to Data Files

Reaction rate constants, variable A, were off by a few orders of magnitude in hTCReactionsES. This is likely a mistake due to unit conversion. This change was only made to one file for clarity, and should be updated in the other tutorial folders.

Molecular data in thermoDEM_TRVE was updated. Comments in that file elaborate on this. This change was only made to one file for clarity, and should be updated in the other tutorial folders as well as the variants: thermoDEM, thermoDEM_TR, etc.

Hi Shepherd, I am a user of hy2Foam. Recently, I want to let hy2Foam output the vibrationasl energy of species, VT relaxtion time and the mass production rates of species. I have tried many times to change the codes, but it still can't work. Could you give some routines of output these variables? Thanks for your time and best regards.

alexlshepherd commented 11 months ago

Hi @LDK29 , Unfortunately I'm not too sure. I've only been working with hy2Foam for about a year and haven't used the two temperature models, let alone have the theoretical basis for it. From what I can tell, variables have to be created in the createFields.H file, or one of its dependencies, and then calculated/updated somewhere in the main loop. Not sure if you looked at it already, but hTCProperties in the case folder has some flags that might be of some help. I kind of got lucky in my case as the variables were already there, they just needed to be corrected and written to file. Again, I'm still pretty new to this so I'm not sure how much more help I can be, but I hope this is of some use nonetheless.

LDK29 commented 11 months ago

Hi @alexlshepherd , Thanks for your reply. For vibrational energy, I finally output them by add codes in file "write.H" like: forAll(composition.molecules(), moli) { const volScalarField e_v ( IOobject ( "e_v" + composition.molecules()[moli], runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), composition.hev(moli) ); e_v.write(); } But for the two other varibles, I still have no idea to output them. Anyway ,thanks for your suggestions.