diff --git a/SU2_CFD/include/solvers/CIncNSSolver.hpp b/SU2_CFD/include/solvers/CIncNSSolver.hpp index 3a6be3df3c5..87b50aa74f7 100644 --- a/SU2_CFD/include/solvers/CIncNSSolver.hpp +++ b/SU2_CFD/include/solvers/CIncNSSolver.hpp @@ -36,14 +36,16 @@ * \author F. Palacios, T. Economon, T. Albring */ class CIncNSSolver final : public CIncEulerSolver { - /*! * \brief Generic implementation of the isothermal, heatflux and heat-transfer/convection walls. + * \param[in] geometry - Geometrical definition of the problem. + * \param[in] solver_container - Container vector with all the solutions. + * \param[in] config - Definition of the particular problem. + * \param[in] val_marker - Surface marker where the boundary condition is applied. + * \param[in] kind_boundary - Kind of boundary condition applied. */ - void BC_Wall_Generic(const CGeometry *geometry, - const CConfig *config, - unsigned short val_marker, - unsigned short kind_boundary); + void BC_Wall_Generic(const CGeometry* geometry, CSolver** solver_container, const CConfig* config, + unsigned short val_marker, unsigned short kind_boundary); /*! * \brief Compute the velocity^2, SoundSpeed, Pressure, Enthalpy, Viscosity. diff --git a/SU2_CFD/src/solvers/CIncNSSolver.cpp b/SU2_CFD/src/solvers/CIncNSSolver.cpp index 6477fa6f361..b9715b8d363 100644 --- a/SU2_CFD/src/solvers/CIncNSSolver.cpp +++ b/SU2_CFD/src/solvers/CIncNSSolver.cpp @@ -409,7 +409,7 @@ unsigned long CIncNSSolver::SetPrimitive_Variables(CSolver **solver_container, c } -void CIncNSSolver::BC_Wall_Generic(const CGeometry *geometry, const CConfig *config, +void CIncNSSolver::BC_Wall_Generic(const CGeometry *geometry, CSolver** solver_container, const CConfig *config, unsigned short val_marker, unsigned short kind_boundary) { const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT); @@ -546,33 +546,53 @@ void CIncNSSolver::BC_Wall_Generic(const CGeometry *geometry, const CConfig *con if (py_custom) { Twall = geometry->GetCustomBoundaryTemperature(val_marker, iVertex) / config->GetTemperature_Ref(); } - const auto Point_Normal = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor(); + if (config->GetMarker_StrongBC(Marker_Tag)) { + /*--- Strong BC Formulation. ---*/ + + LinSysRes(iPoint, nDim + 1) = 0.0; + const su2double* scalars = nullptr; + /*--- Retrieve scalars at wall node. ---*/ + if (config->GetKind_Species_Model() != SPECIES_MODEL::NONE && solver_container[SPECIES_SOL] != nullptr) { + scalars = solver_container[SPECIES_SOL]->GetNodes()->GetSolution(iPoint); + } + /*--- Retrieve fluid model. ---*/ + CFluidModel* fluid_model_local = solver_container[FLOW_SOL]->GetFluidModel(); + /*--- Set thermodynamic state given wall temperature and species composition. ---*/ + fluid_model_local->SetTDState_T(Twall, scalars); + /*--- Set enthalpy obtained from fluid model. ---*/ + nodes->SetSolution_Old(iPoint, nDim + 1, fluid_model_local->GetEnthalpy()); + nodes->SetEnergy_ResTruncError_Zero(iPoint); - /*--- Get coordinates of i & nearest normal and compute distance ---*/ + } else { + /*--- Weak BC formulation. ---*/ + const auto Point_Normal = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor(); - const auto Coord_i = geometry->nodes->GetCoord(iPoint); - const auto Coord_j = geometry->nodes->GetCoord(Point_Normal); - su2double UnitNormal[MAXNDIM] = {0.0}; - for (auto iDim = 0u; iDim < nDim; ++iDim) UnitNormal[iDim] = Normal[iDim] / Area; - const su2double dist_ij = GeometryToolbox::NormalDistance(nDim, UnitNormal, Coord_i, Coord_j); + /*--- Get coordinates of i & nearest normal and compute distance ---*/ - /*--- Compute the normal gradient in temperature using Twall ---*/ + const auto Coord_i = geometry->nodes->GetCoord(iPoint); + const auto Coord_j = geometry->nodes->GetCoord(Point_Normal); + su2double UnitNormal[MAXNDIM] = {0.0}; + for (auto iDim = 0u; iDim < nDim; ++iDim) UnitNormal[iDim] = Normal[iDim] / Area; + const su2double dist_ij = GeometryToolbox::NormalDistance(nDim, UnitNormal, Coord_i, Coord_j); - const su2double dTdn = -(nodes->GetTemperature(Point_Normal) - Twall)/dist_ij; + /*--- Compute the normal gradient in temperature using Twall ---*/ - /*--- Get thermal conductivity ---*/ - const su2double thermal_conductivity = nodes->GetThermalConductivity(iPoint); + const su2double dTdn = -(nodes->GetTemperature(Point_Normal) - Twall) / dist_ij; - /*--- Apply a weak boundary condition for the energy equation. - Compute the residual due to the prescribed heat flux. ---*/ + /*--- Get thermal conductivity ---*/ + const su2double thermal_conductivity = nodes->GetThermalConductivity(iPoint); - LinSysRes(iPoint, nDim+1) -= thermal_conductivity*dTdn*Area; + /*--- Apply a weak boundary condition for the energy equation. + Compute the residual due to the prescribed heat flux. ---*/ - /*--- Jacobian contribution for temperature equation. ---*/ + LinSysRes(iPoint, nDim + 1) -= thermal_conductivity * dTdn * Area; - if (implicit) { - const su2double Cp = nodes->GetSpecificHeatCp(iPoint); - Jacobian.AddVal2Diag(iPoint, nDim + 1, thermal_conductivity * Area / (dist_ij * Cp)); + /*--- Jacobian contribution for temperature equation. ---*/ + + if (implicit) { + const su2double Cp = nodes->GetSpecificHeatCp(iPoint); + Jacobian.AddVal2Diag(iPoint, nDim + 1, thermal_conductivity * Area / (dist_ij * Cp)); + } } break; } // switch @@ -582,19 +602,17 @@ void CIncNSSolver::BC_Wall_Generic(const CGeometry *geometry, const CConfig *con void CIncNSSolver::BC_HeatFlux_Wall(CGeometry *geometry, CSolver**, CNumerics*, CNumerics*, CConfig *config, unsigned short val_marker) { - - BC_Wall_Generic(geometry, config, val_marker, HEAT_FLUX); + BC_Wall_Generic(geometry, nullptr, config, val_marker, HEAT_FLUX); } -void CIncNSSolver::BC_Isothermal_Wall(CGeometry *geometry, CSolver**, CNumerics*, - CNumerics*, CConfig *config, unsigned short val_marker) { - - BC_Wall_Generic(geometry, config, val_marker, ISOTHERMAL); +void CIncNSSolver::BC_Isothermal_Wall(CGeometry* geometry, CSolver** solver_container, CNumerics*, CNumerics*, + CConfig* config, unsigned short val_marker) { + BC_Wall_Generic(geometry, solver_container, config, val_marker, ISOTHERMAL); } -void CIncNSSolver::BC_HeatTransfer_Wall(const CGeometry *geometry, const CConfig *config, const unsigned short val_marker) { - - BC_Wall_Generic(geometry, config, val_marker, HEAT_TRANSFER); +void CIncNSSolver::BC_HeatTransfer_Wall(const CGeometry* geometry, const CConfig* config, + const unsigned short val_marker) { + BC_Wall_Generic(geometry, nullptr, config, val_marker, HEAT_TRANSFER); } void CIncNSSolver::BC_ConjugateHeat_Interface(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics,