CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > SU2

Quadratic Equation Coefficient Discrepancy in SU2 Code for Total Boundary Conditions

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 20, 2023, 03:09
Default Quadratic Equation Coefficient Discrepancy in SU2 Code for Total Boundary Conditions
  #1
New Member
 
Kuan-Lin Chen
Join Date: Sep 2016
Location: Taiwan
Posts: 10
Rep Power: 10
Kuan is on a distinguished road
Hi everyone ,

I'm currently trying to understand how the total boundary condition works, and I've been referring to the SU2 code (lines 6546 to 6641).
https://github.com/su2code/SU2/blob/...46C15-L6546C15
However, I've noticed that the coefficient of the quadratic equation in the code appears to be incorrect.

Here are the relevant equations for reference:
Riemann invariant: R=2*c/(γ-1)+U so U=R-2*c/(γ-1)
Stagnation sound speed: c_t^2=(γ-1)*(0.5*U^2 )+c^2
Where c is the sound speed, c_t is the stagnation sound speed, and U is the flow velocity.
Code:
 /*--- Total speed of sound ---*/

          SoundSpeed_Total2 = Gamma_Minus_One*(H_Total - (Energy + Pressure/Density)+0.5*Velocity2) + SoundSpeed2;
The derivation process is as follows:
(c_t^2)/(γ-1 )=c^2/(γ-1)+0.5*U^2
→c_t^2=(γ-1)(0.5*U^2 )+c^2
→c_t^2=0.5*(γ-1)*[R-2*c/(γ-1)]^2+c^2
→c_t^2=0.5*(γ-1)*[R^2-4*R*c/(γ-1)+4*c^2/(γ-1)^2 ]+c^2
→c_t^2=0.5*(γ-1)*R^2-2*R*c+2*c^2/(γ-1)+c^2
Multiplying both sides by 0.5*(γ-1) gives:
0.5*(γ-1)*c_t^2=0.25*[(γ-1)^2]*R^2-(γ-1)*R*c+c^2+0.5*(γ-1)*c^2
[1+0.5*(γ-1)] *c^2-(γ-1)*R*c+0.25*R^2*(γ-1)^2-0.5*(γ-1)*c_t^2=0
The coefficients of the quadratic equation are:
aa=1+0.5*(γ-1),bb=-(γ-1)*R, cc=0.25*R^2*(γ-1)^2- 0.5*c_t^2*(γ-1)

However, the source code of SU2 shows that:
aa=1+0.5*(γ-1),bb=-(γ-1)*R, cc=0.5*R^2*(γ-1)-2*c_t^2/(γ-1)

Code:
         
 /*--- Coefficients in the quadratic equation for the velocity ---*/

          aa =  1.0 + 0.5*Gamma_Minus_One*alpha*alpha;
          bb = -1.0*Gamma_Minus_One*alpha*Riemann;
          cc =  0.5*Gamma_Minus_One*Riemann*Riemann
              -2.0*SoundSpeed_Total2/Gamma_Minus_One;
I would appreciate any assistance in checking or explaining why the cc coefficient in the code is 0.5*R^2*(γ-1)-2*c_t^2/(γ-1)?
Thank you.
Kuan is offline   Reply With Quote

Old   December 22, 2023, 14:22
Default
  #2
New Member
 
Join Date: Feb 2022
Posts: 19
Rep Power: 4
cristopher_morales is on a distinguished road
Quote:
Originally Posted by Kuan View Post
Hi everyone ,

Code:
 /*--- Total speed of sound ---*/

          SoundSpeed_Total2 = Gamma_Minus_One*(H_Total - (Energy + Pressure/Density)+0.5*Velocity2) + SoundSpeed2;
.
Hi Kuan,

Do you know where the expression in brackets comes from?

(H_Total - (Energy + Pressure/Density)+0.5*Velocity2)

Why this additional term H_Total - (Energy + Pressure/Density)?

I would really appreciate if you have some reference where I can get information about it.

Thank you so much in advance!!!
cristopher_morales is offline   Reply With Quote

Old   December 23, 2023, 10:07
Default
  #3
New Member
 
Kuan-Lin Chen
Join Date: Sep 2016
Location: Taiwan
Posts: 10
Rep Power: 10
Kuan is on a distinguished road
Hi Christopher_Morales,

I am uncertain about the inclusion of H_Total - (Energy + Pressure/Density) within the brackets, too.
However, upon reviewing lines 6571 and 6573, it appears that H_Total - (Energy + Pressure/Density) could be eliminated.
Therefore, in my derivation process, I chose to omit this term as it seemed inconsistent with the overall expression.

I apologize if this leads to any disappointment or confusion.
If you have any insights or suggestions regarding this specific term, I would greatly appreciate your input.
Kuan is offline   Reply With Quote

Old   December 25, 2023, 13:58
Default
  #4
pcg
Senior Member
 
Pedro Gomes
Join Date: Dec 2017
Posts: 466
Rep Power: 13
pcg is on a distinguished road
Cristopher I think the answer to that is in the SUmb implementation
https://github.com/sumbcode/sumb/blo...onicInflow.f90
The comment in line 161 mentions that this version is valid for variable Cp using a linearization around the internal state.
pcg is offline   Reply With Quote

Old   December 25, 2023, 14:04
Default
  #5
pcg
Senior Member
 
