Skip to content

Commit

Permalink
Merge branch 'develop' into testcase_axisymmetric_jet
Browse files Browse the repository at this point in the history
  • Loading branch information
bigfooted committed Aug 22, 2024
2 parents 2b42bfd + 6d26b90 commit 0a1d540
Show file tree
Hide file tree
Showing 25 changed files with 266 additions and 419 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ jobs:
# flags: '--buildtype=debug -Denable-directdiff=true -Denable-normal=false -Dwith-omp=true -Denable-mixedprec=true -Denable-pywrapper=true -Denable-tecio=false --warnlevel=3 --werror'
runs-on: ${{ inputs.runner || 'ubuntu-latest' }}
steps:
- name: Reduce ASLR entropy for tsan
run: sudo sysctl -w vm.mmap_rnd_bits=28
- name: Cache Object Files
uses: actions/cache@v4
with:
Expand Down Expand Up @@ -130,8 +128,6 @@ jobs:
flags: '--buildtype=debugoptimized -Denable-autodiff=true -Denable-normal=false -Dwith-mpi=disabled --warnlevel=3 --werror'
runs-on: ${{ inputs.runner || 'ubuntu-latest' }}
steps:
- name: Reduce ASLR entropy for asan
run: sudo sysctl -w vm.mmap_rnd_bits=28
- name: Cache Object Files
uses: actions/cache@v4
with:
Expand Down Expand Up @@ -229,8 +225,6 @@ jobs:
matrix:
testscript: ['hybrid_regression.py', 'hybrid_regression_AD.py']
steps:
- name: Reduce ASLR entropy for tsan
run: sudo sysctl -w vm.mmap_rnd_bits=28
- name: Pre Cleanup
uses: docker://ghcr.io/su2code/su2/test-su2-tsan:240320-1536
with:
Expand Down Expand Up @@ -276,8 +270,6 @@ jobs:
matrix:
testscript: ['serial_regression.py', 'serial_regression_AD.py']
steps:
- name: Reduce ASLR entropy for asan
run: sudo sysctl -w vm.mmap_rnd_bits=28
- name: Pre Cleanup
uses: docker://ghcr.io/su2code/su2/test-su2-asan:240320-1536
with:
Expand Down
3 changes: 1 addition & 2 deletions Common/include/CConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4335,8 +4335,7 @@ class CConfig {
array<su2double,4> GetNewtonKrylovDblParam(void) const { return NK_DblParam; }

/*!
* \brief Get the relaxation coefficient of the linear solver for the implicit formulation.
* \return relaxation coefficient of the linear solver for the implicit formulation.
* \brief Returns the Roe kappa (multipler of the dissipation term).
*/
su2double GetRoe_Kappa(void) const { return Roe_Kappa; }

Expand Down
5 changes: 0 additions & 5 deletions Common/src/CConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3487,11 +3487,6 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i
SU2_MPI::Error("COMPRESSIBILITY-WILCOX only supported for SOLVER= RANS", CURRENT_FUNCTION);
}

/*--- Check if turbulence model can be used for AXISYMMETRIC case---*/
if (Axisymmetric && Kind_Turb_Model != TURB_MODEL::NONE && Kind_Turb_Model != TURB_MODEL::SST){
SU2_MPI::Error("Axisymmetry is currently only supported for KIND_TURB_MODEL chosen as SST", CURRENT_FUNCTION);
}

