Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup wall functions and add user controls #1360

Merged
merged 125 commits into from
Oct 20, 2021
Merged
Show file tree
Hide file tree
Changes from 85 commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
e5e5d19
fixed wall functions for SA and SST
bigfooted Feb 21, 2021
6be5670
cleaning up wall model implementation
bigfooted Feb 22, 2021
a62a0b8
cleaning up wall model implementation
bigfooted Feb 22, 2021
ecc7d3f
cleaning up wall model implementation
bigfooted Feb 22, 2021
f643214
Merge branch 'develop' into fix_wallfunctions
bigfooted Feb 22, 2021
3705941
Update SU2_CFD/include/solvers/CFVMFlowSolverBase.inl
bigfooted Feb 24, 2021
25fd773
merge develop back in
bigfooted Feb 24, 2021
cc1798f
cleanup based on code review
bigfooted Mar 2, 2021
e17af6d
Merge branch 'fix_wallfunctions' of /~https://github.com/su2code/SU2 in…
bigfooted Mar 2, 2021
76a14b2
Merge branch 'develop' into fix_wallfunctions
pcarruscag Mar 2, 2021
dbde0f7
Update SU2_CFD/include/solvers/CFVMFlowSolverBase.inl
bigfooted Mar 3, 2021
8e4c4b8
Update SU2_CFD/include/solvers/CFVMFlowSolverBase.inl
bigfooted Mar 3, 2021
f7972ae
Update SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp
bigfooted Mar 3, 2021
b15e5f9
Update SU2_CFD/include/solvers/CFVMFlowSolverBase.inl
bigfooted Mar 3, 2021
f3551d8
Update SU2_CFD/include/solvers/CFVMFlowSolverBase.inl
bigfooted Mar 3, 2021
51da480
Update SU2_CFD/include/solvers/CFVMFlowSolverBase.inl
bigfooted Mar 3, 2021
f3f7139
Update SU2_CFD/include/solvers/CFVMFlowSolverBase.inl
bigfooted Mar 3, 2021
de8f6cd
Update SU2_CFD/src/solvers/CTurbSSTSolver.cpp
bigfooted Mar 3, 2021
ae7687e
Update SU2_CFD/include/solvers/CIncNSSolver.hpp
bigfooted Mar 3, 2021
7b61985
small update
bigfooted Mar 17, 2021
3e996bd
Merge branch 'fix_wallfunctions' of /~https://github.com/su2code/SU2 in…
bigfooted Mar 17, 2021
9437a11
Merge branch 'develop' into fix_wallfunctions
bigfooted Mar 17, 2021
658e7cb
Update SU2_CFD/include/solvers/CSolver.hpp
bigfooted Mar 17, 2021
ae47196
fix unused variables update
bigfooted Mar 17, 2021
06898d6
Merge branch 'fix_wallfunctions' of /~https://github.com/su2code/SU2 in…
bigfooted Mar 17, 2021
69e7fe1
fix unused variables update
bigfooted Mar 17, 2021
6d629c8
fix wall model constant config option
bigfooted Mar 18, 2021
0c0e3e6
fixed alignment and missing break statement
bigfooted Mar 20, 2021
fa88243
computing skinfriction when y+ < 5
bigfooted Mar 25, 2021
db32076
Merge remote-tracking branch 'upstream/develop' into develop
bigfooted Apr 1, 2021
4a4549b
merge with develop
bigfooted Apr 1, 2021
995f587
fix unused beta_1
bigfooted Apr 1, 2021
f713575
Merge remote-tracking branch 'upstream/develop' into develop
bigfooted May 18, 2021
e3b34a8
update with develop
bigfooted May 19, 2021
4b82974
fix OMP command
bigfooted May 19, 2021
423a89e
fix OMP command
bigfooted May 19, 2021
a6dc387
update to enum class
bigfooted May 19, 2021
b2fb98c
medi/ninja
bigfooted May 19, 2021
e32750f
remove vscode
bigfooted May 21, 2021
c33db7c
Update SU2_CFD/include/solvers/CTurbSSTSolver.hpp
pcarruscag May 29, 2021
722f3bb
Merge branch 'hybrid_parallel_ad3' into fix_wallfunctions
pcarruscag May 29, 2021
dabd9ee
Apply suggestions from code review
pcarruscag May 29, 2021
af96967
Merge branch 'fix_wallfunctions' of /~https://github.com/su2code/SU2 in…
pcarruscag May 29, 2021
a626425
small cleanup
pcarruscag May 29, 2021
ea38fd5
Merge remote-tracking branch 'upstream/develop' into fix_wallfunctions
pcarruscag May 29, 2021
a5a5835
a little more refactoring
pcarruscag May 29, 2021
fb3c0cc
apply fix from #1120 (do not consider tau wall for edges along wall),…
pcarruscag May 30, 2021
4172408
added config options
bigfooted May 30, 2021
44e5126
fixing wall temperature for wall function
Jun 9, 2021
557b950
Merge remote-tracking branch 'upstream/develop' into fix_wallfunctions
pcarruscag Jun 13, 2021
90723af
some fixes and better warnings
pcarruscag Jun 13, 2021
7ab705c
Merge branch 'develop' into fix_wallfunctions
pcarruscag Jun 15, 2021
9fd30a9
add testcase
bigfooted Jun 15, 2021
7d0d172
add testcase
bigfooted Jun 23, 2021
2b371f8
add config options for wall functions
bigfooted Jul 3, 2021
b874239
Merge branch 'su2code:fix_wallfunctions' into fix_wallfunctions
bigfooted Jul 3, 2021
3306eb9
fix y+ bug
bigfooted Jul 16, 2021
8c0a1f2
added testcase
bigfooted Aug 24, 2021
aa009e0
Merge branch 'develop' into fix_wallfunctions
bigfooted Aug 24, 2021
3a68a3e
remove deleted files CDiscAdFEAVariable
bigfooted Aug 24, 2021
075ef48
update wall temperature for aerodynamic heating
bigfooted Aug 24, 2021
caf9ab7
remove unused variables
bigfooted Aug 24, 2021
8066a23
Update Common/src/CConfig.cpp
bigfooted Aug 24, 2021
3ff82e5
Update SU2_CFD/include/solvers/CFVMFlowSolverBase.inl
bigfooted Aug 24, 2021
ec5ecec
Update Common/include/CConfig.hpp
bigfooted Aug 24, 2021
67b1a53
Update TestCases/wallfunctions/flatplate/turb_SA_flatplate.cfg
bigfooted Aug 24, 2021
1591c7c
Update SU2_CFD/src/solvers/CIncNSSolver.cpp
bigfooted Aug 24, 2021
de13ceb
Update SU2_CFD/src/solvers/CIncNSSolver.cpp
bigfooted Aug 24, 2021
f7d3a6b
Update SU2_CFD/src/solvers/CIncNSSolver.cpp
bigfooted Aug 24, 2021
2d76265
reviewer changes
bigfooted Aug 24, 2021
9a67668
Merge branch 'fix_wallfunctions' of /~https://github.com/bigfooted/SU2 …
bigfooted Aug 24, 2021
d7197e0
update testcase
bigfooted Aug 24, 2021
9f39f7d
Update SU2_CFD/include/solvers/CFVMFlowSolverBase.inl
bigfooted Aug 25, 2021
ea14c02
Update SU2_CFD/include/solvers/CFVMFlowSolverBase.inl
bigfooted Aug 25, 2021
4226dbf
Update SU2_CFD/src/solvers/CIncNSSolver.cpp
bigfooted Aug 25, 2021
b00e0ec
Update SU2_CFD/src/solvers/CIncNSSolver.cpp
bigfooted Aug 25, 2021
5af6111
Update SU2_CFD/src/solvers/CNSSolver.cpp
bigfooted Aug 25, 2021
b268a9d
Update SU2_CFD/src/solvers/CNSSolver.cpp
bigfooted Aug 25, 2021
73f456c
Update SU2_CFD/src/solvers/CNSSolver.cpp
bigfooted Aug 25, 2021
b2db011
Update SU2_CFD/src/solvers/CNSSolver.cpp
bigfooted Aug 25, 2021
0940d87
Update SU2_CFD/src/solvers/CNSSolver.cpp
bigfooted Aug 25, 2021
238c9e5
Update SU2_CFD/src/solvers/CNSSolver.cpp
bigfooted Aug 25, 2021
474cee3
Update SU2_CFD/src/solvers/CTurbSASolver.cpp
bigfooted Aug 25, 2021
310585b
Update SU2_CFD/src/solvers/CTurbSSTSolver.cpp
bigfooted Aug 25, 2021
34a6eff
Update SU2_CFD/src/solvers/CTurbSSTSolver.cpp
bigfooted Aug 25, 2021
322f010
Update SU2_CFD/src/solvers/CNSSolver.cpp
bigfooted Sep 6, 2021
10a69be
change some comments
bigfooted Sep 6, 2021
7c9b447
Update TestCases/wallfunctions/flatplate/turb_SA_flatplate.cfg
bigfooted Sep 6, 2021
3f4c2d0
Update TestCases/wallfunctions/flatplate/turb_SA_flatplate.cfg
bigfooted Sep 6, 2021
827fbbc
Update SU2_CFD/src/solvers/CIncNSSolver.cpp
bigfooted Sep 6, 2021
ec87ed9
add additional testcases
bigfooted Sep 6, 2021
ffba868
Merge branch 'develop' into fix_wallfunctions
bigfooted Sep 6, 2021
dfd2939
added incomp. and comp. testcases
bigfooted Sep 20, 2021
545f139
cleanup of testcases config files
bigfooted Sep 20, 2021
00548d9
Update SU2_CFD/src/solvers/CIncNSSolver.cpp
bigfooted Sep 21, 2021
7f5a342
removed logfile
bigfooted Sep 21, 2021
0ca421f
Update SU2_CFD/src/solvers/CNSSolver.cpp
bigfooted Sep 21, 2021
1dd5c96
added nondimensionalization
bigfooted Sep 29, 2021
bbca88c
Merge branch 'fix_wallfunctions' of /~https://github.com/bigfooted/SU2 …
bigfooted Sep 29, 2021
11cb94e
Merge remote-tracking branch 'origin/develop' into fix_wallfunctions
TobiKattmann Sep 30, 2021
fc03901
Changes to Testcases cfg's. Fix convergence for inc cases.
TobiKattmann Sep 30, 2021
437d1fc
Add '_' in some var names to be consistent with cfg.
TobiKattmann Sep 30, 2021
651d669
Remove unused Wall_Functions Marker from Testcases repo.
TobiKattmann Sep 30, 2021
e48ba40
Remove empty added line.
TobiKattmann Sep 30, 2021
578822e
Rename TauWall functions to Tau_Wall to be consistent with var-name.
TobiKattmann Oct 1, 2021
3daef85
Update reg test vals. Adding more screen output fields.
TobiKattmann Oct 1, 2021
e2cdf26
Merge branch 'fix_wallfunctions' of /~https://github.com/bigfooted/SU2 …
TobiKattmann Oct 1, 2021
5a166b6
Merge remote-tracking branch 'origin/develop' into fix_wallfunctions
TobiKattmann Oct 7, 2021
dde0a9f
Remove unnecessary nondim. All values come from the solver itself.
TobiKattmann Oct 7, 2021
194692c
Const-ing vars in SetTau_Wall_WF func for NS and IncNS.
TobiKattmann Oct 7, 2021
9fe38b7
Rename Conductivity_Ref -> Thermal_Conductivity_Ref.
TobiKattmann Oct 7, 2021
0af828b
else not needed due to continue
pcarruscag Oct 7, 2021
d3b2fed
Minor changes. Comments and moved variable.
TobiKattmann Oct 7, 2021
b0bcd88
Merge branch 'fix_wallfunctions' of /~https://github.com/bigfooted/SU2 …
TobiKattmann Oct 7, 2021
7a7194c
Merge branch 'develop' into fix_wallfunctions
pcarruscag Oct 8, 2021
7d0a480
Merge remote-tracking branch 'origin/develop' into fix_wallfunctions
TobiKattmann Oct 13, 2021
17e52ea
Merge remote-tracking branch 'origin/develop' into fix_wallfunctions
TobiKattmann Oct 13, 2021
dd8d981
do not recompute y+ when wall functions are used
bigfooted Oct 16, 2021
b9e83e7
Update cfg files. Cleaning + formatting.
TobiKattmann Oct 16, 2021
e35cfeb
Merge branch 'develop' into fix_wallfunctions
TobiKattmann Oct 19, 2021
af850b9
Update TestCases/serial_regression.py
pcarruscag Oct 19, 2021
0111ebb
Merge remote-tracking branch 'origin/develop' into fix_wallfunctions
TobiKattmann Oct 19, 2021
9a3804a
Merge branch 'fix_wallfunctions' of /~https://github.com/bigfooted/SU2 …
TobiKattmann Oct 19, 2021
f9a5129
Merge remote-tracking branch 'origin/develop' into fix_wallfunctions
TobiKattmann Oct 19, 2021
d492fb4
Do some checks for the wall function impl in CConfig.
TobiKattmann Oct 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,7 @@ class CConfig {
Wrt_Projected_Sensitivity, /*!< \brief Write projected sensitivities (dJ/dx) on surfaces to ASCII file. */
Plot_Section_Forces; /*!< \brief Write sectional forces for specified markers. */
unsigned short
wallModelMaxIter, /*!< \brief maximum number of iterations for the Newton method for the wall model */
Console_Output_Verb, /*!< \brief Level of verbosity for console output */
Kind_Average; /*!< \brief Particular average for the marker analyze. */
su2double Gamma, /*!< \brief Ratio of specific heats of the gas. */
Expand Down Expand Up @@ -825,6 +826,8 @@ class CConfig {
Prandtl_Turb, /*!< \brief Turbulent Prandtl number for the gas. */
wallModelKappa, /*!< \brief von Karman constant kappa for turbulence wall modeling */
wallModelB, /*!< \brief constant B for turbulence wall modeling */
wallModelRelFac, /*!< \brief relaxation factor for the Newton method used in the wall model */
wallModelMinYplus, /*!< \brief minimum Y+ value, below which the wall model is not used anymore */
Length_Ref, /*!< \brief Reference length for non-dimensionalization. */
Pressure_Ref, /*!< \brief Reference pressure for non-dimensionalization. */
Temperature_Ref, /*!< \brief Reference temperature for non-dimensionalization.*/
Expand Down Expand Up @@ -1673,6 +1676,24 @@ class CConfig {
*/
su2double GetwallModelKappa(void) const { return wallModelKappa; }

/*!
* \brief Get the value of the max. number of Newton iterations for turbulence wall modeling.
* \return max number of iterations.
*/
unsigned short GetwallModelMaxIter() const { return wallModelMaxIter; }

/*!
* \brief Get the value of the relaxation factor for turbulence wall modeling.
* \return relaxation factor.
*/
su2double GetwallModelRelFac() const { return wallModelRelFac; }

/*!
* \brief Get the value of the minimum Y+ value below which the wall function is deactivated
* \return minimum Y+ value.
*/
su2double GetwallModelMinYPlus() const { return wallModelMinYplus; }

/*!
* \brief Get the value of the von Karman constant kappa for turbulence wall modeling.
* \return von Karman constant.
Expand Down
14 changes: 10 additions & 4 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1223,10 +1223,16 @@ void CConfig::SetConfig_Options() {
addDoubleOption("PRANDTL_LAM", Prandtl_Lam, 0.72);
/*!\brief PRANDTL_TURB \n DESCRIPTION: Turbulent Prandtl number (0.9 (air), only for compressible flows) \n DEFAULT 0.90 \ingroup Config*/
addDoubleOption("PRANDTL_TURB", Prandtl_Turb, 0.90);
/*!\brief WALLMODELKAPPA \n DESCRIPTION: von Karman constant used for the wall model \n DEFAULT 0.41 \ingroup Config*/
addDoubleOption("WALLMODELKAPPA", wallModelKappa, 0.41);
/*!\brief WALLMODELB \n DESCRIPTION: constant B used for the wall model \n DEFAULT 5.0 \ingroup Config*/
addDoubleOption("WALLMODELB", wallModelB, 5.5);
/*!\brief WALLMODEL_KAPPA \n DESCRIPTION: von Karman constant used for the wall model \n DEFAULT 0.41 \ingroup Config*/
addDoubleOption("WALLMODEL_KAPPA", wallModelKappa, 0.41);
/*!\brief WALLMODEL_MAXITER \n DESCRIPTION: Max iterations used for the wall model \n DEFAULT 200 \ingroup Config*/
addUnsignedShortOption("WALLMODEL_MAXITER", wallModelMaxIter, 200);
/*!\brief WALLMODEL_RELFAC \n DESCRIPTION: Relaxation factor used for the wall model \n DEFAULT 0.5 \ingroup Config*/
addDoubleOption("WALLMODEL_RELFAC", wallModelRelFac, 0.5);
/*!\brief WALLMODEL_MINYPLUS \n DESCRIPTION: lower limit for Y+ used for the wall model \n DEFAULT 5.0 \ingroup Config*/
addDoubleOption("WALLMODEL_MINYPLUS", wallModelMinYplus, 5.0);
/*!\brief WALLMODEL_B \n DESCRIPTION: constant B used for the wall model \n DEFAULT 5.0 \ingroup Config*/
addDoubleOption("WALLMODEL_B", wallModelB, 5.5);
/*!\brief BULK_MODULUS \n DESCRIPTION: Value of the Bulk Modulus \n DEFAULT 1.42E5 \ingroup Config*/
addDoubleOption("BULK_MODULUS", Bulk_Modulus, 1.42E5);
/* DESCRIPTION: Epsilon^2 multipier in Beta calculation for incompressible preconditioner. */
Expand Down
2 changes: 1 addition & 1 deletion SU2_CFD/include/numerics_simd/flow/diffusion/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ FORCEINLINE void addQCR(const MatrixType& grad, MatrixDbl<nDim>& tau) {

/*!
* \brief Scale the stress tensor according to the target (from a
* wall function) magnitute in the tangential direction.
TobiKattmann marked this conversation as resolved.
Show resolved Hide resolved
* wall function) magnitude in the tangential direction.
*/
template<class Container, size_t nDim>
FORCEINLINE void addTauWall(Int iPoint, Int jPoint,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ class CCompressibleViscousFluxBase : public CNumericsSIMD {
addPerturbedRSM(avgV, avgGrad, turb_ke, tau,
uq_eigval_comp, uq_permute, uq_delta_b, uq_urlx);
}

TobiKattmann marked this conversation as resolved.
Show resolved Hide resolved
if(wallFun) addTauWall(iPoint, jPoint, solution.GetTauWall(), unitNormal, tau);

Double cond = derived->thermalConductivity(avgV);
Expand Down
45 changes: 22 additions & 23 deletions SU2_CFD/include/solvers/CFVMFlowSolverBase.inl
Original file line number Diff line number Diff line change
Expand Up @@ -2393,11 +2393,12 @@ void CFVMFlowSolverBase<V, FlowRegime>::Friction_Forces(const CGeometry* geometr
unsigned long iVertex, iPoint, iPointNormal;
unsigned short iMarker, iMarker_Monitoring, iDim, jDim;
unsigned short T_INDEX = 0, TVE_INDEX = 0, VEL_INDEX = 0;
su2double Viscosity = 0.0, WallDist[3] = {0.0}, Area, TauNormal, dTn, dTven,
su2double Viscosity = 0.0, Area, dTn, dTven,
GradTemperature, Density = 0.0, WallDistMod, FrictionVel,
UnitNormal[3] = {0.0}, TauElem[3] = {0.0}, TauTangent[3] = {0.0}, Tau[3][3] = {{0.0}}, Cp,
UnitNormal[3] = {0.0}, TauElem[3] = {0.0}, Tau[3][3] = {{0.0}}, Cp,
thermal_conductivity, MaxNorm = 8.0, Grad_Vel[3][3] = {{0.0}}, Grad_Temp[3] = {0.0}, AxiFactor;
const su2double *Coord = nullptr, *Coord_Normal = nullptr, *Normal = nullptr;
const su2double minYPlus = config->GetwallModelMinYPlus();

string Marker_Tag, Monitoring_Tag;

Expand Down Expand Up @@ -2527,35 +2528,33 @@ void CFVMFlowSolverBase<V, FlowRegime>::Friction_Forces(const CGeometry* geometr
/*--- Compute wall shear stress (using the stress tensor). Compute wall skin friction coefficient, and heat flux
* on the wall ---*/

TauNormal = 0.0;
for (iDim = 0; iDim < nDim; iDim++) TauNormal += TauElem[iDim] * UnitNormal[iDim];
su2double TauTangent[MAXNDIM] = {0.0};
GeometryToolbox::TangentProjection(nDim, Tau, UnitNormal, TauTangent);

WallShearStress[iMarker][iVertex] = GeometryToolbox::Norm(int(MAXNDIM), TauTangent);

/*--- For wall functions, the wall stresses need to be scaled by the wallfunction stress Tau_Wall---*/
if (wallfunctions && (YPlus[iMarker][iVertex] > minYPlus)){
const su2double Tau_Wall = nodes->GetTauWall(iPoint);
const su2double scale = Tau_Wall / WallShearStress[iMarker][iVertex];
for (iDim = 0; iDim < nDim; iDim++) {
TauTangent[iDim] *= scale;
TauElem[iDim] *= scale;
}
WallShearStress[iMarker][iVertex] = Tau_Wall;
}

WallShearStress[iMarker][iVertex] = 0.0;
for (iDim = 0; iDim < nDim; iDim++) {
TauTangent[iDim] = TauElem[iDim] - TauNormal * UnitNormal[iDim];
/* --- in case of wall functions, we have computed the skin friction in the turbulence solver --- */
/* --- Note that in the wall model, we switch off the computation when the computed y+ < 5 --- */
/* --- We put YPlus to 1.0 so we have to compute skinfriction and the actual y+ in that case as well --- */
if (!wallfunctions || (wallfunctions && YPlus[iMarker][iVertex] < 5.0))
CSkinFriction[iMarker](iVertex,iDim) = TauTangent[iDim] * factorFric;

WallShearStress[iMarker][iVertex] += TauTangent[iDim] * TauTangent[iDim];
CSkinFriction[iMarker](iVertex,iDim) = TauTangent[iDim] * factorFric;
}
WallShearStress[iMarker][iVertex] = sqrt(WallShearStress[iMarker][iVertex]);

for (iDim = 0; iDim < nDim; iDim++) WallDist[iDim] = (Coord[iDim] - Coord_Normal[iDim]);
WallDistMod = 0.0;
for (iDim = 0; iDim < nDim; iDim++) WallDistMod += WallDist[iDim] * WallDist[iDim];
WallDistMod = sqrt(WallDistMod);
WallDistMod = GeometryToolbox::Distance(nDim, Coord, Coord_Normal);

/*--- Compute y+ and non-dimensional velocity ---*/
/*--- Compute non-dimensional velocity and y+ ---*/

FrictionVel = sqrt(fabs(WallShearStress[iMarker][iVertex]) / Density);

/* --- in case of wall functions, we have computed YPlus in the turbulence class --- */
/* --- Note that we do not recompute y+ when y+<5 because y+ can become > 5 again --- */
if (!wallfunctions)
YPlus[iMarker][iVertex] = WallDistMod * FrictionVel / (Viscosity / Density);
YPlus[iMarker][iVertex] = WallDistMod * FrictionVel / (Viscosity / Density);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this give the same value computed in TauWall_WF when wall functions are active? The formula is not the same.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bigfooted can you just address this question, leaving a comment in the code possibly.
Other than this I think you and @TobiKattmann addressed all the major things 👍


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

Expand Down
131 changes: 57 additions & 74 deletions SU2_CFD/src/solvers/CIncNSSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -653,13 +653,13 @@ void CIncNSSolver::SetTauWall_WF(CGeometry *geometry, CSolver **solver_container

const su2double Gas_Constant = config->GetGas_ConstantND();
const su2double Cp = (Gamma / Gamma_Minus_One) * Gas_Constant;
constexpr unsigned short max_iter =200; /*--- maximum number of iterations for the Newton Solver---*/
const su2double tol = 1e-12; /*--- convergence criterium for the Newton solver, note that 1e-10 is too large ---*/
const su2double relax = 0.5; /*--- relaxation factor for the Newton solver ---*/
const su2double tol = 1e-12; /*!< \brief convergence criterium for the Newton solver, note that 1e-10 is too large */
const unsigned short max_iter =config->GetwallModelMaxIter();
const su2double relax = config->GetwallModelRelFac();

/*--- Compute the recovery factor ---*/
/*--- Compute the recovery factor
* use Molecular (Laminar) Prandtl number (see Nichols & Nelson, nomenclature ) ---*/
TobiKattmann marked this conversation as resolved.
Show resolved Hide resolved

// Molecular (Laminar) Prandtl number (see Nichols & Nelson, nomenclature )
const su2double Recovery = pow(config->GetPrandtl_Lam(), (1.0/3.0));

/*--- Typical constants from boundary layer theory ---*/
Expand All @@ -679,15 +679,6 @@ void CIncNSSolver::SetTauWall_WF(CGeometry *geometry, CSolver **solver_container

if (config->GetWallFunction_Treatment(Marker_Tag) != WALL_FUNCTIONS::STANDARD_FUNCTION) continue;

/*--- Get the specified wall heat flux from config ---*/
// note that we can get the heat flux from the temperature gradient
su2double q_w = 0.0;

if (config->GetMarker_All_KindBC(iMarker) == HEAT_FLUX)
q_w = config->GetWall_HeatFlux(Marker_Tag);

// heat flux from temperature: q_w = h*(T_wall - T_fluid)

/*--- Loop over all of the vertices on this boundary marker ---*/

SU2_OMP_FOR_DYN(OMP_MIN_SIZE)
Expand Down Expand Up @@ -744,13 +735,22 @@ void CIncNSSolver::SetTauWall_WF(CGeometry *geometry, CSolver **solver_container
* In incompressible flows, we can assume that there is no velocity-related
* temperature change Prandtl: T+ = Pr*y+ ---*/
su2double T_Wall = nodes->GetTemperature(iPoint);
su2double Conductivity_Wall = nodes->GetThermalConductivity(iPoint);

/*--- if a wall temperature was given, we compute the local heat flux using k*dT/dn ---*/

/*--- Extrapolate the pressure from the interior & compute the
wall density using the equation of state ---*/
su2double q_w = 0.0;

if (config->GetMarker_All_KindBC(iMarker) == ISOTHERMAL) {
const su2double T_n = nodes->GetTemperature(Point_Normal);
q_w = Conductivity_Wall * (T_Wall - T_n) / WallDistMod;
}
else if (config->GetMarker_All_KindBC(iMarker) == HEAT_FLUX) {
q_w = config->GetWall_HeatFlux(Marker_Tag);
pcarruscag marked this conversation as resolved.
Show resolved Hide resolved
pcarruscag marked this conversation as resolved.
Show resolved Hide resolved
}
bigfooted marked this conversation as resolved.
Show resolved Hide resolved

/*--- incompressible formulation ---*/
su2double Density_Wall = nodes->GetDensity(iPoint);
su2double Conductivity_Wall = nodes->GetThermalConductivity(iPoint);
su2double Lam_Visc_Normal = nodes->GetLaminarViscosity(Point_Normal);

/*--- Compute the shear stress at the wall in the regular fashion
Expand All @@ -759,8 +759,7 @@ void CIncNSSolver::SetTauWall_WF(CGeometry *geometry, CSolver **solver_container
su2double tau[MAXNDIM][MAXNDIM] = {{0.0}};
su2double Lam_Visc_Wall = nodes->GetLaminarViscosity(iPoint);
su2double Eddy_Visc_Wall = nodes->GetEddyViscosity(iPoint);
// do we need the total viscosity for the stress tensor?
//su2double total_viscosity = (Lam_Visc_Wall + Eddy_Visc_Wall);

CNumerics::ComputeStressTensor(nDim, tau, nodes->GetGradient_Primitive(iPoint)+1, Lam_Visc_Wall);

su2double TauTangent[MAXNDIM] = {0.0};
Expand All @@ -775,72 +774,68 @@ void CIncNSSolver::SetTauWall_WF(CGeometry *geometry, CSolver **solver_container
unsigned long counter = 0;
su2double diff = 1.0;
su2double U_Tau = max(1.0e-6,sqrt(WallShearStress/Density_Wall));
su2double Y_Plus = 5.0; // clipping value
su2double Y_Plus = 0.99*config->GetwallModelMinYPlus(); // clipping value
TobiKattmann marked this conversation as resolved.
Show resolved Hide resolved

su2double Y_Plus_Start = Density_Wall * U_Tau * WallDistMod / Lam_Visc_Wall;

/*--- Automatic switch off when y+ < 5 according to Nichols & Nelson (2004) ---*/
/*--- Automatic switch off when y+ < "limit" according to Nichols & Nelson (2004) ---*/

if (Y_Plus_Start < Y_Plus) {
/*--- impose a minimum y+ for stability reasons---*/
if (Y_Plus_Start < config->GetwallModelMinYPlus()) {
smallYPlusCounter++;
}
else {
while (fabs(diff) > tol) {
else while (fabs(diff) > tol) {
bigfooted marked this conversation as resolved.
Show resolved Hide resolved

/*--- Friction velocity and u+ ---*/
/*--- Friction velocity and u+ ---*/

su2double U_Plus = VelTangMod/U_Tau;
su2double U_Plus = VelTangMod/U_Tau;

/*--- Gamma, Beta, Q, and Phi, defined by Nichols & Nelson (2004) page 1110 ---*/
/*--- Gamma, Beta, Q, and Phi, defined by Nichols & Nelson (2004) page 1110 ---*/

su2double Gam = Recovery*U_Tau*U_Tau/(2.0*Cp*T_Wall);
/*--- nijso: heated wall needs validation testcase! ---*/
su2double Beta = q_w*Lam_Visc_Wall/(Density_Wall*T_Wall*Conductivity_Wall*U_Tau); // TODO: nonzero heatflux needs validation case
su2double Q = sqrt(Beta*Beta + 4.0*Gam);
su2double Phi = asin(-1.0*Beta/Q);
su2double Gam = Recovery*U_Tau*U_Tau/(2.0*Cp*T_Wall);
su2double Beta = q_w*Lam_Visc_Wall/(Density_Wall*T_Wall*Conductivity_Wall*U_Tau);
su2double Q = sqrt(Beta*Beta + 4.0*Gam);
su2double Phi = asin(-1.0*Beta/Q);

/*--- Y+ defined by White & Christoph (compressibility and heat transfer) negative value for (2.0*Gam*U_Plus - Beta)/Q ---*/
/*--- Y+ defined by White & Christoph (compressibility and heat transfer) negative value for (2.0*Gam*U_Plus - Beta)/Q ---*/

su2double Y_Plus_White = exp((kappa/sqrt(Gam))*(asin((2.0*Gam*U_Plus - Beta)/Q) - Phi))*exp(-1.0*kappa*B);
su2double Y_Plus_White = exp((kappa/sqrt(Gam))*(asin((2.0*Gam*U_Plus - Beta)/Q) - Phi))*exp(-1.0*kappa*B);

/*--- Spalding's universal form for the BL velocity with the
outer velocity form of White & Christoph above. ---*/
/*--- Spalding's universal form for the BL velocity with the
outer velocity form of White & Christoph above. ---*/

su2double kUp = kappa*U_Plus;
Y_Plus = U_Plus + Y_Plus_White - (exp(-1.0*kappa*B)* (1.0 + kUp + 0.5*kUp*kUp + kUp*kUp*kUp/6.0));
const su2double kUp = kappa*U_Plus;
Y_Plus = U_Plus + Y_Plus_White - (exp(-1.0*kappa*B)* (1.0 + kUp + 0.5*kUp*kUp + kUp*kUp*kUp/6.0));

su2double dypw_dyp = 2.0*Y_Plus_White*(kappa*sqrt(Gam)/Q)*sqrt(1.0 - pow(2.0*Gam*U_Plus - Beta,2.0)/(Q*Q));
su2double dypw_dyp = 2.0*Y_Plus_White*(kappa*sqrt(Gam)/Q)*sqrt(1.0 - pow(2.0*Gam*U_Plus - Beta,2.0)/(Q*Q));

Eddy_Visc_Wall = Lam_Visc_Wall*(1.0 + dypw_dyp - kappa*exp(-1.0*kappa*B)*
(1.0 + kappa*U_Plus + kappa*kappa*U_Plus*U_Plus/2.0)
- Lam_Visc_Normal/Lam_Visc_Wall);
Eddy_Visc_Wall = max(1.0e-6, Eddy_Visc_Wall);
Eddy_Visc_Wall = Lam_Visc_Wall*(1.0 + dypw_dyp - kappa*exp(-1.0*kappa*B)*
(1.0 + kappa*U_Plus + kappa*kappa*U_Plus*U_Plus/2.0)
- Lam_Visc_Normal/Lam_Visc_Wall);
Eddy_Visc_Wall = max(1.0e-6, Eddy_Visc_Wall);

/* --- Define function for Newton method to zero --- */
/* --- Define function for Newton method to zero --- */

diff = (Density_Wall * U_Tau * WallDistMod / Lam_Visc_Wall) - Y_Plus;
diff = (Density_Wall * U_Tau * WallDistMod / Lam_Visc_Wall) - Y_Plus;

/* --- Gradient of function defined above --- */
/* --- Gradient of function defined above --- */

su2double grad_diff = Density_Wall * WallDistMod / Lam_Visc_Wall + VelTangMod / (U_Tau * U_Tau) +
kappa /(U_Tau * sqrt(Gam)) * asin(U_Plus * sqrt(Gam)) * Y_Plus_White -
exp(-1.0 * B * kappa) * (0.5 * pow(VelTangMod * kappa / U_Tau, 3) +
pow(VelTangMod * kappa / U_Tau, 2) + VelTangMod * kappa / U_Tau) / U_Tau;
su2double grad_diff = Density_Wall * WallDistMod / Lam_Visc_Wall + VelTangMod / (U_Tau * U_Tau) +
kappa /(U_Tau * sqrt(Gam)) * asin(U_Plus * sqrt(Gam)) * Y_Plus_White -
exp(-1.0 * B * kappa) * (0.5 * pow(VelTangMod * kappa / U_Tau, 3) +
pow(VelTangMod * kappa / U_Tau, 2) + VelTangMod * kappa / U_Tau) / U_Tau;

/* --- Newton Step --- */
/* --- Newton Step --- */

U_Tau = U_Tau - relax*(diff / grad_diff);
U_Tau = U_Tau - relax*(diff / grad_diff);

counter++;
if (counter > max_iter) {
notConvergedCounter++;
// use some safe values for convergence
Y_Plus = 30.0;
Eddy_Visc_Wall = 1.0;
U_Tau = 1.0;
break;
}
counter++;
if (counter > max_iter) {
notConvergedCounter++;
// use some safe values for convergence
Y_Plus = 30.0;
Eddy_Visc_Wall = 1.0;
U_Tau = 1.0;
break;
TobiKattmann marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand All @@ -852,21 +847,9 @@ void CIncNSSolver::SetTauWall_WF(CGeometry *geometry, CSolver **solver_container
EddyViscWall[iMarker][iVertex] = Eddy_Visc_Wall;
UTau[iMarker][iVertex] = U_Tau;

// wall model value
su2double Tau_Wall = (1.0/Density_Wall)*pow(Y_Plus*Lam_Visc_Wall/WallDistMod,2.0);

// nijso: skinfriction for wall functions gives opposite sign?

for (auto iDim = 0u; iDim < nDim; iDim++)
CSkinFriction[iMarker](iVertex,iDim) = (Tau_Wall/WallShearStress)*TauTangent[iDim] / DynamicPressureRef;

nodes->SetTauWall(iPoint, Tau_Wall);
// for compressible flow:
//nodes->SetTemperature(iPoint,T_Wall);
//nodes->SetSolution(iPoint, 0, Density_Wall);
//nodes->SetPrimitive(iPoint, nDim + 1, P_Wall);
// for incompressible flow:
// ...?

}
END_SU2_OMP_FOR
Expand Down
Loading