Skip to content

Commit be3bb45

Browse files
committed
Merge remote-tracking branch 'origin/develop' into massflow_flowmeta
2 parents 6e06a34 + 1502831 commit be3bb45

11 files changed

Lines changed: 115 additions & 47 deletions

File tree

Common/include/CConfig.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9104,7 +9104,7 @@ class CConfig {
91049104
* \brief Check if values passed to the BC_HeatFlux-Routine are already integrated.
91059105
* \return YES if the passed values is the integrated heat flux over the marker's surface.
91069106
*/
9107-
bool GetIntegrated_HeatFlux(void) const { return Integrated_HeatFlux; }
9107+
bool GetIntegrated_HeatFlux() const { return Integrated_HeatFlux; }
91089108

91099109
/*!
91109110
* \brief Get Compute Average.

Common/include/geometry/CGeometry.hpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ class CGeometry {
199199
unsigned long *nElem_Bound{nullptr}; /*!< \brief Number of elements of the boundary. */
200200
string *Tag_to_Marker{nullptr}; /*!< \brief Names of boundary markers. */
201201
vector<bool> bound_is_straight; /*!< \brief Bool if boundary-marker is straight(2D)/plane(3D) for each local marker. */
202+
vector<su2double> SurfaceAreaCfgFile; /*!< \brief Total Surface area for all markers. */
202203

203204
/*--- Partitioning-specific variables ---*/
204205

@@ -910,6 +911,20 @@ class CGeometry {
910911
*/
911912
inline virtual void SetRestricted_GridVelocity(const CGeometry *fine_grid) {}
912913

914+
/*!
915+
* \brief Compute the surface area of all global markers.
916+
* \param[in] config - Definition of the particular problem.
917+
*/
918+
void ComputeSurfaceAreaCfgFile(const CConfig *config);
919+
920+
/*!
921+
* \brief Get global Surface Area to a local marker.
922+
* \param[in] config - Definition of the particular problem.
923+
* \param[in] val_marker - Local surface marker.
924+
* \return Global Surface Area to the local marker
925+
*/
926+
su2double GetSurfaceArea(const CConfig *config, unsigned short val_marker) const;
927+
913928
/*!
914929
* \brief Check if a boundary is straight(2D) / plane(3D) for EULER_WALL and SYMMETRY_PLANE
915930
* only and store the information in bound_is_straight. For all other boundary types

Common/src/CConfig.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,6 +1572,8 @@ void CConfig::SetConfig_Options() {
15721572
/*!\brief MARKER_HEATFLUX \n DESCRIPTION: Specified heat flux wall boundary marker(s)
15731573
Format: ( Heat flux marker, wall heat flux (static), ... ) \ingroup Config*/
15741574
addStringDoubleListOption("MARKER_HEATFLUX", nMarker_HeatFlux, Marker_HeatFlux, Heat_Flux);
1575+
/*!\brief INTEGRATED_HEATFLUX \n DESCRIPTION: Prescribe Heatflux in [W] instead of [W/m^2] \ingroup Config \default false */
1576+
addBoolOption("INTEGRATED_HEATFLUX", Integrated_HeatFlux, false);
15751577
/*!\brief MARKER_HEATTRANSFER DESCRIPTION: Heat flux with specified heat transfer coefficient boundary marker(s)\n
15761578
* Format: ( Heat transfer marker, heat transfer coefficient, wall temperature (static), ... ) \ingroup Config */
15771579
addExhaustOption("MARKER_HEATTRANSFER", nMarker_HeatTransfer, Marker_HeatTransfer, HeatTransfer_Coeff, HeatTransfer_WallTemp);
@@ -1589,8 +1591,6 @@ void CConfig::SetConfig_Options() {
15891591
/* DESCRIPTION: Fan poly efficiency */
15901592
addDoubleOption("FAN_POLY_EFF", Fan_Poly_Eff, 1.0);
15911593
/*!\brief SUBSONIC_ENGINE\n DESCRIPTION: Engine subsonic intake region \ingroup Config*/
1592-
addBoolOption("INTEGRATED_HEATFLUX", Integrated_HeatFlux, false);
1593-
/*!\brief SUBSONIC_ENGINE\n DESCRIPTION: Engine subsonic intake region \ingroup Config*/
15941594
addBoolOption("SUBSONIC_ENGINE", SubsonicEngine, false);
15951595
/* DESCRIPTION: Actuator disk double surface */
15961596
addBoolOption("ACTDISK_DOUBLE_SURFACE", ActDisk_DoubleSurface, false);

Common/src/geometry/CGeometry.cpp

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2436,6 +2436,8 @@ void CGeometry::UpdateGeometry(CGeometry **geometry_container, CConfig *config)
24362436

24372437
}
24382438

2439+
/*--- Compute the global surface areas for all markers. ---*/
2440+
geometry_container[MESH_0]->ComputeSurfaceAreaCfgFile(config);
24392441
}
24402442

24412443
void CGeometry::SetCustomBoundary(CConfig *config) {
@@ -2503,6 +2505,57 @@ void CGeometry::UpdateCustomBoundaryConditions(CGeometry **geometry_container, C
25032505
}
25042506
}
25052507

2508+
void CGeometry::ComputeSurfaceAreaCfgFile(const CConfig *config) {
2509+
const auto nMarker_Global = config->GetnMarker_CfgFile();
2510+
SurfaceAreaCfgFile.resize(nMarker_Global);
2511+
vector<su2double> LocalSurfaceArea(nMarker_Global, 0.0);
2512+
2513+
/*--- Loop over all local markers ---*/
2514+
for (unsigned short iMarker = 0; iMarker < nMarker; iMarker++) {
2515+
2516+
const auto Local_TagBound = config->GetMarker_All_TagBound(iMarker);
2517+
2518+
/*--- Loop over all global markers, and find the local-global pair via
2519+
matching unique string tags. ---*/
2520+
for (unsigned short iMarker_Global = 0; iMarker_Global < nMarker_Global; iMarker_Global++) {
2521+
2522+
const auto Global_TagBound = config->GetMarker_CfgFile_TagBound(iMarker_Global);
2523+
if (Local_TagBound == Global_TagBound) {
2524+
2525+
for(auto iVertex = 0ul; iVertex < nVertex[iMarker]; iVertex++ ) {
2526+
2527+
const auto iPoint = vertex[iMarker][iVertex]->GetNode();
2528+
2529+
if(!nodes->GetDomain(iPoint)) continue;
2530+
2531+
const auto AreaNormal = vertex[iMarker][iVertex]->GetNormal();
2532+
const auto Area = GeometryToolbox::Norm(nDim, AreaNormal);
2533+
2534+
LocalSurfaceArea[iMarker_Global] += Area;
2535+
}// for iVertex
2536+
}//if Local == Global
2537+
}//for iMarker_Global
2538+
}//for iMarker
2539+
2540+
SU2_MPI::Allreduce(LocalSurfaceArea.data(), SurfaceAreaCfgFile.data(), SurfaceAreaCfgFile.size(), MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm());
2541+
}
2542+
2543+
su2double CGeometry::GetSurfaceArea(const CConfig *config, unsigned short val_marker) const {
2544+
/*---Find the precomputed marker surface area by local-global string-matching. ---*/
2545+
const auto Marker_Tag = config->GetMarker_All_TagBound(val_marker);
2546+
2547+
for (unsigned short iMarker_Global = 0; iMarker_Global < config->GetnMarker_CfgFile(); iMarker_Global++) {
2548+
2549+
const auto Global_TagBound = config->GetMarker_CfgFile_TagBound(iMarker_Global);
2550+
2551+
if (Marker_Tag == Global_TagBound)
2552+
return SurfaceAreaCfgFile[iMarker_Global];
2553+
2554+
}
2555+
2556+
SU2_MPI::Error("Unable to match local-marker with cfg-marker for Surface Area.", CURRENT_FUNCTION);
2557+
return 0.0;
2558+
}
25062559

25072560
void CGeometry::ComputeSurf_Straightness(CConfig *config,
25082561
bool print_on_screen) {

Common/src/geometry/meshreader/CSU2ASCIIMeshReaderFVM.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ bool CSU2ASCIIMeshReaderFVM::ReadMetadata(const bool single_pass, CConfig *confi
9999
string text_line;
100100
if ((nZones > 1 && multizone_file) || harmonic_balance) {
101101
if (harmonic_balance) {
102-
cout << "Reading time instance " << config->GetiInst()+1 << "." << endl;
102+
if (rank == MASTER_NODE) cout << "Reading time instance " << config->GetiInst()+1 << "." << endl;
103103
}
104104
else {
105105
bool foundZone = false;
@@ -109,7 +109,7 @@ bool CSU2ASCIIMeshReaderFVM::ReadMetadata(const bool single_pass, CConfig *confi
109109
text_line.erase (0,6);
110110
unsigned short jZone = atoi(text_line.c_str());
111111
if (jZone == myZone+1) {
112-
cout << "Reading zone " << myZone << " from native SU2 ASCII mesh." << endl;
112+
if (rank == MASTER_NODE) cout << "Reading zone " << myZone << " from native SU2 ASCII mesh." << endl;
113113
foundZone = true;
114114
break;
115115
}

SU2_CFD/src/drivers/CDriver.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,10 @@ void CDriver::Geometrical_Preprocessing_FVM(CConfig *config, CGeometry **&geomet
812812
geometry[MESH_0]->ComputeSurf_Curvature(config);
813813
}
814814

815+
/*--- Compute the global surface areas for all markers. ---*/
816+
817+
geometry[MESH_0]->ComputeSurfaceAreaCfgFile(config);
818+
815819
/*--- Check for periodicity and disable MG if necessary. ---*/
816820

817821
if (rank == MASTER_NODE) cout << "Checking for periodicity." << endl;

SU2_CFD/src/solvers/CHeatSolver.cpp

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -621,38 +621,21 @@ void CHeatSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver **solver_conta
621621
}
622622
}
623623

624-
void CHeatSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config,
625-
unsigned short val_marker) {
624+
void CHeatSolver::BC_HeatFlux_Wall(CGeometry* geometry, CSolver** solver_container, CNumerics* conv_numerics,
625+
CNumerics* visc_numerics, CConfig* config, unsigned short val_marker) {
626+
const auto Marker_Tag = config->GetMarker_All_TagBound(val_marker);
626627

627-
su2double Area, *Normal;
628-
629-
string Marker_Tag = config->GetMarker_All_TagBound(val_marker);
630-
631-
su2double Wall_HeatFlux = config->GetWall_HeatFlux(Marker_Tag);
632-
if(config->GetIntegrated_HeatFlux()) {
633-
634-
string HeatFlux_Tag, Marker_Tag;
635-
636-
for (auto iMarker_HeatFlux = 0u; iMarker_HeatFlux < config->GetnMarker_HeatFlux(); iMarker_HeatFlux++ ) {
637-
638-
HeatFlux_Tag = config->GetMarker_HeatFlux_TagBound(iMarker_HeatFlux);
639-
Marker_Tag = config->GetMarker_All_TagBound(val_marker);
640-
641-
if (Marker_Tag == HeatFlux_Tag) {
642-
Wall_HeatFlux = Wall_HeatFlux / Surface_Areas[iMarker_HeatFlux];
643-
}
644-
}
628+
su2double Wall_HeatFlux = config->GetWall_HeatFlux(Marker_Tag) / config->GetHeat_Flux_Ref();
629+
if (config->GetIntegrated_HeatFlux()) {
630+
Wall_HeatFlux /= geometry->GetSurfaceArea(config, val_marker);
645631
}
646-
Wall_HeatFlux = Wall_HeatFlux/config->GetHeat_Flux_Ref();
647632

648633
for (auto iVertex = 0ul; iVertex < geometry->nVertex[val_marker]; iVertex++) {
649-
650634
const auto iPoint = geometry->vertex[val_marker][iVertex]->GetNode();
651635

652636
if (geometry->nodes->GetDomain(iPoint)) {
653-
654-
Normal = geometry->vertex[val_marker][iVertex]->GetNormal();
655-
Area = GeometryToolbox::Norm(nDim, Normal);
637+
const auto Normal = geometry->vertex[val_marker][iVertex]->GetNormal();
638+
const auto Area = GeometryToolbox::Norm(nDim, Normal);
656639

657640
Res_Visc[0] = 0.0;
658641

@@ -662,7 +645,6 @@ void CHeatSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver **solver_contain
662645

663646
LinSysRes.SubtractBlock(iPoint, Res_Visc);
664647
}
665-
666648
}
667649
}
668650

SU2_CFD/src/solvers/CIncNSSolver.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -384,16 +384,20 @@ void CIncNSSolver::BC_Wall_Generic(const CGeometry *geometry, const CConfig *con
384384

385385
su2double Wall_HeatFlux = 0.0, Twall = 0.0, Tinfinity = 0.0, Transfer_Coefficient = 0.0;
386386

387-
switch(kind_boundary) {
387+
switch (kind_boundary) {
388388
case HEAT_FLUX:
389-
Wall_HeatFlux = config->GetWall_HeatFlux(Marker_Tag)/config->GetHeat_Flux_Ref();
389+
Wall_HeatFlux = config->GetWall_HeatFlux(Marker_Tag) / config->GetHeat_Flux_Ref();
390+
if (config->GetIntegrated_HeatFlux()) {
391+
Wall_HeatFlux /= geometry->GetSurfaceArea(config, val_marker);
392+
}
390393
break;
391394
case ISOTHERMAL:
392-
Twall = config->GetIsothermal_Temperature(Marker_Tag)/config->GetTemperature_Ref();
395+
Twall = config->GetIsothermal_Temperature(Marker_Tag) / config->GetTemperature_Ref();
393396
break;
394397
case HEAT_TRANSFER:
395-
Transfer_Coefficient = config->GetWall_HeatTransfer_Coefficient(Marker_Tag) * config->GetTemperature_Ref()/config->GetHeat_Flux_Ref();
396-
Tinfinity = config->GetWall_HeatTransfer_Temperature(Marker_Tag)/config->GetTemperature_Ref();
398+
Transfer_Coefficient = config->GetWall_HeatTransfer_Coefficient(Marker_Tag) * config->GetTemperature_Ref() /
399+
config->GetHeat_Flux_Ref();
400+
Tinfinity = config->GetWall_HeatTransfer_Temperature(Marker_Tag) / config->GetTemperature_Ref();
397401
break;
398402
default:
399403
SU2_MPI::Error("Unknown type of boundary condition.", CURRENT_FUNCTION);

SU2_CFD/src/solvers/CNEMONSSolver.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,10 @@ void CNEMONSSolver::BC_HeatFluxNonCatalytic_Wall(CGeometry *geometry,
250250

251251
/*--- Local variables ---*/
252252
const auto Marker_Tag = config->GetMarker_All_TagBound(val_marker);
253-
su2double Wall_HeatFlux = config->GetWall_HeatFlux(Marker_Tag)/config->GetHeat_Flux_Ref();
253+
su2double Wall_HeatFlux = config->GetWall_HeatFlux(Marker_Tag) / config->GetHeat_Flux_Ref();
254+
if (config->GetIntegrated_HeatFlux()) {
255+
Wall_HeatFlux /= geometry->GetSurfaceArea(config, val_marker);
256+
}
254257
const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT);
255258

256259
/*--- Set "Proportional control" coefficient ---*/
@@ -405,7 +408,10 @@ void CNEMONSSolver::BC_HeatFluxCatalytic_Wall(CGeometry *geometry,
405408
string Marker_Tag = config->GetMarker_All_TagBound(val_marker);
406409

407410
/*--- Get the specified wall heat flux from config ---*/
408-
su2double Wall_HeatFlux = config->GetWall_HeatFlux(Marker_Tag);
411+
su2double Wall_HeatFlux = config->GetWall_HeatFlux(Marker_Tag) / config->GetHeat_Flux_Ref();
412+
if (config->GetIntegrated_HeatFlux()) {
413+
Wall_HeatFlux /= geometry->GetSurfaceArea(config, val_marker);
414+
}
409415

410416
/*--- Get the locations of the primitive variables ---*/
411417
const unsigned short T_INDEX = nodes->GetTIndex();

SU2_CFD/src/solvers/CNSSolver.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -421,9 +421,8 @@ void CNSSolver::BC_HeatTransfer_Wall(const CGeometry *geometry, const CConfig *c
421421
BC_HeatFlux_Wall_Generic(geometry, config, val_marker, HEAT_TRANSFER);
422422
}
423423

424-
void CNSSolver::BC_HeatFlux_Wall_Generic(const CGeometry *geometry, const CConfig *config,
425-
unsigned short val_marker, unsigned short kind_boundary) {
426-
424+
void CNSSolver::BC_HeatFlux_Wall_Generic(const CGeometry* geometry, const CConfig* config, unsigned short val_marker,
425+
unsigned short kind_boundary) {
427426
/*--- Identify the boundary by string name and get the specified wall
428427
heat flux from config as well as the wall function treatment. ---*/
429428

@@ -435,12 +434,15 @@ void CNSSolver::BC_HeatFlux_Wall_Generic(const CGeometry *geometry, const CConfi
435434
su2double Wall_HeatFlux = 0.0, Tinfinity = 0.0, Transfer_Coefficient = 0.0;
436435

437436
if (kind_boundary == HEAT_FLUX) {
438-
Wall_HeatFlux = config->GetWall_HeatFlux(Marker_Tag)/config->GetHeat_Flux_Ref();
439-
}
440-
else if (kind_boundary == HEAT_TRANSFER) {
437+
Wall_HeatFlux = config->GetWall_HeatFlux(Marker_Tag) / config->GetHeat_Flux_Ref();
438+
if (config->GetIntegrated_HeatFlux()) {
439+
Wall_HeatFlux /= geometry->GetSurfaceArea(config, val_marker);
440+
}
441+
} else if (kind_boundary == HEAT_TRANSFER) {
441442
/*--- The required heatflux will be computed for each iPoint individually based on local Temperature. ---*/
442-
Transfer_Coefficient = config->GetWall_HeatTransfer_Coefficient(Marker_Tag) * config->GetTemperature_Ref()/config->GetHeat_Flux_Ref();
443-
Tinfinity = config->GetWall_HeatTransfer_Temperature(Marker_Tag)/config->GetTemperature_Ref();
443+
Transfer_Coefficient = config->GetWall_HeatTransfer_Coefficient(Marker_Tag) * config->GetTemperature_Ref() /
444+
config->GetHeat_Flux_Ref();
445+
Tinfinity = config->GetWall_HeatTransfer_Temperature(Marker_Tag) / config->GetTemperature_Ref();
444446
}
445447

446448
// Wall_Function = config->GetWallFunction_Treatment(Marker_Tag);

0 commit comments

Comments
 (0)