Skip to content

Commit 6f5610f

Browse files
authored
Merge pull request #503 from pecos-hybrid/custom-fluid-BCs
Extend custom python BC to include Euler/NS and turbulence variables.
2 parents 0dfa47e + 389a53f commit 6f5610f

File tree

7 files changed

+505
-102
lines changed

7 files changed

+505
-102
lines changed

Common/src/geometry_structure.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,6 +1395,9 @@ void CGeometry::SetCustomBoundary(CConfig *config) {
13951395
CustomBoundaryTemperature[iMarker][iVertex] = config->GetIsothermal_Temperature(Marker_Tag);
13961396
}
13971397
break;
1398+
case INLET_FLOW:
1399+
// This case is handled in the solver class.
1400+
break;
13981401
default:
13991402
cout << "WARNING: Marker " << Marker_Tag << " is not customizable. Using default behavior." << endl;
14001403
break;
@@ -1412,11 +1415,17 @@ void CGeometry::UpdateCustomBoundaryConditions(CGeometry **geometry_container, C
14121415
for (iMGlevel=1; iMGlevel <= nMGlevel; iMGlevel++){
14131416
iMGfine = iMGlevel-1;
14141417
for(iMarker = 0; iMarker< config->GetnMarker_All(); iMarker++){
1415-
if (config->GetMarker_All_PyCustom(iMarker) && config->GetMarker_All_KindBC(iMarker) == HEAT_FLUX){
1416-
geometry_container[iMGlevel]->SetMultiGridWallHeatFlux(geometry_container[iMGfine], iMarker);
1417-
}
1418-
else if (config->GetMarker_All_PyCustom(iMarker) && config->GetMarker_All_KindBC(iMarker) == ISOTHERMAL) {
1419-
geometry_container[iMGlevel]->SetMultiGridWallTemperature(geometry_container[iMGfine], iMarker);
1418+
if(config->GetMarker_All_PyCustom(iMarker)){
1419+
switch(config->GetMarker_All_KindBC(iMarker)){
1420+
case HEAT_FLUX:
1421+
geometry_container[iMGlevel]->SetMultiGridWallHeatFlux(geometry_container[iMGfine], iMarker);
1422+
break;
1423+
case ISOTHERMAL:
1424+
geometry_container[iMGlevel]->SetMultiGridWallTemperature(geometry_container[iMGfine], iMarker);
1425+
break;
1426+
// Inlet flow handled in solver class.
1427+
default: break;
1428+
}
14201429
}
14211430
}
14221431
}

SU2_CFD/include/driver_structure.hpp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,12 @@ class CDriver {
609609
*/
610610
vector<string> GetAllCHTMarkersTag();
611611

612+
/*!
613+
* \brief Get all the (subsonic) inlet boundary markers tags.
614+
* \return List of inlet boundary markers tags.
615+
*/
616+
vector<string> GetAllInletMarkersTag();
617+
612618
/*!
613619
* \brief Get all the boundary markers tags with their associated indices.
614620
* \return List of boundary markers tags with their indices.
@@ -751,6 +757,41 @@ class CFluidDriver : public CDriver {
751757
* \brief Transfer data among different zones (multiple zone).
752758
*/
753759
void Transfer_Data(unsigned short donorZone, unsigned short targetZone);
760+
761+
/*!
762+
* \brief Set the total temperature of a vertex on a specified inlet marker.
763+
* \param[in] iMarker - Marker identifier.
764+
* \param[in] iVertex - Vertex identifier.
765+
* \param[in] val_Ttotal - Value of the total (stagnation) temperature.
766+
*/
767+
void SetVertexTtotal(unsigned short iMarker, unsigned short iVertex, su2double val_Ttotal);
768+
769+
/*!
770+
* \brief Set the total pressure of a vertex on a specified inlet marker.
771+
* \param[in] iMarker - Marker identifier.
772+
* \param[in] iVertex - Vertex identifier.
773+
* \param[in] val_Ptotal - Value of the total (stagnation) pressure.
774+
*/
775+
void SetVertexPtotal(unsigned short iMarker, unsigned short iVertex, su2double val_Ptotal);
776+
777+
/*!
778+
* \brief Set the flow direction of a vertex on a specified inlet marker.
779+
* \param[in] iMarker - Marker identifier.
780+
* \param[in] iVertex - Vertex identifier.
781+
* \param[in] iDim - Index of the flow direction unit vector
782+
* \param[in] val_FlowDir - Component of a unit vector representing the flow direction
783+
*/
784+
void SetVertexFlowDir(unsigned short iMarker, unsigned short iVertex, unsigned short iDim, su2double val_FlowDir);
785+
786+
/*!
787+
* \brief Set a turbulence variable on a specified inlet marker.
788+
* \param[in] iMarker - Marker identifier.
789+
* \param[in] iVertex - Vertex identifier.
790+
* \param[in] iDim - Index of the turbulence variable (i.e. k is 0 in SST)
791+
* \param[in] val_turb_var - Value of the turbulence variable to be used.
792+
*/
793+
void SetVertexTurbVar(unsigned short iMarker, unsigned short iVertex, unsigned short iDim, su2double val_tub_var);
794+
754795
};
755796

756797

SU2_CFD/include/solver_structure.hpp

Lines changed: 111 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2724,53 +2724,77 @@ class CSolver {
27242724
virtual void SetActDisk_DeltaT(unsigned short val_marker, unsigned long val_vertex, su2double val_deltat);
27252725

27262726
/*!
2727-
* \brief A virtual member.
2728-
* \param[in] val_marker - Surface marker where the coefficient is computed.
2729-
* \param[in] val_vertex - Vertex of the marker <i>val_marker</i> where the coefficient is evaluated.
2730-
* \return Value of the pressure coefficient.
2727+
* \brief A virtual member
2728+
* \param[in] val_marker - Surface marker where the total temperature is evaluated.
2729+
* \param[in] val_vertex - Vertex of the marker <i>val_marker</i> where the total temperature is evaluated.
2730+
* \return Value of the total temperature
27312731
*/
27322732
virtual su2double GetInlet_Ttotal(unsigned short val_marker, unsigned long val_vertex);
27332733

27342734
/*!
2735-
* \brief A virtual member.
2736-
* \param[in] val_marker - Surface marker where the coefficient is computed.
2737-
* \param[in] val_vertex - Vertex of the marker <i>val_marker</i> where the coefficient is evaluated.
2738-
* \return Value of the pressure coefficient.
2735+
* \brief A virtual member
2736+
* \param[in] val_marker - Surface marker where the total pressure is evaluated.
2737+
* \param[in] val_vertex - Vertex of the marker <i>val_marker</i> where the total pressure is evaluated.
2738+
* \return Value of the total pressure
27392739
*/
27402740
virtual su2double GetInlet_Ptotal(unsigned short val_marker, unsigned long val_vertex);
27412741

27422742
/*!
2743-
* \brief A virtual member.
2744-
* \param[in] val_marker - Surface marker where the coefficient is computed.
2745-
* \param[in] val_vertex - Vertex of the marker <i>val_marker</i> where the coefficient is evaluated.
2746-
* \return Value of the pressure coefficient.
2743+
* \brief A virtual member
2744+
* \param[in] val_marker - Surface marker where the flow direction is evaluated
2745+
* \param[in] val_vertex - Vertex of the marker <i>val_marker</i> where the flow direction is evaluated
2746+
* \param[in] val_dim - The component of the flow direction unit vector to be evaluated
2747+
* \return Component of a unit vector representing the flow direction.
27472748
*/
27482749
virtual su2double GetInlet_FlowDir(unsigned short val_marker, unsigned long val_vertex, unsigned short val_dim);
27492750

27502751
/*!
2751-
* \brief A virtual member.
2752-
* \param[in] val_marker - Surface marker where the coefficient is computed.
2753-
* \param[in] val_vertex - Vertex of the marker <i>val_marker</i> where the coefficient is evaluated.
2754-
* \return Value of the pressure coefficient.
2752+
* \brief A virtual member
2753+
* \param[in] val_marker - Surface marker where the total temperature is set.
2754+
* \param[in] val_vertex - Vertex of the marker <i>val_marker</i> where the total temperature is set.
2755+
* \param[in] val_ttotal - Value of the total temperature
27552756
*/
27562757
virtual void SetInlet_Ttotal(unsigned short val_marker, unsigned long val_vertex, su2double val_ttotal);
27572758

27582759
/*!
2759-
* \brief A virtual member.
2760-
* \param[in] val_marker - Surface marker where the coefficient is computed.
2761-
* \param[in] val_vertex - Vertex of the marker <i>val_marker</i> where the coefficient is evaluated.
2762-
* \return Value of the pressure coefficient.
2760+
* \brief A virtual member
2761+
* \param[in] val_marker - Surface marker where the total pressure is set.
2762+
* \param[in] val_vertex - Vertex of the marker <i>val_marker</i> where the total pressure is set.
2763+
* \param[in] val_ptotal - Value of the total pressure
27632764
*/
27642765
virtual void SetInlet_Ptotal(unsigned short val_marker, unsigned long val_vertex, su2double val_ptotal);
27652766

27662767
/*!
2767-
* \brief A virtual member.
2768-
* \param[in] val_marker - Surface marker where the coefficient is computed.
2769-
* \param[in] val_vertex - Vertex of the marker <i>val_marker</i> where the coefficient is evaluated.
2770-
* \return Value of the pressure coefficient.
2768+
* \brief A virtual member
2769+
* \param[in] val_marker - Surface marker where the flow direction is set.
2770+
* \param[in] val_vertex - Vertex of the marker <i>val_marker</i> where the flow direction is set.
2771+
* \param[in] val_dim - The component of the flow direction unit vector to be set
2772+
* \param[in] val_flowdir - Component of a unit vector representing the flow direction.
27712773
*/
27722774
virtual void SetInlet_FlowDir(unsigned short val_marker, unsigned long val_vertex, unsigned short val_dim, su2double val_flowdir);
27732775

2776+
/*!
2777+
* \brief A virtual member
2778+
* \param[in] iMarker - Marker identifier.
2779+
* \param[in] iVertex - Vertex identifier.
2780+
* \param[in] iDim - Index of the turbulence variable (i.e. k is 0 in SST)
2781+
* \param[in] val_turb_var - Value of the turbulence variable to be used.
2782+
*/
2783+
virtual void SetInlet_TurbVar(unsigned short val_marker, unsigned long val_vertex, unsigned short val_dim, su2double val_turb_var);
2784+
2785+
/*!
2786+
* \brief A virtual member
2787+
* \param[in] config - Definition of the particular problem.
2788+
*/
2789+
virtual void SetInlet(CConfig *config);
2790+
2791+
/*!
2792+
* \brief Update the multi-grid structure for the customized boundary conditions
2793+
* \param geometry_container - Geometrical definition.
2794+
* \param config - Definition of the particular problem.
2795+
*/
2796+
virtual void UpdateCustomBoundaryConditions(CGeometry **geometry_container, CConfig *config);
2797+
27742798
/*!
27752799
* \brief A virtual member.
27762800
* \param[in] val_marker - Surface marker where the coefficient is computed.
@@ -6013,53 +6037,68 @@ class CEulerSolver : public CSolver {
60136037
void SetActDisk_DeltaT(unsigned short val_marker, unsigned long val_vertex, su2double val_deltat);
60146038

60156039
/*!
6016-
* \brief Value of the characteristic global index at the boundaries.
6017-
* \param[in] val_marker - Surface marker where the coefficient is computed.
6018-
* \param[in] val_vertex - Vertex of the marker <i>val_marker</i> where the coefficient is evaluated.
6019-
* \return Value of the pressure coefficient.
6040+
* \brief Value of the total temperature at an inlet boundary.
6041+
* \param[in] val_marker - Surface marker where the total temperature is evaluated.
6042+
* \param[in] val_vertex - Vertex of the marker <i>val_marker</i> where the total temperature is evaluated.
6043+
* \return Value of the total temperature
60206044
*/
60216045
su2double GetInlet_Ttotal(unsigned short val_marker, unsigned long val_vertex);
60226046

60236047
/*!
6024-
* \brief Value of the characteristic global index at the boundaries.
6025-
* \param[in] val_marker - Surface marker where the coefficient is computed.
6026-
* \param[in] val_vertex - Vertex of the marker <i>val_marker</i> where the coefficient is evaluated.
6027-
* \return Value of the pressure coefficient.
6048+
* \brief Value of the total pressure at an inlet boundary.
6049+
* \param[in] val_marker - Surface marker where the total pressure is evaluated.
6050+
* \param[in] val_vertex - Vertex of the marker <i>val_marker</i> where the total pressure is evaluated.
6051+
* \return Value of the total pressure
60286052
*/
60296053
su2double GetInlet_Ptotal(unsigned short val_marker, unsigned long val_vertex);
60306054

60316055
/*!
6032-
* \brief Value of the characteristic global index at the boundaries.
6033-
* \param[in] val_marker - Surface marker where the coefficient is computed.
6034-
* \param[in] val_vertex - Vertex of the marker <i>val_marker</i> where the coefficient is evaluated.
6035-
* \return Value of the pressure coefficient.
6056+
* \brief A component of the unit vector representing the flow direction at an inlet boundary.
6057+
* \param[in] val_marker - Surface marker where the flow direction is evaluated
6058+
* \param[in] val_vertex - Vertex of the marker <i>val_marker</i> where the flow direction is evaluated
6059+
* \param[in] val_dim - The component of the flow direction unit vector to be evaluated
6060+
* \return Component of a unit vector representing the flow direction.
60366061
*/
60376062
su2double GetInlet_FlowDir(unsigned short val_marker, unsigned long val_vertex, unsigned short val_dim);
60386063

60396064
/*!
6040-
* \brief Value of the characteristic global index at the boundaries.
6041-
* \param[in] val_marker - Surface marker where the coefficient is computed.
6042-
* \param[in] val_vertex - Vertex of the marker <i>val_marker</i> where the coefficient is evaluated.
6043-
* \return Value of the pressure coefficient.
6065+
* \brief Set the value of the total temperature at an inlet boundary.
6066+
* \param[in] val_marker - Surface marker where the total temperature is set.
6067+
* \param[in] val_vertex - Vertex of the marker <i>val_marker</i> where the total temperature is set.
6068+
* \param[in] val_ttotal - Value of the total temperature
60446069
*/
60456070
void SetInlet_Ttotal(unsigned short val_marker, unsigned long val_vertex, su2double val_ttotal);
60466071

60476072
/*!
6048-
* \brief Value of the characteristic global index at the boundaries.
6049-
* \param[in] val_marker - Surface marker where the coefficient is computed.
6050-
* \param[in] val_vertex - Vertex of the marker <i>val_marker</i> where the coefficient is evaluated.
6051-
* \return Value of the pressure coefficient.
6073+
* \brief Set the value of the total pressure at an inlet boundary.
6074+
* \param[in] val_marker - Surface marker where the total pressure is set.
6075+
* \param[in] val_vertex - Vertex of the marker <i>val_marker</i> where the total pressure is set.
6076+
* \param[in] val_ptotal - Value of the total pressure
60526077
*/
60536078
void SetInlet_Ptotal(unsigned short val_marker, unsigned long val_vertex, su2double val_ptotal);
60546079

60556080
/*!
6056-
* \brief Value of the characteristic global index at the boundaries.
6057-
* \param[in] val_marker - Surface marker where the coefficient is computed.
6058-
* \param[in] val_vertex - Vertex of the marker <i>val_marker</i> where the coefficient is evaluated.
6059-
* \return Value of the pressure coefficient.
6081+
* \brief Set a component of the unit vector representing the flow direction at an inlet boundary.
6082+
* \param[in] val_marker - Surface marker where the flow direction is set.
6083+
* \param[in] val_vertex - Vertex of the marker <i>val_marker</i> where the flow direction is set.
6084+
* \param[in] val_dim - The component of the flow direction unit vector to be set
6085+
* \param[in] val_flowdir - Component of a unit vector representing the flow direction.
60606086
*/
60616087
void SetInlet_FlowDir(unsigned short val_marker, unsigned long val_vertex, unsigned short val_dim, su2double val_flowdir);
60626088

6089+
/*!
6090+
* \brief Setup the inlet per the config file and stores the result
6091+
* \param[in] config - Definition of the particular problem.
6092+
*/
6093+
void SetInlet(CConfig *config);
6094+
6095+
/*!
6096+
* \brief Update the multi-grid structure for the customized boundary conditions
6097+
* \param geometry_container - Geometrical definition.
6098+
* \param config - Definition of the particular problem.
6099+
*/
6100+
void UpdateCustomBoundaryConditions(CGeometry **geometry_container, CConfig *config);
6101+
60636102
/*!
60646103
* \brief Set the total residual adding the term that comes from the Dual Time Strategy.
60656104
* \param[in] geometry - Geometrical definition of the problem.
@@ -8546,6 +8585,7 @@ class CTurbSolver : public CSolver {
85468585
*upperlimit; /*!< \brief contains upper limits for turbulence variables. */
85478586
su2double Gamma; /*!< \brief Fluid's Gamma constant (ratio of specific heats). */
85488587
su2double Gamma_Minus_One; /*!< \brief Fluids's Gamma - 1.0 . */
8588+
su2double*** Inlet_TurbVars; /*!< \brief Turbulence variables at inlet profiles */
85498589
unsigned long nMarker, /*!< \brief Total number of markers using the grid information. */
85508590
*nVertex; /*!< \brief Store nVertex at each marker for deallocation */
85518591

@@ -8568,9 +8608,10 @@ class CTurbSolver : public CSolver {
85688608

85698609
/*!
85708610
* \brief Constructor of the class.
8611+
* \param[in] geometry - Geometrical definition of the problem.
85718612
* \param[in] config - Definition of the particular problem.
85728613
*/
8573-
CTurbSolver(CConfig *config);
8614+
CTurbSolver(CGeometry* geometry, CConfig *config);
85748615

85758616
/*!
85768617
* \brief Impose the send-receive boundary condition.
@@ -8748,6 +8789,15 @@ class CTurbSolver : public CSolver {
87488789
* \param[in] val_vertex - vertex index
87498790
*/
87508791
int GetnSlidingStates(unsigned short val_marker, unsigned long val_vertex);
8792+
8793+
/*!
8794+
* \brief Set custom turbulence variables at the vertex of an inlet.
8795+
* \param[in] iMarker - Marker identifier.
8796+
* \param[in] iVertex - Vertex identifier.
8797+
* \param[in] iDim - Index of the turbulence variable (i.e. k is 0 in SST)
8798+
* \param[in] val_turb_var - Value of the turbulence variable to be used.
8799+
*/
8800+
void SetInlet_TurbVar(unsigned short val_marker, unsigned long val_vertex, unsigned short val_dim, su2double val_turb_var);
87518801
};
87528802

87538803
/*!
@@ -9017,6 +9067,12 @@ class CTurbSASolver: public CTurbSolver {
90179067
*/
90189068
void SetDES_LengthScale(CSolver** solver, CGeometry *geometry, CConfig *config);
90199069

9070+
/*!
9071+
* \brief Setup the inlet per the config file and stores the result
9072+
* \param[in] config - Definition of the particular problem.
9073+
*/
9074+
void SetInlet(CConfig *config);
9075+
90209076
};
90219077

90229078
/*!
@@ -9203,6 +9259,12 @@ class CTurbSSTSolver: public CTurbSolver {
92039259
*/
92049260
void SetFreeStream_Solution(CConfig *config);
92059261

9262+
/*!
9263+
* \brief Setup the inlet per the config file and stores the result
9264+
* \param[in] config - Definition of the particular problem.
9265+
*/
9266+
void SetInlet(CConfig *config);
9267+
92069268
};
92079269

92089270
/*!

0 commit comments

Comments
 (0)