Skip to content

Commit 6edd6e8

Browse files
rois1995claude
andcommitted
Compute HLLC on moving grids in the frame of the face, fix its Jacobians
- Moving grids: the wave speeds, the pressure work of the moving face in the supersonic branches and the term V_g (p* - p)/(s - S_M) of the star-state energy were missing or inconsistent, so HLLC was not Galilean invariant (NACA0012 M 0.8, fixed grid vs still air and a translating grid: CL -12 %). The flux is now computed in the frame of the face (u' = u - w n, H' = H - w u_n + w^2/2) and transformed back (F = B F', J = B J' T). - Jacobians: sign of the velocity term of the general-gas dp/drho. The star-state Jacobians keep by default the density of the other state in dp*/dU (inexact, #2198), which was more robust with inexact linear solves in our tests; USE_ACCURATE_FLUX_JACOBIANS= YES now gives the exact derivative for fixed wave speeds. - Unit test hllc_jacobian_tests.cpp: finite differences in 2D and 3D, fixed and moving faces, both sides of the contact, all branches, default and exact. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LEL91DW5WPbPwgFtCvHga6
1 parent 316ec70 commit 6edd6e8

6 files changed

Lines changed: 381 additions & 53 deletions

File tree

‎Common/src/CConfig.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2171,7 +2171,7 @@ void CConfig::SetConfig_Options() {
21712171
addDoubleArrayOption("JST_SENSOR_COEFF", 2, false, jst_coeff);
21722172
/*!\brief LAX_SENSOR_COEFF \n DESCRIPTION: 1st order artificial dissipation coefficients for the Lax-Friedrichs method. \ingroup Config*/
21732173
addDoubleOption("LAX_SENSOR_COEFF", Kappa_1st_Flow, 0.15);
2174-
/*!\brief USE_ACCURATE_FLUX_JACOBIANS \n DESCRIPTION: Use numerically computed Jacobians for AUSM+up(2) and SLAU(2) \ingroup Config*/
2174+
/*!\brief USE_ACCURATE_FLUX_JACOBIANS \n DESCRIPTION: Use numerically computed Jacobians for AUSM+up(2) and SLAU(2), exact Jacobians (for fixed wave speeds) for HLLC \ingroup Config*/
21752175
addBoolOption("USE_ACCURATE_FLUX_JACOBIANS", Use_Accurate_Jacobians, false);
21762176
/*!\brief CENTRAL_JACOBIAN_FIX_FACTOR \n DESCRIPTION: Improve the numerical properties (diagonal dominance) of the global Jacobian matrix, 3 to 4 is "optimum" (central schemes) \ingroup Config*/
21772177
addDoubleOption("CENTRAL_JACOBIAN_FIX_FACTOR", Cent_Jac_Fix_Factor, 4.0);

‎SU2_CFD/include/numerics/flow/convection/hllc.hpp‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
class CUpwHLLC_Flow final : public CNumerics {
4040
private:
4141
bool implicit, dynamic_grid;
42+
bool useAccurateJacobian; /*!< \brief Jacobians computed exactly for fixed wave speeds (USE_ACCURATE_FLUX_JACOBIANS). */
4243
unsigned short iDim, jDim, iVar, jVar;
4344

4445
su2double *IntermediateState;
@@ -55,6 +56,8 @@ class CUpwHLLC_Flow final : public CNumerics {
5556
su2double *dSm_dU, *dPI_dU, *drhoStar_dU, *dpStar_dU, *dEStar_dU;
5657

5758
su2double* Flux; /*!< \brief The flux accross the face. */
59+
bool fixedWaveSpeeds = false; /*!< \brief Use fixed_sL, fixed_sR as wave speeds (verification of the Jacobians). */
60+
su2double fixed_sL = 0.0, fixed_sR = 0.0;
5861
su2double** Jacobian_i; /*!< \brief The Jacobian w.r.t. point i after computation. */
5962
su2double** Jacobian_j; /*!< \brief The Jacobian w.r.t. point j after computation. */
6063

@@ -79,6 +82,18 @@ class CUpwHLLC_Flow final : public CNumerics {
7982
*/
8083
ResidualType<> ComputeResidual(const CConfig* config) override;
8184

85+
/*!
86+
* \brief Fix the left and right wave speeds (relative to the face), for the verification of the Jacobians, which
87+
* treat them as constants.
88+
* \param[in] active - Use the fixed values.
89+
* \param[in] val_sL, val_sR - Left and right wave speeds.
90+
*/
91+
inline void SetFixedWaveSpeeds(bool active, su2double val_sL, su2double val_sR) {
92+
fixedWaveSpeeds = active;
93+
fixed_sL = val_sL;
94+
fixed_sR = val_sR;
95+
}
96+
8297
};
8398

8499
/*!
@@ -91,6 +106,7 @@ class CUpwHLLC_Flow final : public CNumerics {
91106
class CUpwGeneralHLLC_Flow final : public CNumerics {
92107
private:
93108
bool implicit, dynamic_grid;
109+
bool useAccurateJacobian; /*!< \brief Jacobians computed exactly for fixed wave speeds (USE_ACCURATE_FLUX_JACOBIANS). */
94110
unsigned short iDim, jDim, iVar, jVar;
95111

96112
su2double *IntermediateState;
@@ -108,6 +124,8 @@ class CUpwGeneralHLLC_Flow final : public CNumerics {
108124
su2double *dSm_dU, *dPI_dU, *drhoStar_dU, *dpStar_dU, *dEStar_dU;
109125

110126
su2double* Flux; /*!< \brief The flux accross the face. */
127+
bool fixedWaveSpeeds = false; /*!< \brief Use fixed_sL, fixed_sR as wave speeds (verification of the Jacobians). */
128+
su2double fixed_sL = 0.0, fixed_sR = 0.0;
111129
su2double** Jacobian_i; /*!< \brief The Jacobian w.r.t. point i after computation. */
112130
su2double** Jacobian_j; /*!< \brief The Jacobian w.r.t. point j after computation. */
113131

@@ -132,6 +150,18 @@ class CUpwGeneralHLLC_Flow final : public CNumerics {
132150
*/
133151
ResidualType<> ComputeResidual(const CConfig* config) override;
134152

153+
/*!
154+
* \brief Fix the left and right wave speeds (relative to the face), for the verification of the Jacobians, which
155+
* treat them as constants.
156+
* \param[in] active - Use the fixed values.
157+
* \param[in] val_sL, val_sR - Left and right wave speeds.
158+
*/
159+
inline void SetFixedWaveSpeeds(bool active, su2double val_sL, su2double val_sR) {
160+
fixedWaveSpeeds = active;
161+
fixed_sL = val_sL;
162+
fixed_sR = val_sR;
163+
}
164+
135165
/*!
136166
* \brief Compute the Average quantities for a general fluid flux between two nodes i and j.
137167
* Using the approach of Vinokur and Montagne'

0 commit comments

Comments
 (0)