@@ -166,6 +166,8 @@ void CFlowCompOutput::SetHistoryOutputFields(CConfig *config){
166166 AddHistoryOutput (" MIN_DELTA_TIME" , " Min DT" , ScreenOutputFormat::SCIENTIFIC, " CFL_NUMBER" , " Current minimum local time step" );
167167 AddHistoryOutput (" MAX_DELTA_TIME" , " Max DT" , ScreenOutputFormat::SCIENTIFIC, " CFL_NUMBER" , " Current maximum local time step" );
168168
169+ AddHistoryOutput (" AVG_SOUND_SPEED" , " Avg[a]" , ScreenOutputFormat::FIXED, " PRIMITIVE" , " Average local speed of sound." , HistoryFieldType::DEFAULT);
170+
169171 AddHistoryOutput (" MIN_CFL" , " Min CFL" , ScreenOutputFormat::SCIENTIFIC, " CFL_NUMBER" , " Current minimum of the local CFL numbers" );
170172 AddHistoryOutput (" MAX_CFL" , " Max CFL" , ScreenOutputFormat::SCIENTIFIC, " CFL_NUMBER" , " Current maximum of the local CFL numbers" );
171173 AddHistoryOutput (" AVG_CFL" , " Avg CFL" , ScreenOutputFormat::SCIENTIFIC, " CFL_NUMBER" , " Current average of the local CFL numbers" );
@@ -238,6 +240,7 @@ void CFlowCompOutput::SetVolumeOutputFields(CConfig *config){
238240 AddVolumeOutput (" PRESSURE" , " Pressure" , " PRIMITIVE" , " Pressure" );
239241 AddVolumeOutput (" TEMPERATURE" , " Temperature" , " PRIMITIVE" , " Temperature" );
240242 AddVolumeOutput (" MACH" , " Mach" , " PRIMITIVE" , " Mach number" );
243+ AddVolumeOutput (" LOCAL_SPEED_OF_SOUND" , " Local_Speed_of_Sound" , " PRIMITIVE" , " Local speed of sound" );
241244 AddVolumeOutput (" PRESSURE_COEFF" , " Pressure_Coefficient" , " PRIMITIVE" , " Pressure coefficient" );
242245 AddVolumeOutput (" VELOCITY-X" , " Velocity_x" , " PRIMITIVE" , " x-component of the velocity vector" );
243246 AddVolumeOutput (" VELOCITY-Y" , " Velocity_y" , " PRIMITIVE" , " y-component of the velocity vector" );
@@ -325,6 +328,8 @@ void CFlowCompOutput::LoadVolumeData(CConfig *config, CGeometry *geometry, CSolv
325328 SetVolumeOutputValue (" ENERGY" , iPoint, Node_Flow->GetSolution (iPoint, 3 ));
326329 }
327330
331+ SetVolumeOutputValue (" LOCAL_SPEED_OF_SOUND" , iPoint, Node_Flow->GetSoundSpeed (iPoint));
332+
328333 if (gridMovement){
329334 SetVolumeOutputValue (" GRID_VELOCITY-X" , iPoint, Node_Geo->GetGridVel (iPoint)[0 ]);
330335 SetVolumeOutputValue (" GRID_VELOCITY-Y" , iPoint, Node_Geo->GetGridVel (iPoint)[1 ]);
@@ -429,6 +434,26 @@ void CFlowCompOutput::LoadHistoryData(CConfig *config, CGeometry *geometry, CSol
429434 SetHistoryOutputValue (" MIN_DELTA_TIME" , flow_solver->GetMin_Delta_Time ());
430435 SetHistoryOutputValue (" MAX_DELTA_TIME" , flow_solver->GetMax_Delta_Time ());
431436
437+ /* --- Compute average local speed of sound for screen output ---*/
438+ su2double avg_a = 0.0 ;
439+ unsigned long nPoint = geometry->GetnPointDomain ();
440+ const auto * Node_Flow = flow_solver->GetNodes ();
441+ for (unsigned long iPoint = 0 ; iPoint < nPoint; iPoint++) {
442+ avg_a += Node_Flow->GetSoundSpeed (iPoint);
443+ }
444+ su2double total_a = 0.0 ;
445+ unsigned long total_points = 0 ;
446+ #ifdef HAVE_MPI
447+ unsigned long nPoint_local = nPoint;
448+ SU2_MPI::Allreduce (&avg_a, &total_a, 1 , MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm ());
449+ SU2_MPI::Allreduce (&nPoint_local, &total_points, 1 , MPI_UNSIGNED_LONG, MPI_SUM, SU2_MPI::GetComm ());
450+ #else
451+ total_a = avg_a;
452+ total_points = nPoint;
453+ #endif
454+ if (total_points > 0 ) total_a /= (su2double)total_points;
455+ SetHistoryOutputValue (" AVG_SOUND_SPEED" , total_a);
456+
432457 SetHistoryOutputValue (" MIN_CFL" , flow_solver->GetMin_CFL_Local ());
433458 SetHistoryOutputValue (" MAX_CFL" , flow_solver->GetMax_CFL_Local ());
434459 SetHistoryOutputValue (" AVG_CFL" , flow_solver->GetAvg_CFL_Local ());
0 commit comments