@@ -1632,7 +1632,8 @@ void CFVMFlowSolverBase<V, FlowRegime>::Pressure_Forces(const CGeometry* geometr
16321632 }
16331633 }
16341634
1635- factor = 1.0 / (0.5 * RefDensity * RefArea * RefVel2);
1635+ AeroCoeffForceRef = 0.5 * RefDensity * RefArea * RefVel2;
1636+ factor = 1.0 / AeroCoeffForceRef;
16361637
16371638 /* --- Reference pressure is always the far-field value. ---*/
16381639
@@ -1938,57 +1939,18 @@ template <class V, ENUM_REGIME FlowRegime>
19381939void CFVMFlowSolverBase<V, FlowRegime>::Momentum_Forces(const CGeometry* geometry, const CConfig* config) {
19391940 unsigned long iVertex, iPoint;
19401941 unsigned short iDim, iMarker, Boundary, Monitoring, iMarker_Monitoring;
1941- su2double factor, RefVel2 = 0.0 , RefTemp, RefDensity = 0.0 , Mach2Vel, Mach_Motion, MassFlow, Density;
1942+ su2double MassFlow, Density;
19421943 const su2double *Normal = nullptr , *Coord = nullptr ;
19431944 string Marker_Tag, Monitoring_Tag;
19441945 su2double AxiFactor;
19451946
19461947 su2double Alpha = config->GetAoA () * PI_NUMBER / 180.0 ;
19471948 su2double Beta = config->GetAoS () * PI_NUMBER / 180.0 ;
1948- su2double RefArea = config->GetRefArea ();
19491949 su2double RefLength = config->GetRefLength ();
1950- su2double Gas_Constant = config->GetGas_ConstantND ();
19511950 auto Origin = config->GetRefOriginMoment (0 );
19521951 bool axisymmetric = config->GetAxisymmetric ();
19531952
1954- // / TODO: Move these ifs to specialized functions.
1955-
1956- if (FlowRegime == COMPRESSIBLE) {
1957- /* --- Evaluate reference values for non-dimensionalization.
1958- For dynamic meshes, use the motion Mach number as a reference value
1959- for computing the force coefficients. Otherwise, use the freestream values,
1960- which is the standard convention. ---*/
1961-
1962- RefTemp = Temperature_Inf;
1963- RefDensity = Density_Inf;
1964- if (dynamic_grid) {
1965- Mach2Vel = sqrt (Gamma * Gas_Constant * RefTemp);
1966- Mach_Motion = config->GetMach_Motion ();
1967- RefVel2 = (Mach_Motion * Mach2Vel) * (Mach_Motion * Mach2Vel);
1968- } else {
1969- RefVel2 = 0.0 ;
1970- for (iDim = 0 ; iDim < nDim; iDim++) RefVel2 += Velocity_Inf[iDim] * Velocity_Inf[iDim];
1971- }
1972- }
1973-
1974- if (FlowRegime == INCOMPRESSIBLE) {
1975- /* --- Evaluate reference values for non-dimensionalization.
1976- For dimensional or non-dim based on initial values, use
1977- the far-field state (inf). For a custom non-dim based
1978- on user-provided reference values, use the ref values
1979- to compute the forces. ---*/
1980-
1981- if ((config->GetRef_Inc_NonDim () == DIMENSIONAL) || (config->GetRef_Inc_NonDim () == INITIAL_VALUES)) {
1982- RefDensity = Density_Inf;
1983- RefVel2 = 0.0 ;
1984- for (iDim = 0 ; iDim < nDim; iDim++) RefVel2 += Velocity_Inf[iDim] * Velocity_Inf[iDim];
1985- } else if (config->GetRef_Inc_NonDim () == REFERENCE_VALUES) {
1986- RefDensity = config->GetInc_Density_Ref ();
1987- RefVel2 = config->GetInc_Velocity_Ref () * config->GetInc_Velocity_Ref ();
1988- }
1989- }
1990-
1991- factor = 1.0 / (0.5 * RefDensity * RefArea * RefVel2);
1953+ const su2double factor = 1.0 / AeroCoeffForceRef;
19921954
19931955 /* -- Variables initialization ---*/
19941956
@@ -2263,8 +2225,8 @@ void CFVMFlowSolverBase<V, FlowRegime>::Friction_Forces(const CGeometry* geometr
22632225 unsigned long iVertex, iPoint, iPointNormal;
22642226 unsigned short iMarker, iMarker_Monitoring, iDim, jDim;
22652227 unsigned short T_INDEX = 0 , TVE_INDEX = 0 , VEL_INDEX = 0 ;
2266- su2double Viscosity = 0.0 , WallDist[3 ] = {0.0 }, Area, TauNormal, RefTemp, RefVel2 = 0.0 , dTn, dTven,
2267- RefDensity = 0.0 , GradTemperature, Density = 0.0 , WallDistMod, FrictionVel, Mach2Vel, Mach_Motion,
2228+ su2double Viscosity = 0.0 , WallDist[3 ] = {0.0 }, Area, TauNormal, RefVel2 = 0.0 , dTn, dTven,
2229+ RefDensity = 0.0 , GradTemperature, Density = 0.0 , WallDistMod, FrictionVel,
22682230 UnitNormal[3 ] = {0.0 }, TauElem[3 ] = {0.0 }, TauTangent[3 ] = {0.0 }, Tau[3 ][3 ] = {{0.0 }}, Cp,
22692231 thermal_conductivity, MaxNorm = 8.0 , Grad_Vel[3 ][3 ] = {{0.0 }}, Grad_Temp[3 ] = {0.0 }, AxiFactor;
22702232 const su2double *Coord = nullptr , *Coord_Normal = nullptr , *Normal = nullptr ;
@@ -2273,7 +2235,6 @@ void CFVMFlowSolverBase<V, FlowRegime>::Friction_Forces(const CGeometry* geometr
22732235
22742236 su2double Alpha = config->GetAoA () * PI_NUMBER / 180.0 ;
22752237 su2double Beta = config->GetAoS () * PI_NUMBER / 180.0 ;
2276- su2double RefArea = config->GetRefArea ();
22772238 su2double RefLength = config->GetRefLength ();
22782239 su2double RefHeatFlux = config->GetHeat_Flux_Ref ();
22792240 su2double Gas_Constant = config->GetGas_ConstantND ();
@@ -2294,44 +2255,7 @@ void CFVMFlowSolverBase<V, FlowRegime>::Friction_Forces(const CGeometry* geometr
22942255 VEL_INDEX = nSpecies+2 ;
22952256 }
22962257
2297- // / TODO: Move these ifs to specialized functions.
2298-
2299- if (FlowRegime == COMPRESSIBLE) {
2300- /* --- Evaluate reference values for non-dimensionalization.
2301- For dynamic meshes, use the motion Mach number as a reference value
2302- for computing the force coefficients. Otherwise, use the freestream values,
2303- which is the standard convention. ---*/
2304-
2305- RefTemp = Temperature_Inf;
2306- RefDensity = Density_Inf;
2307- if (dynamic_grid) {
2308- Mach2Vel = sqrt (Gamma * Gas_Constant * RefTemp);
2309- Mach_Motion = config->GetMach_Motion ();
2310- RefVel2 = (Mach_Motion * Mach2Vel) * (Mach_Motion * Mach2Vel);
2311- } else {
2312- RefVel2 = 0.0 ;
2313- for (iDim = 0 ; iDim < nDim; iDim++) RefVel2 += Velocity_Inf[iDim] * Velocity_Inf[iDim];
2314- }
2315- }
2316-
2317- if (FlowRegime == INCOMPRESSIBLE) {
2318- /* --- Evaluate reference values for non-dimensionalization.
2319- For dimensional or non-dim based on initial values, use
2320- the far-field state (inf). For a custom non-dim based
2321- on user-provided reference values, use the ref values
2322- to compute the forces. ---*/
2323-
2324- if ((config->GetRef_Inc_NonDim () == DIMENSIONAL) || (config->GetRef_Inc_NonDim () == INITIAL_VALUES)) {
2325- RefDensity = Density_Inf;
2326- RefVel2 = 0.0 ;
2327- for (iDim = 0 ; iDim < nDim; iDim++) RefVel2 += Velocity_Inf[iDim] * Velocity_Inf[iDim];
2328- } else if (config->GetRef_Inc_NonDim () == REFERENCE_VALUES) {
2329- RefDensity = config->GetInc_Density_Ref ();
2330- RefVel2 = config->GetInc_Velocity_Ref () * config->GetInc_Velocity_Ref ();
2331- }
2332- }
2333-
2334- const su2double factor = 1.0 / (0.5 * RefDensity * RefArea * RefVel2);
2258+ const su2double factor = 1.0 / AeroCoeffForceRef;
23352259
23362260 /* --- Variables initialization ---*/
23372261
@@ -2452,8 +2376,6 @@ void CFVMFlowSolverBase<V, FlowRegime>::Friction_Forces(const CGeometry* geometr
24522376
24532377 /* --- Compute total and maximum heat flux on the wall ---*/
24542378
2455-
2456-
24572379 // / TODO: Move these ifs to specialized functions.
24582380 if (!nemo){
24592381
0 commit comments