Skip to content

Commit efe8a67

Browse files
authored
Merge pull request #2096 from su2code/custom_temperature_inc_solver
Add python custom temperature and heat flux to incompressible solver
2 parents c3444c8 + f679db1 commit efe8a67

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

SU2_CFD/src/interfaces/cht/CConjugateHeatInterface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ void CConjugateHeatInterface::GetDonor_Variable(CSolver *donor_solution, CGeomet
7070
su2double conductivity_over_dist = 0.0;
7171

7272
const bool compressible_flow = (donor_config->GetKind_Regime() == ENUM_REGIME::COMPRESSIBLE);
73-
const bool incompressible_flow = (donor_config->GetKind_Regime() == ENUM_REGIME::INCOMPRESSIBLE) &&
73+
const bool incompressible_flow = (donor_config->GetKind_Regime() == ENUM_REGIME::INCOMPRESSIBLE) &&
7474
(donor_config->GetEnergy_Equation() || (donor_config->GetKind_FluidModel() == ENUM_FLUIDMODEL::FLUID_FLAMELET));
7575

7676
if (compressible_flow) {

SU2_CFD/src/solvers/CIncNSSolver.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ void CIncNSSolver::GetStreamwise_Periodic_Properties(const CGeometry *geometry,
219219

220220
const su2double FaceArea = GeometryToolbox::Norm(nDim, AreaNormal);
221221

222-
HeatFlow_Local += FaceArea * (-1.0) * Wall_HeatFlux/config->GetHeat_Flux_Ref();;
222+
HeatFlow_Local += FaceArea * (-1.0) * Wall_HeatFlux/config->GetHeat_Flux_Ref();
223223
} // loop Vertices
224224
} // loop Heatflux marker
225225
} // loop AllMarker
@@ -336,13 +336,13 @@ void CIncNSSolver::BC_Wall_Generic(const CGeometry *geometry, const CConfig *con
336336

337337
const bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT);
338338
const bool energy = config->GetEnergy_Equation();
339+
const bool py_custom = config->GetMarker_All_PyCustom(val_marker);
339340

340341
/*--- Variables for streamwise periodicity ---*/
341342
const bool streamwise_periodic = (config->GetKind_Streamwise_Periodic() != ENUM_STREAMWISE_PERIODIC::NONE);
342343
const bool streamwise_periodic_temperature = config->GetStreamwise_Periodic_Temperature();
343344
su2double Cp, thermal_conductivity, dot_product, scalar_factor;
344345

345-
346346
/*--- Identify the boundary by string name ---*/
347347

348348
const auto Marker_Tag = config->GetMarker_All_TagBound(val_marker);
@@ -426,6 +426,9 @@ void CIncNSSolver::BC_Wall_Generic(const CGeometry *geometry, const CConfig *con
426426
/*--- Apply a weak boundary condition for the energy equation.
427427
Compute the residual due to the prescribed heat flux. ---*/
428428

429+
if (py_custom) {
430+
Wall_HeatFlux = geometry->GetCustomBoundaryHeatFlux(val_marker, iVertex) / config->GetHeat_Flux_Ref();
431+
}
429432
LinSysRes(iPoint, nDim+1) -= Wall_HeatFlux*Area;
430433

431434
/*--- With streamwise periodic flow and heatflux walls an additional term is introduced in the boundary formulation ---*/
@@ -460,7 +463,9 @@ void CIncNSSolver::BC_Wall_Generic(const CGeometry *geometry, const CConfig *con
460463
break;
461464

462465
case ISOTHERMAL:
463-
466+
if (py_custom) {
467+
Twall = geometry->GetCustomBoundaryTemperature(val_marker, iVertex) / config->GetTemperature_Ref();
468+
}
464469
const auto Point_Normal = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor();
465470

466471
/*--- Get coordinates of i & nearest normal and compute distance ---*/

TestCases/py_wrapper/custom_heat_flux/run_ad.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def ApplyHeatFlux(time, driver, marker_ids):
9292
for marker_id in marker_ids:
9393
if marker_id < 0:
9494
continue
95-
hf = (-1, 0)[time > 0.2]
95+
hf = (-1 * 2700 * 870, 0)[time > 0.2]
9696
for i_vertex in range(driver.GetNumberMarkerNodes(marker_id)):
9797
driver.SetMarkerCustomNormalHeatFlux(marker_id, i_vertex, hf)
9898

0 commit comments

Comments
 (0)