@@ -2443,6 +2443,31 @@ void CDriver::InitializeInterface(CConfig **config, CSolver***** solver, CGeomet
24432443 interpolation[donor][target] = unique_ptr<CInterpolator>(CInterpolatorFactory::CreateInterpolator (
24442444 geometry, config, interpolation[target][donor].get (), donor, target));
24452445
2446+ /* --- Helpers with logic to create CHT interfaces. ---*/
2447+
2448+ auto GetChtInterfaceType = [donor, target, config](bool heat_donor, bool heat_target) {
2449+ if (heat_donor && heat_target) return CONJUGATE_HEAT_SS ;
2450+
2451+ const auto fluidZone = heat_target ? donor : target;
2452+ if (config[fluidZone]->GetEnergy_Equation () ||
2453+ config[fluidZone]->GetKind_Regime () == ENUM_REGIME ::COMPRESSIBLE ||
2454+ config[fluidZone]->GetKind_FluidModel () == ENUM_FLUIDMODEL ::FLUID_FLAMELET ) {
2455+ return heat_target ? CONJUGATE_HEAT_FS : CONJUGATE_HEAT_SF ;
2456+ } else if (config[fluidZone]->GetWeakly_Coupled_Heat ()) {
2457+ return heat_target ? CONJUGATE_HEAT_WEAKLY_FS : CONJUGATE_HEAT_WEAKLY_SF ;
2458+ }
2459+ return NO_TRANSFER ;
2460+ };
2461+
2462+ auto MakeChtInterface = [&](const auto type) {
2463+ if (type != NO_TRANSFER ) {
2464+ if (rank == MASTER_NODE ) cout << " Conjugate heat variables." << endl;
2465+ return new CConjugateHeatInterface (4 , 0 );
2466+ }
2467+ if (rank == MASTER_NODE ) cout << " NO heat variables." << endl;
2468+ return static_cast <CConjugateHeatInterface*>(nullptr );
2469+ };
2470+
24462471 /* --- The type of variables transferred depends on the donor/target physics. ---*/
24472472
24482473 const bool heat_target = config[target]->GetHeatProblem ();
@@ -2467,16 +2492,26 @@ void CDriver::InitializeInterface(CConfig **config, CSolver***** solver, CGeomet
24672492 interface[donor][target] = new CDiscAdjFlowTractionInterface (nDim, nConst, config[donor], conservative);
24682493 }
24692494 if (rank == MASTER_NODE ) cout << " fluid " << (conservative? " forces." : " tractions." ) << endl;
2495+
2496+ if (config[target]->GetWeakly_Coupled_Heat ()) {
2497+ interface[donor][target]->NextInterfaceType = GetChtInterfaceType (false , true );
2498+ interface[donor][target]->NextInterface = MakeChtInterface (interface[donor][target]->NextInterfaceType );
2499+ }
24702500 }
24712501 else if (structural_donor && (fluid_target || heat_target)) {
24722502 if (solver_container[target][INST_0 ][MESH_0 ][MESH_SOL ] == nullptr ) {
24732503 SU2_MPI::Error (" Mesh deformation was not correctly specified for the fluid/heat zone.\n "
24742504 " Use DEFORM_MESH=YES, and setup MARKER_DEFORM_MESH=(...)" , CURRENT_FUNCTION );
24752505 }
24762506 interface_type = BOUNDARY_DISPLACEMENTS ;
2477- if (! config[donor]->GetTime_Domain ()) interface[donor][target] = new CDisplacementsInterface ( nDim, 0 ) ;
2478- else interface[donor][target] = new CDisplacementsInterface (2 *nDim , 0 );
2507+ const auto nVar = config[donor]->GetTime_Domain () ? 2 * nDim : nDim ;
2508+ interface[donor][target] = new CDisplacementsInterface (nVar , 0 );
24792509 if (rank == MASTER_NODE ) cout << " boundary displacements from the structural solver." << endl;
2510+
2511+ if (fluid_target && config[donor]->GetWeakly_Coupled_Heat ()) {
2512+ interface[donor][target]->NextInterfaceType = GetChtInterfaceType (true , false );
2513+ interface[donor][target]->NextInterface = MakeChtInterface (interface[donor][target]->NextInterfaceType );
2514+ }
24802515 }
24812516 else if (fluid_donor && fluid_target) {
24822517 /* --- Interface handling for turbomachinery applications. ---*/
@@ -2487,48 +2522,27 @@ void CDriver::InitializeInterface(CConfig **config, CSolver***** solver, CGeomet
24872522 interface_type = MIXING_PLANE ;
24882523 auto nVar = solver[donor][INST_0 ][MESH_0 ][FLOW_SOL ]->GetnVar ();
24892524 interface[donor][target] = new CMixingPlaneInterface (nVar, 0 );
2490- if (rank == MASTER_NODE ) cout << " using a mixing-plane interface from donor zone " << donor << " to target zone " << target << " ." << endl;
2525+ if (rank == MASTER_NODE ) cout << " Using a mixing-plane interface from donor zone " << donor << " to target zone " << target << " ." << endl;
24912526 break ;
24922527 }
24932528 case TURBO_INTERFACE_KIND ::FROZEN_ROTOR : {
24942529 auto nVar = solver[donor][INST_0 ][MESH_0 ][FLOW_SOL ]->GetnPrimVar ();
24952530 interface_type = SLIDING_INTERFACE ;
24962531 interface[donor][target] = new CSlidingInterface (nVar, 0 );
2497- if (rank == MASTER_NODE ) cout << " using a fluid interface interface from donor zone " << donor << " to target zone " << target << " ." << endl;
2532+ if (rank == MASTER_NODE ) cout << " Using a fluid interface interface from donor zone " << donor << " to target zone " << target << " ." << endl;
24982533 }
24992534 }
25002535 }
25012536 else {
25022537 auto nVar = solver[donor][INST_0 ][MESH_0 ][FLOW_SOL ]->GetnPrimVar ();
25032538 interface_type = SLIDING_INTERFACE ;
25042539 interface[donor][target] = new CSlidingInterface (nVar, 0 );
2505- if (rank == MASTER_NODE ) cout << " sliding interface." << endl;
2540+ if (rank == MASTER_NODE ) cout << " Sliding interface." << endl;
25062541 }
25072542 }
25082543 else if (heat_donor || heat_target) {
2509- if (heat_donor && heat_target){
2510- interface_type = CONJUGATE_HEAT_SS ;
2511-
2512- } else {
2513-
2514- const auto fluidZone = heat_target? donor : target;
2515- if (config[fluidZone]->GetEnergy_Equation () || (config[fluidZone]->GetKind_Regime () == ENUM_REGIME ::COMPRESSIBLE )
2516- || (config[fluidZone]->GetKind_FluidModel () == ENUM_FLUIDMODEL ::FLUID_FLAMELET ))
2517- interface_type = heat_target? CONJUGATE_HEAT_FS : CONJUGATE_HEAT_SF ;
2518- else if (config[fluidZone]->GetWeakly_Coupled_Heat ())
2519- interface_type = heat_target? CONJUGATE_HEAT_WEAKLY_FS : CONJUGATE_HEAT_WEAKLY_SF ;
2520- else
2521- interface_type = NO_TRANSFER ;
2522- }
2523-
2524- if (interface_type != NO_TRANSFER ) {
2525- auto nVar = 4 ;
2526- interface[donor][target] = new CConjugateHeatInterface (nVar, 0 );
2527- if (rank == MASTER_NODE ) cout << " conjugate heat variables." << endl;
2528- }
2529- else {
2530- if (rank == MASTER_NODE ) cout << " NO heat variables." << endl;
2531- }
2544+ interface_type = GetChtInterfaceType (heat_donor, heat_target);
2545+ interface[donor][target] = MakeChtInterface (interface_type);
25322546 }
25332547 else {
25342548 if (solver[donor][INST_0 ][MESH_0 ][FLOW_SOL ] == nullptr )
@@ -2537,7 +2551,7 @@ void CDriver::InitializeInterface(CConfig **config, CSolver***** solver, CGeomet
25372551 auto nVar = solver[donor][INST_0 ][MESH_0 ][FLOW_SOL ]->GetnVar ();
25382552 interface_type = CONSERVATIVE_VARIABLES ;
25392553 interface[donor][target] = new CConservativeVarsInterface (nVar, 0 );
2540- if (rank == MASTER_NODE ) cout << " generic conservative variables." << endl;
2554+ if (rank == MASTER_NODE ) cout << " Generic conservative variables." << endl;
25412555 }
25422556 }
25432557
0 commit comments