Skip to content

Commit 70a0638

Browse files
authored
Merge branch 'develop' into fix_multigrid_agglomeration
2 parents f2fb97e + dc6fd60 commit 70a0638

File tree

17 files changed

+392
-393
lines changed

17 files changed

+392
-393
lines changed

Common/include/toolboxes/geometry_toolbox.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ inline T Norm(Int nDim, const T* a) {
7979
return sqrt(SquaredNorm(nDim, a));
8080
}
8181

82+
/*! \brief dn = max(abs(n.(a-b)), 0.05 * ||a-b|| */
83+
template <class T, typename Int>
84+
inline T NormalDistance(Int nDim, const T* n, const T* a, const T* b) {
85+
T d[3] = {0};
86+
Distance(nDim, a, b, d);
87+
return fmax(fabs(DotProduct(nDim, n, d)), 0.05 * Norm(nDim, d));
88+
}
89+
8290
/*! \brief c = a x b */
8391
template <class T>
8492
inline void CrossProduct(const T* a, const T* b, T* c) {

Common/src/CConfig.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5610,16 +5610,16 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
56105610
/*--- Define some variables for flamelet model. ---*/
56115611
if (Kind_Species_Model == SPECIES_MODEL::FLAMELET) {
56125612
/*--- The controlling variables are progress variable, total enthalpy, and optionally mixture fraction ---*/
5613-
//n_control_vars = nSpecies - n_user_scalars;
56145613
if (n_control_vars != (nSpecies - n_user_scalars))
5615-
SU2_MPI::Error("Number of initial species incompatbile with number of controlling variables and user scalars.", CURRENT_FUNCTION);
5614+
SU2_MPI::Error("Number of initial species incompatible with number of controlling variables and user scalars.", CURRENT_FUNCTION);
56165615
/*--- We can have additional user defined transported scalars ---*/
56175616
n_scalars = n_control_vars + n_user_scalars;
56185617
}
56195618

56205619
if (Kind_Regime == ENUM_REGIME::COMPRESSIBLE && GetBounded_Scalar()) {
56215620
SU2_MPI::Error("BOUNDED_SCALAR discretization can only be used for incompressible problems.", CURRENT_FUNCTION);
56225621
}
5622+
56235623
}
56245624

56255625
void CConfig::SetMarkers(SU2_COMPONENT val_software) {

SU2_CFD/include/numerics/turbulent/turb_sources.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,18 +345,19 @@ struct Bsl {
345345

346346
/*--- Limiting of \hat{S} based on "Modifications and Clarifications for the Implementation of the Spalart-Allmaras Turbulence Model"
347347
* Note 1 option c in https://turbmodels.larc.nasa.gov/spalart.html ---*/
348+
const su2double d_Sbar = (var.fv2 + nue * var.d_fv2) * var.inv_k2_d2;
348349
if (Sbar >= - c2 * var.Omega) {
349350
var.Shat = var.Omega + Sbar;
351+
var.d_Shat = d_Sbar;
350352
} else {
351353
const su2double Num = var.Omega * (c2 * c2 * var.Omega + c3 * Sbar);
352354
const su2double Den = (c3 - 2 * c2) * var.Omega - Sbar;
353355
var.Shat = var.Omega + Num / Den;
356+
var.d_Shat = d_Sbar * (c3 * var.Omega + Num / Den) / Den;
354357
}
355358
if (var.Shat <= 1e-10) {
356359
var.Shat = 1e-10;
357360
var.d_Shat = 0.0;
358-
} else {
359-
var.d_Shat = (var.fv2 + nue * var.d_fv2) * var.inv_k2_d2;
360361
}
361362
}
362363
};