Pedro Gomes
Join Date: Dec 2017
Posts: 466
Rep Power: 13
pcg is on a distinguished road
Kuan the Riemann invariant extrapolated from the interior is the negative one, so 2 * c / (gamma - 1) - Vn.
Note that Vn is the normal velocity, in the code the minus sign comes from the unit normal pointing outward.
pcg is offline   Reply With Quote

Old   December 26, 2023, 02:05
Default
  #6
New Member
 
Kuan-Lin Chen
Join Date: Sep 2016
Location: Taiwan
Posts: 10
Rep Power: 10
Kuan is on a distinguished road
Quote:
Originally Posted by pcg View Post
Kuan the Riemann invariant extrapolated from the interior is the negative one, so 2 * c / (gamma - 1) - Vn.
Note that Vn is the normal velocity, in the code the minus sign comes from the unit normal pointing outward.
Hi pcg,

Thank you for your response.

(1) i modfied the Riemann invarient to R=2*c/(γ-1)-U
but the coefficients of the quadratic equation still differ from the SU2 code.

The derivation process is as follows:
(c_t^2)/(γ-1 )=c^2/(γ-1)+0.5*U^2
→c_t^2=(γ-1)(0.5*U^2 )+c^2
→c_t^2=0.5*(γ-1)*[2*c/(γ-1)-R]^2+c^2
→c_t^2=0.5*(γ-1)*[4*c^2/(γ-1)^2-4*R*c/(γ-1)+R^2]+c^2
→c_t^2=0.5*(γ-1)*R^2-2*R*c+2*c^2/(γ-1)+c^2
Multiplying both sides by 0.5*(γ-1) gives:
0.5*(γ-1)*c_t^2=0.25*[(γ-1)^2]*R^2-(γ-1)*R*c+c^2+0.5*(γ-1)*c^2
[1+0.5*(γ-1)]*c^2-(γ-1)*R*c+0.25*R^2*(γ-1)^2-0.5*(γ-1)*c_t^2=0
The coefficients of the quadratic equation are:
aa=1+0.5*(γ-1),bb=-(γ-1)*R, cc=0.25*R^2*(γ-1)^2- 0.5*c_t^2*(γ-1)

The source code of SU2 shows that:
aa=1+0.5*(γ-1),bb=-(γ-1)*R, cc=0.5*R^2*(γ-1)-2*c_t^2/(γ-1)

This likely involves specific considerations in the SU2 code that might not be apparent in the derivation.
Could you please offer a more detailed explanation?

(2) Regarding the additional term H_Total - (Energy + Pressure/Density), it seems to be used for calculating the total sound speed for variable cp,as indicated by the source code you provided.
However, I'm not entirely clear on how it is developed in the code and combined with the Riemann invariant.
I would appreciate a more detailed explanation of this part.

Thank you for your assistance.
Kuan is offline   Reply With Quote

Old   December 26, 2023, 11:26
Default
  #7
pcg
Senior Member
 
Pedro Gomes
Join Date: Dec 2017
Posts: 466
Rep Power: 13
pcg is on a distinguished road
We're solving for U in the code, not the speed of sound.
I don't have more details on the total speed of sound formulation.
pcg is offline   Reply With Quote

Old   December 26, 2023, 23:18
Default
  #8
New Member
 
Kuan-Lin Chen
Join Date: Sep 2016
Location: Taiwan
Posts: 10
Rep Power: 10
Kuan is on a distinguished road
Quote:
Originally Posted by pcg View Post
We're solving for U in the code, not the speed of sound.
I don't have more details on the total speed of sound formulation.
Hi pcg,

Thank you for your correction. However, I'm still unable to find references or equations that directly solve velocity U using the Riemann invariant. The methods I've come across, such as FUN3D, utilize the Riemann invariant to solve for sound speed and subsequently obtain velocity (see equations 36-45 in this reference https://fun3d.larc.nasa.gov/papers/N...011-217181.pdf).

I'm curious about how the coefficients of the quadratic equation for velocity are developed in SU2. Could you provide more insights into this process?

Thank you for your assistance.
Kuan is offline   Reply With Quote

Old   December 27, 2023, 00:43
Default
  #9
pcg
Senior Member
 
Pedro Gomes
Join Date: Dec 2017
Posts: 466
Rep Power: 13
pcg is on a distinguished road
Same thing you've done but replacing c instead of replacing U I suppose.
One book mentions that solving for c may be better for low Mach numbers.
pcg is offline   Reply With Quote

Old   December 27, 2023, 01:35
Default
  #10
New Member
 
Kuan-Lin Chen
Join Date: Sep 2016
Location: Taiwan
Posts: 10
Rep Power: 10
Kuan is on a distinguished road
Quote:
Originally Posted by pcg View Post
Same thing you've done but replacing c instead of replacing U I suppose.
One book mentions that solving for c may be better for low Mach numbers.
I see now. Thank you very much for your help.
Kuan is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Centrifugal fan j0hnny CFX 13 October 1, 2019 13:55
Domain Reference Pressure and mass flow inlet boundary AdidaKK CFX 75 August 20, 2018 05:37
My radial inflow turbine Abo Anas CFX 27 May 11, 2018 01:44
Basic Nozzle-Expander Design karmavatar CFX 20 March 20, 2016 08:44
Difficulty In Setting Boundary Conditions Moinul Haque CFX 4 November 25, 2014 17:30


All times are GMT -4. The time now is 00:10.