@@ -2656,6 +2656,8 @@ CDriver::~CDriver(void) {}
26562656
26572657void CDriver::Print_DirectResidual (RECORDING kind_recording) {
26582658
2659+ if (!(rank == MASTER_NODE && kind_recording == RECORDING::SOLUTION_VARIABLES)) return ;
2660+
26592661 const bool multizone = config_container[ZONE_0]->GetMultizone_Problem ();
26602662
26612663 /* --- Helper lambda func to return lenghty [iVar][iZone] string. ---*/
@@ -2668,103 +2670,93 @@ void CDriver::Print_DirectResidual(RECORDING kind_recording) {
26682670
26692671 /* --- Print residuals in the first iteration ---*/
26702672
2671- if (rank == MASTER_NODE && kind_recording == RECORDING::SOLUTION_VARIABLES) {
2673+ const unsigned short fieldWidth = 15 ;
2674+ PrintingToolbox::CTablePrinter RMSTable (&std::cout);
26722675
2673- const unsigned short fieldWidth = 15 ;
2674- PrintingToolbox::CTablePrinter RMSTable (&std::cout);
2676+ /* --- The CTablePrinter requires two sweeps:
2677+ *--- 0. Add the colum names (addVals=0=false) plus CTablePrinter.PrintHeader()
2678+ *--- 1. Add the RMS-residual values (addVals=1=true) plus CTablePrinter.PrintFooter() ---*/
2679+ for (int addVals = 0 ; addVals < 2 ; addVals++) {
26752680
2676- /* --- The CTablePrinter requires two sweeps:
2677- *--- 0. Add the colum names (addVals=0=false) plus CTablePrinter.PrintHeader()
2678- *--- 1. Add the RMS-residual values (addVals=1=true) plus CTablePrinter.PrintFooter() ---*/
2679- for (int addVals = 0 ; addVals < 2 ; addVals++) {
2681+ for (unsigned short iZone = 0 ; iZone < nZone; iZone++) {
26802682
2681- for (unsigned short iZone = 0 ; iZone < nZone; iZone++) {
2683+ auto solvers = solver_container[iZone][INST_0][MESH_0];
2684+ auto configs = config_container[iZone];
26822685
2683- auto solvers = solver_container[iZone][INST_0][MESH_0];
2684- auto configs = config_container[iZone];
2686+ /* --- Note: the FEM-Flow solvers are availalbe for disc. adjoint runs only for SingleZone. --- */
2687+ if (configs-> GetFluidProblem () || configs-> GetFEMSolver ()) {
26852688
2686- /* --- Note: the FEM-Flow solvers are availalbe for disc. adjoint runs only for SingleZone. ---*/
2687- if (configs->GetFluidProblem () || configs->GetFEMSolver ()) {
2689+ for (unsigned short iVar = 0 ; iVar < solvers[FLOW_SOL]->GetnVar (); iVar++) {
2690+ if (!addVals)
2691+ RMSTable.AddColumn (" rms_Flow" + iVar_iZone2string (iVar, iZone), fieldWidth);
2692+ else
2693+ RMSTable << log10 (solvers[FLOW_SOL]->GetRes_RMS (iVar));
2694+ }
26882695
2689- for (unsigned short iVar = 0 ; iVar < solvers[FLOW_SOL]->GetnVar (); iVar++) {
2696+ if (configs->GetKind_Turb_Model () != NONE && !configs->GetFrozen_Visc_Disc ()) {
2697+ for (unsigned short iVar = 0 ; iVar < solvers[TURB_SOL]->GetnVar (); iVar++) {
26902698 if (!addVals)
2691- RMSTable.AddColumn (" rms_Flow " + iVar_iZone2string (iVar, iZone), fieldWidth);
2699+ RMSTable.AddColumn (" rms_Turb " + iVar_iZone2string (iVar, iZone), fieldWidth);
26922700 else
2693- RMSTable << log10 (solvers[FLOW_SOL ]->GetRes_RMS (iVar));
2701+ RMSTable << log10 (solvers[TURB_SOL ]->GetRes_RMS (iVar));
26942702 }
2703+ }
26952704
2696- if (configs->GetKind_Turb_Model () != NONE && !configs->GetFrozen_Visc_Disc ()) {
2697- for (unsigned short iVar = 0 ; iVar < solvers[TURB_SOL]->GetnVar (); iVar++) {
2698- if (!addVals)
2699- RMSTable.AddColumn (" rms_Turb" + iVar_iZone2string (iVar, iZone), fieldWidth);
2700- else
2701- RMSTable << log10 (solvers[TURB_SOL]->GetRes_RMS (iVar));
2702- }
2703- }
2705+ if (!multizone && configs->GetWeakly_Coupled_Heat ()){
2706+ if (!addVals) RMSTable.AddColumn (" rms_Heat" + iVar_iZone2string (0 , iZone), fieldWidth);
2707+ else RMSTable << log10 (solvers[HEAT_SOL]->GetRes_RMS (0 ));
2708+ }
27042709
2705- if (!multizone && configs->GetWeakly_Coupled_Heat ()){
2706- if (!addVals) RMSTable.AddColumn (" rms_Heat " + iVar_iZone2string (0 , iZone), fieldWidth);
2707- else RMSTable << log10 (solvers[HEAT_SOL ]->GetRes_RMS (0 ));
2708- }
2710+ if (configs->AddRadiation ()) {
2711+ if (!addVals) RMSTable.AddColumn (" rms_Rad " + iVar_iZone2string (0 , iZone), fieldWidth);
2712+ else RMSTable << log10 (solvers[RAD_SOL ]->GetRes_RMS (0 ));
2713+ }
27092714
2710- if (configs->AddRadiation ()) {
2711- if (!addVals) RMSTable.AddColumn (" rms_Rad" + iVar_iZone2string (0 , iZone), fieldWidth);
2712- else RMSTable << log10 (solvers[RAD_SOL]->GetRes_RMS (0 ));
2713- }
2715+ }
2716+ else if (configs->GetStructuralProblem ()) {
27142717
2718+ if (configs->GetGeometricConditions () == STRUCT_DEFORMATION::LARGE){
2719+ if (!addVals) {
2720+ RMSTable.AddColumn (" UTOL-A" , fieldWidth);
2721+ RMSTable.AddColumn (" RTOL-A" , fieldWidth);
2722+ RMSTable.AddColumn (" ETOL-A" , fieldWidth);
2723+ }
2724+ else {
2725+ RMSTable << log10 (solvers[FEA_SOL]->GetRes_FEM (0 ))
2726+ << log10 (solvers[FEA_SOL]->GetRes_FEM (1 ))
2727+ << log10 (solvers[FEA_SOL]->GetRes_FEM (2 ));
2728+ }
27152729 }
2716- else if (configs->GetStructuralProblem ()) {
2717-
2718- if (configs->GetGeometricConditions () == STRUCT_DEFORMATION::LARGE){
2719- if (!addVals) {
2720- RMSTable.AddColumn (" UTOL-A" , fieldWidth);
2721- RMSTable.AddColumn (" RTOL-A" , fieldWidth);
2722- RMSTable.AddColumn (" ETOL-A" , fieldWidth);
2723- }
2724- else {
2725- RMSTable << log10 (solvers[FEA_SOL]->GetRes_FEM (0 ))
2726- << log10 (solvers[FEA_SOL]->GetRes_FEM (1 ))
2727- << log10 (solvers[FEA_SOL]->GetRes_FEM (2 ));
2728- }
2730+ else {
2731+ if (!addVals) {
2732+ RMSTable.AddColumn (" log10[RMS Ux]" , fieldWidth);
2733+ RMSTable.AddColumn (" log10[RMS Uy]" , fieldWidth);
2734+ if (nDim == 3 ) RMSTable.AddColumn (" log10[RMS Uz]" , fieldWidth);
27292735 }
2730- else {
2731- if (!addVals) {
2732- RMSTable.AddColumn (" log10[RMS Ux]" , fieldWidth);
2733- RMSTable.AddColumn (" log10[RMS Uy]" , fieldWidth);
2734- if (nDim == 3 ) RMSTable.AddColumn (" log10[RMS Uz]" , fieldWidth);
2735- }
2736- else {
2737- RMSTable << log10 (solvers[FEA_SOL]->GetRes_FEM (0 ))
2738- << log10 (solvers[FEA_SOL]->GetRes_FEM (1 ));
2739- if (nDim == 3 ) RMSTable << log10 (solvers[FEA_SOL]->GetRes_FEM (2 ));
2740- }
2736+ else {
2737+ RMSTable << log10 (solvers[FEA_SOL]->GetRes_FEM (0 ))
2738+ << log10 (solvers[FEA_SOL]->GetRes_FEM (1 ));
2739+ if (nDim == 3 ) RMSTable << log10 (solvers[FEA_SOL]->GetRes_FEM (2 ));
27412740 }
2742-
27432741 }
2744- else if (configs->GetHeatProblem ()) {
27452742
2746- if (!addVals) RMSTable.AddColumn (" rms_Heat" + iVar_iZone2string (0 , iZone), fieldWidth);
2747- else RMSTable << log10 (solvers[HEAT_SOL]->GetRes_RMS (0 ));
2748- } else {
2749- SU2_MPI::Error (" Invalid KindSolver for CDiscAdj-MultiZone/SingleZone-Driver." , CURRENT_FUNCTION);
2750- }
2751- } // loop iZone
2743+ }
2744+ else if (configs->GetHeatProblem ()) {
27522745
2753- if (!addVals) RMSTable.PrintHeader ();
2754- else RMSTable.PrintFooter ();
2746+ if (!addVals) RMSTable.AddColumn (" rms_Heat" + iVar_iZone2string (0 , iZone), fieldWidth);
2747+ else RMSTable << log10 (solvers[HEAT_SOL]->GetRes_RMS (0 ));
2748+ } else {
2749+ SU2_MPI::Error (" Invalid KindSolver for CDiscAdj-MultiZone/SingleZone-Driver." , CURRENT_FUNCTION);
2750+ }
2751+ } // loop iZone
27552752
2756- } // for addVals
2753+ if (!addVals) RMSTable.PrintHeader ();
2754+ else RMSTable.PrintFooter ();
27572755
2758- cout << " \n -------------------------------------------------------------------------\n " << endl;
2756+ } // for addVals
2757+
2758+ cout << " \n -------------------------------------------------------------------------\n " << endl;
27592759
2760- } // if MainRecording
2761- else if ((rank == MASTER_NODE) && ((kind_recording == RECORDING::MESH_COORDS) || (kind_recording == RECORDING::MESH_DEFORM))){
2762- cout << endl << " Recording the computational graph with respect to the " ;
2763- switch (kind_recording){
2764- case RECORDING::MESH_COORDS: cout << " mesh coordinates." << endl; break ;
2765- default : cout << " secondary variables." << endl; break ;
2766- }
2767- }
27682760}
27692761
27702762CFluidDriver::CFluidDriver (char * confFile, unsigned short val_nZone, SU2_Comm MPICommunicator) : CDriver(confFile, val_nZone, MPICommunicator, false ) {
0 commit comments