SU2_CFD/include/solvers/CFVMFlowSolverBase.inl

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2357,12 +2357,11 @@ void CFVMFlowSolverBase<V, FlowRegime>::Friction_Forces(const CGeometry* geometr
23572357
const su2double *Coord = nullptr, *Coord_Normal = nullptr, *Normal = nullptr;
23582358
const su2double minYPlus = config->GetwallModel_MinYPlus();
23592359

2360-
string Marker_Tag, Monitoring_Tag;
2361-
23622360
const su2double Alpha = config->GetAoA() * PI_NUMBER / 180.0;
23632361
const su2double Beta = config->GetAoS() * PI_NUMBER / 180.0;
23642362
const su2double RefLength = config->GetRefLength();
23652363
const su2double RefHeatFlux = config->GetHeat_Flux_Ref();
2364+
const su2double RefTemperature = config->GetTemperature_Ref();
23662365
const su2double Gas_Constant = config->GetGas_ConstantND();
23672366
auto Origin = config->GetRefOriginMoment(0);
23682367

@@ -2393,15 +2392,17 @@ void CFVMFlowSolverBase<V, FlowRegime>::Friction_Forces(const CGeometry* geometr
23932392

23942393
for (iMarker = 0; iMarker < nMarker; iMarker++) {
23952394

2396-
Marker_Tag = config->GetMarker_All_TagBound(iMarker);
23972395
if (!config->GetViscous_Wall(iMarker)) continue;
2396+
const auto Marker_Tag = config->GetMarker_All_TagBound(iMarker);
2397+
2398+
const bool py_custom = config->GetMarker_All_PyCustom(iMarker);
23982399

23992400
/*--- Obtain the origin for the moment computation for a particular marker ---*/
24002401

24012402
const auto Monitoring = config->GetMarker_All_Monitoring(iMarker);
24022403
if (Monitoring == YES) {
24032404
for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) {
2404-
Monitoring_Tag = config->GetMarker_Monitoring_TagBound(iMarker_Monitoring);
2405+
const auto Monitoring_Tag = config->GetMarker_Monitoring_TagBound(iMarker_Monitoring);
24052406
if (Marker_Tag == Monitoring_Tag) Origin = config->GetRefOriginMoment(iMarker_Monitoring);
24062407
}
24072408
}
@@ -2506,26 +2507,47 @@ void CFVMFlowSolverBase<V, FlowRegime>::Friction_Forces(const CGeometry* geometr
25062507

25072508
/*--- Compute total and maximum heat flux on the wall ---*/
25082509

2509-
su2double dTdn = -GeometryToolbox::DotProduct(nDim, Grad_Temp, UnitNormal);
2510-
2511-
if (!nemo){
2512-
2510+
if (!nemo) {
25132511
if (FlowRegime == ENUM_REGIME::COMPRESSIBLE) {
2514-
25152512
Cp = (Gamma / Gamma_Minus_One) * Gas_Constant;
25162513
thermal_conductivity = Cp * Viscosity / Prandtl_Lam;
25172514
}
25182515
if (FlowRegime == ENUM_REGIME::INCOMPRESSIBLE) {
2519-
if (!energy) dTdn = 0.0;
25202516
thermal_conductivity = nodes->GetThermalConductivity(iPoint);
25212517
}
2522-
HeatFlux[iMarker][iVertex] = -thermal_conductivity * dTdn * RefHeatFlux;
25232518

2519+
if (config->GetMarker_All_KindBC(iMarker) == BC_TYPE::HEAT_FLUX) {
2520+
if (py_custom) {
2521+
HeatFlux[iMarker][iVertex] = -geometry->GetCustomBoundaryHeatFlux(iMarker, iVertex);
2522+
} else {
2523+
HeatFlux[iMarker][iVertex] = -config->GetWall_HeatFlux(Marker_Tag);
2524+
if (config->GetIntegrated_HeatFlux()) {
2525+
HeatFlux[iMarker][iVertex] /= geometry->GetSurfaceArea(config, iMarker);
2526+
}
2527+
}
2528+
} else if (config->GetMarker_All_KindBC(iMarker) == BC_TYPE::ISOTHERMAL) {
2529+
su2double Twall = 0.0;
2530+
if (py_custom) {
2531+
Twall = geometry->GetCustomBoundaryTemperature(iMarker, iVertex) / RefTemperature;
2532+
} else {
2533+
Twall = config->GetIsothermal_Temperature(Marker_Tag) / RefTemperature;
2534+
}
2535+
iPointNormal = geometry->vertex[iMarker][iVertex]->GetNormal_Neighbor();
2536+
Coord_Normal = geometry->nodes->GetCoord(iPointNormal);
2537+
const su2double dist_ij = GeometryToolbox::NormalDistance(nDim, UnitNormal, Coord, Coord_Normal);
2538+
const su2double There = nodes->GetTemperature(iPointNormal);
2539+
HeatFlux[iMarker][iVertex] = thermal_conductivity * (There - Twall) / dist_ij * RefHeatFlux;
2540+
} else {
2541+
su2double dTdn = GeometryToolbox::DotProduct(nDim, Grad_Temp, UnitNormal);
2542+
if (FlowRegime == ENUM_REGIME::INCOMPRESSIBLE && !energy) dTdn = 0.0;
2543+
HeatFlux[iMarker][iVertex] = thermal_conductivity * dTdn * RefHeatFlux;
2544+
}
25242545
} else {
25252546

25262547
const auto& thermal_conductivity_tr = nodes->GetThermalConductivity(iPoint);
25272548
const auto& thermal_conductivity_ve = nodes->GetThermalConductivity_ve(iPoint);
25282549

2550+
const su2double dTdn = -GeometryToolbox::DotProduct(nDim, Grad_Temp, UnitNormal);
25292551
const su2double dTvedn = -GeometryToolbox::DotProduct(nDim, Grad_Temp_ve, UnitNormal);
25302552

25312553
/*--- Surface energy balance: trans-rot heat flux, vib-el heat flux ---*/
@@ -2653,8 +2675,7 @@ void CFVMFlowSolverBase<V, FlowRegime>::Friction_Forces(const CGeometry* geometr
26532675
/*--- Compute the coefficients per surface ---*/
26542676

26552677
for (iMarker_Monitoring = 0; iMarker_Monitoring < config->GetnMarker_Monitoring(); iMarker_Monitoring++) {
2656-
Monitoring_Tag = config->GetMarker_Monitoring_TagBound(iMarker_Monitoring);
2657-
Marker_Tag = config->GetMarker_All_TagBound(iMarker);
2678+
const auto Monitoring_Tag = config->GetMarker_Monitoring_TagBound(iMarker_Monitoring);
26582679
if (Marker_Tag == Monitoring_Tag) {
26592680
SurfaceViscCoeff.CL[iMarker_Monitoring] += ViscCoeff.CL[iMarker];
26602681
SurfaceViscCoeff.CD[iMarker_Monitoring] += ViscCoeff.CD[iMarker];

0 commit comments

Comments
 (0)