From b860fd19559712db7a541668a245e4c185da228b Mon Sep 17 00:00:00 2001 From: EvertBunschoten Date: Mon, 3 Jul 2023 12:28:09 +0200 Subject: [PATCH 1/4] Fixed communication between species and heat solver for CHT simulations --- SU2_CFD/src/drivers/CDriver.cpp | 3 ++- SU2_CFD/src/interfaces/cht/CConjugateHeatInterface.cpp | 3 ++- SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/SU2_CFD/src/drivers/CDriver.cpp b/SU2_CFD/src/drivers/CDriver.cpp index 5b85ead935e..c8ead183730 100644 --- a/SU2_CFD/src/drivers/CDriver.cpp +++ b/SU2_CFD/src/drivers/CDriver.cpp @@ -2497,7 +2497,8 @@ void CDriver::InitializeInterface(CConfig **config, CSolver***** solver, CGeomet const auto fluidZone = heat_target? donor : target; - if (config[fluidZone]->GetEnergy_Equation() || (config[fluidZone]->GetKind_Regime() == ENUM_REGIME::COMPRESSIBLE)) + if (config[fluidZone]->GetEnergy_Equation() || (config[fluidZone]->GetKind_Regime() == ENUM_REGIME::COMPRESSIBLE) + || (config[fluidZone]->GetKind_FluidModel() == ENUM_FLUIDMODEL::FLUID_FLAMELET)) interface_type = heat_target? CONJUGATE_HEAT_FS : CONJUGATE_HEAT_SF; else if (config[fluidZone]->GetWeakly_Coupled_Heat()) interface_type = heat_target? CONJUGATE_HEAT_WEAKLY_FS : CONJUGATE_HEAT_WEAKLY_SF; diff --git a/SU2_CFD/src/interfaces/cht/CConjugateHeatInterface.cpp b/SU2_CFD/src/interfaces/cht/CConjugateHeatInterface.cpp index 594863bb9a1..a1400ad0799 100644 --- a/SU2_CFD/src/interfaces/cht/CConjugateHeatInterface.cpp +++ b/SU2_CFD/src/interfaces/cht/CConjugateHeatInterface.cpp @@ -70,7 +70,8 @@ void CConjugateHeatInterface::GetDonor_Variable(CSolver *donor_solution, CGeomet su2double conductivity_over_dist = 0.0; const bool compressible_flow = (donor_config->GetKind_Regime() == ENUM_REGIME::COMPRESSIBLE); - const bool incompressible_flow = (donor_config->GetKind_Regime() == ENUM_REGIME::INCOMPRESSIBLE) && donor_config->GetEnergy_Equation(); + const bool incompressible_flow = (donor_config->GetKind_Regime() == ENUM_REGIME::INCOMPRESSIBLE) && + (donor_config->GetEnergy_Equation() || (donor_config->GetKind_FluidModel() == ENUM_FLUIDMODEL::FLUID_FLAMELET)); if (compressible_flow) { diff --git a/SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp b/SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp index f79b12b232f..9c3ce1e5e1f 100644 --- a/SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp +++ b/SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp @@ -427,7 +427,7 @@ void CSpeciesFlameletSolver::BC_Isothermal_Wall_Generic(CGeometry* geometry, CSo for (unsigned long iVertex = 0; iVertex < geometry->nVertex[val_marker]; iVertex++) { unsigned long iPoint = geometry->vertex[val_marker][iVertex]->GetNode(); - if (cht_mode) temp_wall = GetConjugateHeatVariable(val_marker, iVertex, 0); + if (cht_mode) temp_wall = solver_container[FLOW_SOL]->GetConjugateHeatVariable(val_marker, iVertex, 0); /*--- Check if the node belongs to the domain (i.e., not a halo node). ---*/ From bd44854fbbdb36a20f24da9fb743ecc4b38cd287 Mon Sep 17 00:00:00 2001 From: EvertBunschoten Date: Tue, 4 Jul 2023 09:53:53 +0200 Subject: [PATCH 2/4] Removed conjugate heat variables from speciesFlameletSolver as they're not necessary --- SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp b/SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp index 9c3ce1e5e1f..6b1a77e281d 100644 --- a/SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp +++ b/SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp @@ -65,13 +65,6 @@ CSpeciesFlameletSolver::CSpeciesFlameletSolver(CGeometry* geometry, CConfig* con for (unsigned long i = 0; i < M; ++i) X[i].resize(N[i], P) = su2double(0.0); }; - /*--- Store the values of the temperature and the heat flux density at the boundaries, - used for coupling with a solid donor cell. ---*/ - constexpr auto n_conjugate_var = 4u; - - Alloc3D(nMarker, nVertex, n_conjugate_var, conjugate_var); - for (auto& x : conjugate_var) x = config->GetTemperature_FreeStreamND(); - /*--- Add the solver name. ---*/ SolverName = "FLAMELET"; } From 48b094afae24bbb92a7bf05662036f5b7f87869b Mon Sep 17 00:00:00 2001 From: EvertBunschoten Date: Tue, 4 Jul 2023 13:53:58 +0200 Subject: [PATCH 3/4] Implemented compatibility check for flamelet + weakly coupled heat --- .github/workflows/regression.yml | 2 +- Common/src/CConfig.cpp | 5 +++++ SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp | 7 ------- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index 76545cdb274..5b533bfd4e0 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -128,7 +128,7 @@ jobs: uses: docker://ghcr.io/su2code/su2/test-su2:230225-2136 with: # -t -c - args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}} + args: -b ${{github.ref}} -t develop -c bug_fix_cht_flamelet -s ${{matrix.testscript}} - name: Cleanup uses: docker://ghcr.io/su2code/su2/test-su2:230225-2136 with: diff --git a/Common/src/CConfig.cpp b/Common/src/CConfig.cpp index ace96e28cbb..3a28e257e5e 100644 --- a/Common/src/CConfig.cpp +++ b/Common/src/CConfig.cpp @@ -3947,6 +3947,11 @@ void CConfig::SetPostprocessing(SU2_COMPONENT val_software, unsigned short val_i SU2_MPI::Error("The use of FLUID_FLAMELET requires the VISCOSITY_MODEL option to be FLAMELET", CURRENT_FUNCTION); } + + if (Weakly_Coupled_Heat) { + SU2_MPI::Error("The use of FLUID_FLAMELET is incompatible with WEAKLY_COUPLED_HEAT in the same zone.", + CURRENT_FUNCTION); + } } /*--- Check for Measurement System ---*/ diff --git a/SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp b/SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp index 6b1a77e281d..d6dc98a9323 100644 --- a/SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp +++ b/SU2_CFD/src/solvers/CSpeciesFlameletSolver.cpp @@ -58,13 +58,6 @@ CSpeciesFlameletSolver::CSpeciesFlameletSolver(CGeometry* geometry, CConfig* con Max_CFL_Local = CFL; Avg_CFL_Local = CFL; - /*--- Allocates a 3D array with variable "middle" sizes and init to 0. ---*/ - - auto Alloc3D = [](unsigned long M, const vector& N, unsigned long P, vector& X) { - X.resize(M); - for (unsigned long i = 0; i < M; ++i) X[i].resize(N[i], P) = su2double(0.0); - }; - /*--- Add the solver name. ---*/ SolverName = "FLAMELET"; } From 96baee23262bff43f0c162079aa587247a7a1eef Mon Sep 17 00:00:00 2001 From: Pedro Gomes <38071223+pcarruscag@users.noreply.github.com> Date: Thu, 6 Jul 2023 10:58:48 -0700 Subject: [PATCH 4/4] Update .github/workflows/regression.yml --- .github/workflows/regression.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index b7ea7b00800..0bb7110fd97 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -128,7 +128,7 @@ jobs: uses: docker://ghcr.io/su2code/su2/test-su2:230225-2136 with: # -t -c - args: -b ${{github.ref}} -t develop -c bug_fix_cht_flamelet -s ${{matrix.testscript}} + args: -b ${{github.ref}} -t develop -c develop -s ${{matrix.testscript}} - name: Cleanup uses: docker://ghcr.io/su2code/su2/test-su2:230225-2136 with: