Skip to content

Commit 55179d0

Browse files
authored
Merge branch 'develop' into feature_custom_species_walls
2 parents dc70b78 + b91b14d commit 55179d0

File tree

9 files changed

+52
-57
lines changed

9 files changed

+52
-57
lines changed

SU2_CFD/include/numerics/CNumerics.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@ class CNumerics {
10591059
* \param[in] val_velocity - Pointer to the velocity.
10601060
* \param[in] val_betainc2 - Value of the artificial compresibility factor.
10611061
* \param[in] val_enthalpy - Value of the enthalpy.
1062-
* \param[in] val_dRhodT - Value of the derivative of density w.r.t. temperature.
1062+
* \param[in] val_dRhodh - Value of the derivative of density w.r.t. enthalpy.
10631063
* \param[in] val_normal - Normal vector, the norm of the vector is the area of the face.
10641064
* \param[in] val_scale - Scale of the projection.
10651065
* \param[out] val_Proj_Jac_tensor - Pointer to the projected inviscid Jacobian.
@@ -1068,7 +1068,7 @@ class CNumerics {
10681068
const su2double *val_velocity,
10691069
const su2double *val_betainc2,
10701070
const su2double *val_enthalpy,
1071-
const su2double *val_dRhodT,
1071+
const su2double *val_dRhodh,
10721072
const su2double *val_normal,
10731073
su2double val_scale,
10741074
su2double **val_Proj_Jac_Tensor) const;

SU2_CFD/include/variables/CIncEulerVariable.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,14 @@ class CIncEulerVariable : public CFlowVariable {
7878
* \brief Constructor of the class.
7979
* \param[in] val_pressure - value of the pressure.
8080
* \param[in] velocity - Value of the flow velocity (initialization value).
81-
* \param[in] temperature - Value of the temperature (initialization value).
81+
* \param[in] enthalpy - Value of the enthalpy (initialization value).
8282
* \param[in] npoint - Number of points/nodes/vertices in the domain.
8383
* \param[in] ndim - Number of dimensions of the problem.
8484
* \param[in] nvar - Number of variables of the problem.
8585
* \param[in] config - Definition of the particular problem.
8686
*/
8787

88-
CIncEulerVariable(su2double pressure, const su2double *velocity, su2double temperature,
88+
CIncEulerVariable(su2double pressure, const su2double *velocity, su2double enthalpy,
8989
unsigned long npoint, unsigned long ndim, unsigned long nvar, const CConfig *config);
9090

9191
/*!
@@ -125,7 +125,7 @@ class CIncEulerVariable : public CFlowVariable {
125125
}
126126

127127
/*!
128-
* \brief Set the value of the enthalpy for multicomponent incompressible flows with energy equation.
128+
* \brief Set the value of the enthalpy for incompressible flows with energy equation.
129129
* \param[in] iPoint - Point index.
130130
*/
131131
inline void SetEnthalpy(unsigned long iPoint, su2double val_enthalpy) {

SU2_CFD/src/numerics/CNumerics.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ void CNumerics::GetInviscidProjJac(const su2double *val_velocity, const su2doubl
250250

251251
void CNumerics::GetInviscidIncProjJac(const su2double *val_density, const su2double *val_velocity,
252252
const su2double *val_betainc2, const su2double *val_enthalpy,
253-
const su2double *val_dRhodT, const su2double *val_normal,
253+
const su2double *val_dRhodh, const su2double *val_normal,
254254
su2double val_scale, su2double **val_Proj_Jac_Tensor) const {
255255
const bool wasActive = AD::BeginPassive();
256256
unsigned short iDim;
@@ -265,54 +265,54 @@ void CNumerics::GetInviscidIncProjJac(const su2double *val_density, const su2dou
265265
val_Proj_Jac_Tensor[0][0] = val_scale*(proj_vel/(*val_betainc2));
266266
val_Proj_Jac_Tensor[0][1] = val_scale*(val_normal[0]*(*val_density));
267267
val_Proj_Jac_Tensor[0][2] = val_scale*(val_normal[1]*(*val_density));
268-
val_Proj_Jac_Tensor[0][3] = val_scale*((*val_dRhodT)*proj_vel);
268+
val_Proj_Jac_Tensor[0][3] = val_scale*((*val_dRhodh)*proj_vel);
269269

270270
val_Proj_Jac_Tensor[1][0] = val_scale*(val_normal[0] + val_velocity[0]*proj_vel/(*val_betainc2));
271271
val_Proj_Jac_Tensor[1][1] = val_scale*((*val_density)*(val_normal[0]*val_velocity[0] + proj_vel));
272272
val_Proj_Jac_Tensor[1][2] = val_scale*(val_normal[1]*(*val_density)*val_velocity[0]);
273-
val_Proj_Jac_Tensor[1][3] = val_scale*((*val_dRhodT)*val_velocity[0]*proj_vel);
273+
val_Proj_Jac_Tensor[1][3] = val_scale*((*val_dRhodh)*val_velocity[0]*proj_vel);
274274

275275
val_Proj_Jac_Tensor[2][0] = val_scale*(val_normal[1] + val_velocity[1]*proj_vel/(*val_betainc2));
276276
val_Proj_Jac_Tensor[2][1] = val_scale*(val_normal[0]*(*val_density)*val_velocity[1]);
277277
val_Proj_Jac_Tensor[2][2] = val_scale*((*val_density)*(proj_vel + val_normal[1]*val_velocity[1]));
278-
val_Proj_Jac_Tensor[2][3] = val_scale*((*val_dRhodT)*val_velocity[1]*proj_vel);
278+
val_Proj_Jac_Tensor[2][3] = val_scale*((*val_dRhodh)*val_velocity[1]*proj_vel);
279279

280280
val_Proj_Jac_Tensor[3][0] = val_scale*((*val_enthalpy)*proj_vel/(*val_betainc2));
281281
val_Proj_Jac_Tensor[3][1] = val_scale*((*val_enthalpy)*val_normal[0]*(*val_density));
282282
val_Proj_Jac_Tensor[3][2] = val_scale*((*val_enthalpy)*val_normal[1]*(*val_density));
283-
val_Proj_Jac_Tensor[3][3] = val_scale*(((*val_enthalpy)*(*val_dRhodT) + (*val_density))*proj_vel);
283+
val_Proj_Jac_Tensor[3][3] = val_scale*(((*val_enthalpy)*(*val_dRhodh) + (*val_density))*proj_vel);
284284

285285
} else {
286286

287287
val_Proj_Jac_Tensor[0][0] = val_scale*(proj_vel/(*val_betainc2));
288288
val_Proj_Jac_Tensor[0][1] = val_scale*(val_normal[0]*(*val_density));
289289
val_Proj_Jac_Tensor[0][2] = val_scale*(val_normal[1]*(*val_density));
290290
val_Proj_Jac_Tensor[0][3] = val_scale*(val_normal[2]*(*val_density));
291-
val_Proj_Jac_Tensor[0][4] = val_scale*((*val_dRhodT)*proj_vel);
291+
val_Proj_Jac_Tensor[0][4] = val_scale*((*val_dRhodh)*proj_vel);
292292

293293
val_Proj_Jac_Tensor[1][0] = val_scale*(val_normal[0] + val_velocity[0]*proj_vel/(*val_betainc2));
294294
val_Proj_Jac_Tensor[1][1] = val_scale*((*val_density)*(val_normal[0]*val_velocity[0] + proj_vel));
295295
val_Proj_Jac_Tensor[1][2] = val_scale*(val_normal[1]*(*val_density)*val_velocity[0]);
296296
val_Proj_Jac_Tensor[1][3] = val_scale*(val_normal[2]*(*val_density)*val_velocity[0]);
297-
val_Proj_Jac_Tensor[1][4] = val_scale*((*val_dRhodT)*val_velocity[0]*proj_vel);
297+
val_Proj_Jac_Tensor[1][4] = val_scale*((*val_dRhodh)*val_velocity[0]*proj_vel);
298298

299299
val_Proj_Jac_Tensor[2][0] = val_scale*(val_normal[1] + val_velocity[1]*proj_vel/(*val_betainc2));
300300
val_Proj_Jac_Tensor[2][1] = val_scale*(val_normal[0]*(*val_density)*val_velocity[1]);
301301
val_Proj_Jac_Tensor[2][2] = val_scale*((*val_density)*(proj_vel + val_normal[1]*val_velocity[1]));
302302
val_Proj_Jac_Tensor[2][3] = val_scale*(val_normal[2]*(*val_density)*val_velocity[1]);
303-
val_Proj_Jac_Tensor[2][4] = val_scale*((*val_dRhodT)*val_velocity[1]*proj_vel);
303+
val_Proj_Jac_Tensor[2][4] = val_scale*((*val_dRhodh)*val_velocity[1]*proj_vel);
304304

305305
val_Proj_Jac_Tensor[3][0] = val_scale*(val_normal[2] + val_velocity[2]*proj_vel/(*val_betainc2));
306306
val_Proj_Jac_Tensor[3][1] = val_scale*(val_normal[0]*(*val_density)*val_velocity[2]);
307307
val_Proj_Jac_Tensor[3][2] = val_scale*(val_normal[1]*(*val_density)*val_velocity[2]);
308308
val_Proj_Jac_Tensor[3][3] = val_scale*((*val_density)*(proj_vel + val_normal[2]*val_velocity[2]));
309-
val_Proj_Jac_Tensor[3][4] = val_scale*((*val_dRhodT)*val_velocity[2]*proj_vel);
309+
val_Proj_Jac_Tensor[3][4] = val_scale*((*val_dRhodh)*val_velocity[2]*proj_vel);
310310

311311
val_Proj_Jac_Tensor[4][0] = val_scale*((*val_enthalpy)*proj_vel/(*val_betainc2));
312312
val_Proj_Jac_Tensor[4][1] = val_scale*((*val_enthalpy)*val_normal[0]*(*val_density));
313313
val_Proj_Jac_Tensor[4][2] = val_scale*((*val_enthalpy)*val_normal[1]*(*val_density));
314314
val_Proj_Jac_Tensor[4][3] = val_scale*((*val_enthalpy)*val_normal[2]*(*val_density));
315-
val_Proj_Jac_Tensor[4][4] = val_scale*(((*val_enthalpy)*(*val_dRhodT) + (*val_density))*proj_vel);
315+
val_Proj_Jac_Tensor[4][4] = val_scale*(((*val_enthalpy)*(*val_dRhodh) + (*val_density))*proj_vel);
316316

317317
}
318318
AD::EndPassive(wasActive);

SU2_CFD/src/solvers/CIncEulerSolver.cpp

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2799,18 +2799,17 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
27992799
su2double U_time_nM1[MAXNVAR], U_time_n[MAXNVAR], U_time_nP1[MAXNVAR];
28002800
su2double Volume_nM1, Volume_nP1, TimeStep;
28012801
const su2double *Normal = nullptr, *GridVel_i = nullptr, *GridVel_j = nullptr;
2802-
su2double Density, Cp;
2802+
su2double Density;
28032803

28042804
const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT);
28052805
const bool first_order = (config->GetTime_Marching() == TIME_MARCHING::DT_STEPPING_1ST);
28062806
const bool second_order = (config->GetTime_Marching() == TIME_MARCHING::DT_STEPPING_2ND);
28072807
const bool energy = config->GetEnergy_Equation();
28082808

2809-
const int ndim = nDim;
2810-
auto V2U = [ndim](su2double Density, su2double Cp, const su2double* V, su2double* U) {
2809+
const int nvar = nVar;
2810+
auto V2U = [nvar](su2double Density, const su2double* V, su2double* U) {
28112811
U[0] = Density;
2812-
for (int iDim = 0; iDim < ndim; iDim++) U[iDim+1] = Density*V[iDim+1];
2813-
U[ndim+1] = Density*Cp*V[ndim+1];
2812+
for (int iVar = 1; iVar < nvar; ++iVar) U[iVar] = Density * V[iVar];
28142813
};
28152814

28162815
/*--- Store the physical time step ---*/
@@ -2837,16 +2836,15 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
28372836
V_time_n = nodes->GetSolution_time_n(iPoint);
28382837
V_time_nP1 = nodes->GetSolution(iPoint);
28392838

2840-
/*--- Access the density and Cp at this node (constant for now). ---*/
2839+
/*--- Access the density at this node (constant for now). ---*/
28412840

28422841
Density = nodes->GetDensity(iPoint);
2843-
Cp = nodes->GetSpecificHeatCp(iPoint);
28442842

28452843
/*--- Compute the conservative variable vector for all time levels. ---*/
28462844

2847-
V2U(Density, Cp, V_time_nM1, U_time_nM1);
2848-
V2U(Density, Cp, V_time_n, U_time_n);
2849-
V2U(Density, Cp, V_time_nP1, U_time_nP1);
2845+
V2U(Density, V_time_nM1, U_time_nM1);
2846+
V2U(Density, V_time_n, U_time_n);
2847+
V2U(Density, V_time_nP1, U_time_nP1);
28502848

28512849
/*--- CV volume at time n+1. As we are on a static mesh, the volume
28522850
of the CV will remained fixed for all time steps. ---*/
@@ -2867,13 +2865,9 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
28672865
/*--- Compute the Jacobian contribution due to the dual time source term. ---*/
28682866

28692867
if (implicit) {
2870-
su2double delta = (second_order? 1.5 : 1.0) * Volume_nP1 * Density / TimeStep;
2871-
2872-
for (iDim = 0; iDim < nDim; iDim++)
2873-
Jacobian.AddVal2Diag(iPoint, iDim+1, delta);
2868+
su2double delta = (second_order ? 1.5 : 1.0) * Volume_nP1 * Density / TimeStep;
28742869

2875-
if (energy) delta *= Cp;
2876-
Jacobian.AddVal2Diag(iPoint, nDim+1, delta);
2870+
for (iVar = 1; iVar < nVar; ++iVar) Jacobian.AddVal2Diag(iPoint, iVar, delta);
28772871
}
28782872
}
28792873
END_SU2_OMP_FOR
@@ -2898,8 +2892,7 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
28982892

28992893
V_time_n = nodes->GetSolution_time_n(iPoint);
29002894
Density = nodes->GetDensity(iPoint);
2901-
Cp = nodes->GetSpecificHeatCp(iPoint);
2902-
V2U(Density, Cp, V_time_n, U_time_n);
2895+
V2U(Density, V_time_n, U_time_n);
29032896

29042897
GridVel_i = geometry->nodes->GetGridVel(iPoint);
29052898

@@ -2954,8 +2947,7 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
29542947

29552948
V_time_n = nodes->GetSolution_time_n(iPoint);
29562949
Density = nodes->GetDensity(iPoint);
2957-
Cp = nodes->GetSpecificHeatCp(iPoint);
2958-
V2U(Density, Cp, V_time_n, U_time_n);
2950+
V2U(Density, V_time_n, U_time_n);
29592951

29602952
for (iVar = 0; iVar < nVar-!energy; iVar++)
29612953
LinSysRes(iPoint,iVar) += U_time_n[iVar]*Residual_GCL;
@@ -2981,16 +2973,15 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
29812973
V_time_n = nodes->GetSolution_time_n(iPoint);
29822974
V_time_nP1 = nodes->GetSolution(iPoint);
29832975

2984-
/*--- Access the density and Cp at this node (constant for now). ---*/
2976+
/*--- Access the density at this node (constant for now). ---*/
29852977

29862978
Density = nodes->GetDensity(iPoint);
2987-
Cp = nodes->GetSpecificHeatCp(iPoint);
29882979

29892980
/*--- Compute the conservative variable vector for all time levels. ---*/
29902981

2991-
V2U(Density, Cp, V_time_nM1, U_time_nM1);
2992-
V2U(Density, Cp, V_time_n, U_time_n);
2993-
V2U(Density, Cp, V_time_nP1, U_time_nP1);
2982+
V2U(Density, V_time_nM1, U_time_nM1);
2983+
V2U(Density, V_time_n, U_time_n);
2984+
V2U(Density, V_time_nP1, U_time_nP1);
29942985

29952986
/*--- CV volume at time n-1 and n+1. In the case of dynamically deforming
29962987
grids, the volumes will change. On rigidly transforming grids, the
@@ -3016,11 +3007,8 @@ void CIncEulerSolver::SetResidual_DualTime(CGeometry *geometry, CSolver **solver
30163007
if (implicit) {
30173008
su2double delta = (second_order? 1.5 : 1.0) * Volume_nP1 * Density / TimeStep;
30183009

3019-
for (iDim = 0; iDim < nDim; iDim++)
3020-
Jacobian.AddVal2Diag(iPoint, iDim+1, delta);
3021-
3022-
if (energy) delta *= Cp;
3023-
Jacobian.AddVal2Diag(iPoint, nDim+1, delta);
3010+
for (iVar = 1; iVar < nVar; ++iVar)
3011+
Jacobian.AddVal2Diag(iPoint, iVar, delta);
30243012
}
30253013
}
30263014
END_SU2_OMP_FOR

SU2_CFD/src/variables/CIncNSVariable.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ bool CIncNSVariable::SetPrimVar(unsigned long iPoint, su2double eddy_visc, su2do
123123

124124
SetSpecificHeatCp(iPoint, FluidModel->GetCp());
125125
SetSpecificHeatCv(iPoint, FluidModel->GetCv());
126+
127+
/*--- Set enthalpy ---*/
128+
126129
SetEnthalpy(iPoint, FluidModel->GetEnthalpy());
127130

128131
return physical;

TestCases/parallel_regression_AD.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,8 @@ def main():
316316
da_unsteadyCHT_cylinder.cfg_dir = "coupled_cht/disc_adj_unsteadyCHT_cylinder"
317317
da_unsteadyCHT_cylinder.cfg_file = "chtMaster.cfg"
318318
da_unsteadyCHT_cylinder.test_iter = 2
319-
da_unsteadyCHT_cylinder.test_vals = [-12.131633, -12.617906, -12.688933, -16.179747, -6.432277, 0.000000, 75.761000, 0.247780]
320-
da_unsteadyCHT_cylinder.test_vals_aarch64 = [-12.131633, -12.617906, -12.688933, -16.179747, -6.432277, 0.000000, 75.761000, 0.247780]
319+
da_unsteadyCHT_cylinder.test_vals = [-8.479629, -9.239920, -9.234868, -15.934511, -13.662012, 0.000000, 89.932000, 0.295190]
320+
da_unsteadyCHT_cylinder.test_vals_aarch64 = [-8.479629, -9.239920, -9.234868, -15.934511, -13.662012, 0.000000, 89.932000, 0.295190]
321321
da_unsteadyCHT_cylinder.unsteady = True
322322
da_unsteadyCHT_cylinder.multizone = True
323323
test_list.append(da_unsteadyCHT_cylinder)

TestCases/tutorials.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def main():
4949
cht_incompressible_unsteady.cfg_dir = "../Tutorials/multiphysics/unsteady_cht/"
5050
cht_incompressible_unsteady.cfg_file = "cht_2d_3cylinders.cfg"
5151
cht_incompressible_unsteady.test_iter = 2
52-
cht_incompressible_unsteady.test_vals = [-2.661443, -2.546289, -0.080399, -0.080399, -0.080399, -12.421980, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 238.240000] #last columns
52+
cht_incompressible_unsteady.test_vals = [-2.661440, -2.534489, -0.080399, -0.080399, -0.080399, -12.421979, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 238.240000] #last columns
5353
cht_incompressible_unsteady.multizone = True
5454
cht_incompressible_unsteady.unsteady = True
5555
test_list.append(cht_incompressible_unsteady)

meson_scripts/init.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ def _extract_member(self, member, targetpath, pwd):
289289

290290
if not os.path.exists(filepath) and not os.path.exists(alt_filepath):
291291
try:
292-
urllib.request.urlretrieve(url, commit_sha + ".zip")
292+
urllib.request.urlretrieve(url, filename)
293293
except Exception as e:
294294
print(e)
295295
print("Download of module " + name + " failed.")
@@ -303,8 +303,8 @@ def _extract_member(self, member, targetpath, pwd):
303303
filepath = alt_filepath
304304

305305
# Unzip file
306-
zipf = MyZipFile(filepath)
307-
zipf.extractall(target_dir)
306+
with MyZipFile(filepath) as zipf:
307+
zipf.extractall(target_dir)
308308

309309
# Remove directory if exists
310310
if os.path.exists(alt_name):

preconfigure.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def build_ninja():
3838
# If we are on windows, we don't need to compile ninja, we just download the executable
3939
if os.name == "nt":
4040
ninja_exe_url = "https://github.com/ninja-build/ninja/releases/download/v1.13.0/ninja-win.zip"
41+
ninja_zip_path = os.path.join(sys.path[0], "ninja-win.zip")
4142

4243
# Try to execute ninja, if it fails, download .exe from github
4344
try:
@@ -48,18 +49,18 @@ def build_ninja():
4849
except OSError:
4950
print("Downloading ninja ... ")
5051
try:
51-
urllib.request.urlretrieve(ninja_exe_url, "ninja-win.zip")
52-
except:
52+
urllib.request.urlretrieve(ninja_exe_url, ninja_zip_path)
53+
except Exception as e:
5354
print(e)
5455
print("Download of ninja executable failed.")
5556
print("Get archive at " + ninja_exe_url)
5657
print("extract ninja.exe in the source code root folder.")
5758
print("Run meson.py again.")
5859
sys.exit(1)
5960

60-
zipf = zipfile.ZipFile(sys.path[0] + os.path.sep + "ninja-win.zip")
61-
zipf.extractall(sys.path[0])
62-
remove_file(sys.path[0] + os.path.sep + "ninja-win.zip")
61+
with zipfile.ZipFile(ninja_zip_path) as zipf:
62+
zipf.extractall(sys.path[0])
63+
remove_file(ninja_zip_path)
6364
else:
6465
ninjapath = sys.path[0] + os.path.sep + "externals" + os.path.sep + "ninja"
6566
try:
@@ -75,7 +76,10 @@ def build_ninja():
7576
subprocess.run(
7677
["python3", "configure.py", "--bootstrap"], cwd=ninjapath, env=env
7778
)
78-
shutil.copy(ninjapath + os.path.sep + "ninja", ".")
79+
shutil.copy(
80+
os.path.join(ninjapath, "ninja"),
81+
os.path.join(sys.path[0], "ninja"),
82+
)
7983

8084

8185
def run(

0 commit comments

Comments
 (0)