/*--- Postprocess LM_OPTIONS into structure. ---*/
if (Kind_Trans_Model == TURB_TRANS_MODEL::LM) {
lmParsedOptions = ParseLMOptions(LM_Options, nLM_Options, rank, Kind_Turb_Model);
Expand Down
4 changes: 2 additions & 2 deletions SU2_CFD/include/numerics/flow/convection/hllc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class CUpwHLLC_Flow final : public CNumerics {

su2double sq_velRoe, RoeDensity, RoeEnthalpy, RoeSoundSpeed, RoeProjVelocity, ProjInterfaceVel;

su2double sL, sR, sM, pStar, EStar, rhoSL, rhoSR, Rrho, kappa;
su2double sL, sR, sM, pStar, EStar, rhoSL, rhoSR, Rrho;

su2double Omega, RHO, OmegaSM;
su2double *dSm_dU, *dPI_dU, *drhoStar_dU, *dpStar_dU, *dEStar_dU;
Expand Down Expand Up @@ -102,7 +102,7 @@ class CUpwGeneralHLLC_Flow final : public CNumerics {
su2double sq_velRoe, RoeDensity, RoeEnthalpy, RoeSoundSpeed, RoeProjVelocity, ProjInterfaceVel;
su2double Kappa_i, Kappa_j, Chi_i, Chi_j, RoeKappa, RoeChi, RoeKappaStaticEnthalpy;

su2double sL, sR, sM, pStar, EStar, rhoSL, rhoSR, Rrho, kappa;
su2double sL, sR, sM, pStar, EStar, rhoSL, rhoSR, Rrho;

su2double Omega, RHO, OmegaSM;
su2double *dSm_dU, *dPI_dU, *drhoStar_dU, *dpStar_dU, *dEStar_dU;
Expand Down
49 changes: 49 additions & 0 deletions SU2_CFD/include/numerics/turbulent/turb_sources.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,41 @@ class CSourceBase_TurbSA : public CNumerics {

const FlowIndices idx; /*!< \brief Object to manage the access to the flow primitives. */
const SA_ParsedOptions options; /*!< \brief Struct with SA options. */
const bool axisymmetric = false;

bool transition_LM;

/*!
* \brief Add contribution from diffusion due to axisymmetric formulation to 2D residual
*/
inline void ResidualAxisymmetricDiffusion(su2double sigma) {
if (Coord_i[1] < EPS) return;

const su2double yinv = 1.0 / Coord_i[1];
const su2double& nue = ScalarVar_i[0];

const auto& density = V_i[idx.Density()];
const auto& laminar_viscosity = V_i[idx.LaminarViscosity()];

const su2double nu = laminar_viscosity/density;

su2double nu_e;

if (options.version == SA_OPTIONS::NEG && nue < 0.0) {
const su2double cn1 = 16.0;
const su2double Xi = nue / nu;
const su2double fn = (cn1 + Xi*Xi*Xi) / (cn1 - Xi*Xi*Xi);
nu_e = nu + fn * nue;
} else {
nu_e = nu + nue;
}

/* Diffusion source term */
const su2double dv_axi = (1.0/sigma)*nu_e*ScalarVar_Grad_i[0][1];

Residual += yinv * dv_axi * Volume;
}

public:
/*!
* \brief Constructor of the class.
Expand All @@ -90,6 +122,7 @@ class CSourceBase_TurbSA : public CNumerics {
: CNumerics(nDim, 1, config),
idx(nDim, config->GetnSpecies()),
options(config->GetSAParsedOptions()),
axisymmetric(config->GetAxisymmetric()),
transition_LM(config->GetKind_Trans_Model() == TURB_TRANS_MODEL::LM) {
/*--- Setup the Jacobian pointer, we need to return su2double** but we know
* the Jacobian is 1x1 so we use this trick to avoid heap allocation. ---*/
Expand Down Expand Up @@ -217,6 +250,9 @@ class CSourceBase_TurbSA : public CNumerics {
SourceTerms::get(ScalarVar_i[0], var, Production, Destruction, CrossProduction, Jacobian_i[0]);

Residual = (Production - Destruction + CrossProduction) * Volume;

if (axisymmetric) ResidualAxisymmetricDiffusion(var.sigma);

Jacobian_i[0] *= Volume;
}

Expand Down Expand Up @@ -520,6 +556,19 @@ class CCompressibilityCorrection final : public ParentClass {
const su2double d_CompCorrection = 2.0 * c5 * ScalarVar_i[0] / pow(sound_speed, 2) * aux_cc * Volume;
const su2double CompCorrection = 0.5 * ScalarVar_i[0] * d_CompCorrection;

/*--- Axisymmetric contribution ---*/
if (this->axisymmetric && this->Coord_i[1] > EPS) {
const su2double yinv = 1.0 / this->Coord_i[1];
const su2double nue = ScalarVar_i[0];
const su2double v = V_i[idx.Velocity() + 1];

const su2double d_axiCorrection = 2.0 * c5 * nue * pow(v * yinv / sound_speed, 2) * Volume;
const su2double axiCorrection = 0.5 * nue * d_axiCorrection;

this->Residual -= axiCorrection;
this->Jacobian_i[0] -= d_axiCorrection;
}

this->Residual -= CompCorrection;
this->Jacobian_i[0] -= d_CompCorrection;

Expand Down
15 changes: 7 additions & 8 deletions SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1099,22 +1099,21 @@ class CFVMFlowSolverBase : public CSolver {
/*!
* \brief Store of a set of provided inlet profile values at a vertex.
* \param[in] val_inlet - vector containing the inlet values for the current vertex.
* \param[in] iMarker - Surface marker where the coefficient is computed.
* \param[in] iMarker - Index of the surface marker.
* \param[in] iVertex - Vertex of the marker <i>iMarker</i> where the inlet is being set.
*/
void SetInletAtVertex(const su2double* val_inlet, unsigned short iMarker, unsigned long iVertex) final;

/*!
* \brief Get the set of value imposed at an inlet.
* \param[in] val_inlet - vector returning the inlet values for the current vertex.
* \param[in] val_inlet_point - Node index where the inlet is being set.
* \param[in] val_kind_marker - Enumerated type for the particular inlet type.
* \brief Get the set of values imposed at an inlet.
* \param[in] iMarker - Index of the surface marker.
* \param[in] iVertex - Vertex of the marker <i>iMarker</i> where the inlet is being set.
* \param[in] geometry - Geometrical definition of the problem.
* \param config - Definition of the particular problem.
* \param[in,out] val_inlet - vector returning the inlet values for the current vertex.
* \return Value of the face area at the vertex.
*/
su2double GetInletAtVertex(su2double* val_inlet, unsigned long val_inlet_point, unsigned short val_kind_marker,
string val_marker, const CGeometry* geometry, const CConfig* config) const final;
su2double GetInletAtVertex(unsigned short iMarker, unsigned long iVertex,
const CGeometry* geometry, su2double* val_inlet) const final;

/*!
* \author T. Kattmann
Expand Down
79 changes: 27 additions & 52 deletions SU2_CFD/include/solvers/CFVMFlowSolverBase.inl
Original file line number Diff line number Diff line change
Expand Up @@ -722,73 +722,48 @@ void CFVMFlowSolverBase<V, R>::SetInletAtVertex(const su2double* val_inlet, unsi
}

template <class V, ENUM_REGIME R>
su2double CFVMFlowSolverBase<V, R>::GetInletAtVertex(su2double* val_inlet, unsigned long val_inlet_point,
unsigned short val_kind_marker, string val_marker,
const CGeometry* geometry, const CConfig* config) const {
/*--- Local variables ---*/

unsigned short iMarker, iDim;
unsigned long iPoint, iVertex;
su2double Area = 0.0;
su2double Normal[3] = {0.0, 0.0, 0.0};

/*--- Alias positions within inlet file for readability ---*/

unsigned short T_position = nDim;
unsigned short P_position = nDim + 1;
unsigned short FlowDir_position = nDim + 2;

if (val_kind_marker == INLET_FLOW) {
for (iMarker = 0; iMarker < config->GetnMarker_All(); iMarker++) {
if ((config->GetMarker_All_KindBC(iMarker) == INLET_FLOW) &&
(config->GetMarker_All_TagBound(iMarker) == val_marker)) {
for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) {
iPoint = geometry->vertex[iMarker][iVertex]->GetNode();

if (iPoint == val_inlet_point) {
/*-- Compute boundary face area for this vertex. ---*/

geometry->vertex[iMarker][iVertex]->GetNormal(Normal);
Area = GeometryToolbox::Norm(nDim, Normal);

/*--- Access and store the inlet variables for this vertex. ---*/

val_inlet[T_position] = Inlet_Ttotal[iMarker][iVertex];
val_inlet[P_position] = Inlet_Ptotal[iMarker][iVertex];
for (iDim = 0; iDim < nDim; iDim++) {
val_inlet[FlowDir_position + iDim] = Inlet_FlowDir[iMarker][iVertex][iDim];
}

/*--- Exit once we find the point. ---*/

return Area;
}
}
}
}
su2double CFVMFlowSolverBase<V, R>::GetInletAtVertex(unsigned short iMarker, unsigned long iVertex,
const CGeometry* geometry, su2double* val_inlet) const {
const auto T_position = nDim;
const auto P_position = nDim + 1;
const auto FlowDir_position = nDim + 2;
val_inlet[T_position] = Inlet_Ttotal[iMarker][iVertex];
val_inlet[P_position] = Inlet_Ptotal[iMarker][iVertex];
for (unsigned short iDim = 0; iDim < nDim; iDim++) {
val_inlet[FlowDir_position + iDim] = Inlet_FlowDir[iMarker][iVertex][iDim];
}

/*--- If we don't find a match, then the child point is not on the
current inlet boundary marker. Return zero area so this point does
not contribute to the restriction operator and continue. ---*/
/*--- Compute boundary face area for this vertex. ---*/

return Area;
su2double Normal[MAXNDIM] = {0.0};
geometry->vertex[iMarker][iVertex]->GetNormal(Normal);
return GeometryToolbox::Norm(nDim, Normal);
}

template <class V, ENUM_REGIME R>
void CFVMFlowSolverBase<V, R>::SetUniformInlet(const CConfig* config, unsigned short iMarker) {
if (config->GetMarker_All_KindBC(iMarker) == INLET_FLOW) {
string Marker_Tag = config->GetMarker_All_TagBound(iMarker);
su2double p_total = config->GetInletPtotal(Marker_Tag);
su2double t_total = config->GetInletTtotal(Marker_Tag);
auto flow_dir = config->GetInletFlowDir(Marker_Tag);
const string Marker_Tag = config->GetMarker_All_TagBound(iMarker);
const su2double p_total = config->GetInletPtotal(Marker_Tag);
const su2double t_total = config->GetInletTtotal(Marker_Tag);
const su2double* flow_dir = config->GetInletFlowDir(Marker_Tag);

for (unsigned long iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) {
Inlet_Ttotal[iMarker][iVertex] = t_total;
Inlet_Ptotal[iMarker][iVertex] = p_total;
for (unsigned short iDim = 0; iDim < nDim; iDim++) Inlet_FlowDir[iMarker][iVertex][iDim] = flow_dir[iDim];
}
} else if (config->GetMarker_All_KindBC(iMarker) == SUPERSONIC_INLET) {
const string Marker_Tag = config->GetMarker_All_TagBound(iMarker);
const su2double p = config->GetInlet_Pressure(Marker_Tag);
const su2double t = config->GetInlet_Temperature(Marker_Tag);
const su2double* vel = config->GetInlet_Velocity(Marker_Tag);

for (unsigned long iVertex = 0; iVertex < nVertex[iMarker]; iVertex++) {
Inlet_Ttotal[iMarker][iVertex] = t;
Inlet_Ptotal[iMarker][iVertex] = p;
for (unsigned short iDim = 0; iDim < nDim; iDim++) Inlet_FlowDir[iMarker][iVertex][iDim] = vel[iDim];
}
} else {
/*--- For now, non-inlets just get set to zero. In the future, we
can do more customization for other boundary types here. ---*/
Expand Down
21 changes: 8 additions & 13 deletions SU2_CFD/include/solvers/CSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2895,7 +2895,7 @@ class CSolver {
* \param[in] config - Definition of the particular problem.
* \param[in] iMarker - Surface marker where the coefficient is computed.
*/
inline virtual void SetUniformInlet(const CConfig* config, unsigned short iMarker) {};
inline virtual void SetUniformInlet(const CConfig* config, unsigned short iMarker) {}

/*!
* \brief A virtual member
Expand All @@ -2905,23 +2905,18 @@ class CSolver {
*/
inline virtual void SetInletAtVertex(const su2double *val_inlet,
unsigned short iMarker,
unsigned long iVertex) { };
unsigned long iVertex) { }

/*!
* \brief A virtual member
* \param[in] val_inlet - vector returning the inlet values for the current vertex.
* \param[in] val_inlet_point - Node index where the inlet is being set.
* \param[in] val_kind_marker - Enumerated type for the particular inlet type.
* \brief Get the set of values imposed at an inlet.
* \param[in] iMarker - Index of the surface marker.
* \param[in] iVertex - Vertex of the marker <i>iMarker</i> where the inlet is being set.
* \param[in] geometry - Geometrical definition of the problem.
* \param config - Definition of the particular problem.
* \param[in,out] val_inlet - vector returning the inlet values for the current vertex.
* \return Value of the face area at the vertex.
*/
inline virtual su2double GetInletAtVertex(su2double *val_inlet,
unsigned long val_inlet_point,
unsigned short val_kind_marker,
string val_marker,
const CGeometry *geometry,
const CConfig *config) const { return 0; }
inline virtual su2double GetInletAtVertex(unsigned short iMarker, unsigned long iVertex,
const CGeometry* geometry, su2double* val_inlet) const { return 0; }

/*!
* \brief Update the multi-grid structure for the customized boundary conditions.
Expand Down
13 changes: 6 additions & 7 deletions SU2_CFD/include/solvers/CSpeciesSolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,15 @@ class CSpeciesSolver : public CScalarSolver<CSpeciesVariable> {
void SetInletAtVertex(const su2double* val_inlet, unsigned short iMarker, unsigned long iVertex) override;

/*!
* \brief Get the set of value imposed at an inlet.
* \param[in] val_inlet - vector returning the inlet values for the current vertex.
* \param[in] val_inlet_point - Node index where the inlet is being set.
* \param[in] val_kind_marker - Enumerated type for the particular inlet type.
* \brief Get the set of values imposed at an inlet.
* \param[in] iMarker - Index of the surface marker.
* \param[in] iVertex - Vertex of the marker <i>iMarker</i> where the inlet is being set.
* \param[in] geometry - Geometrical definition of the problem.
* \param config - Definition of the particular problem.
* \param[in,out] val_inlet - vector returning the inlet values for the current vertex.
* \return Value of the face area at the vertex.
*/
su2double GetInletAtVertex(su2double* val_inlet, unsigned long val_inlet_point, unsigned short val_kind_marker,
string val_marker, const CGeometry* geometry, const CConfig* config) const override;
su2double GetInletAtVertex(unsigned short iMarker, unsigned long iVertex,
const CGeometry* geometry, su2double* val_inlet) const override;

/*!
* \brief Set a uniform inlet profile
Expand Down
17 changes: 6 additions & 11 deletions SU2_CFD/include/solvers/CTurbSASolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,20 +345,15 @@ class CTurbSASolver final : public CTurbSolver {
unsigned long iVertex) override;

/*!
* \brief Get the set of value imposed at an inlet.
* \param[in] val_inlet - vector returning the inlet values for the current vertex.
* \param[in] val_inlet_point - Node index where the inlet is being set.
* \param[in] val_kind_marker - Enumerated type for the particular inlet type.
* \brief Get the set of values imposed at an inlet.
* \param[in] iMarker - Index of the surface marker.
* \param[in] iVertex - Vertex of the marker <i>iMarker</i> where the inlet is being set.
* \param[in] geometry - Geometrical definition of the problem.
* \param config - Definition of the particular problem.
* \param[in,out] val_inlet - vector returning the inlet values for the current vertex.
* \return Value of the face area at the vertex.
*/
su2double GetInletAtVertex(su2double *val_inlet,
unsigned long val_inlet_point,
unsigned short val_kind_marker,
string val_marker,
const CGeometry *geometry,
const CConfig *config) const override;
su2double GetInletAtVertex(unsigned short iMarker, unsigned long iVertex,
const CGeometry* geometry, su2double* val_inlet) const override;

/*!
* \brief Set a uniform inlet profile
Expand Down
Loading

0 comments on commit 0a1d540

Please sign in to comment.