lib/io/tseries.cc
/**
 ********************************************************************************************************************************************
 * \brief   Overloaded function to write the time-series data for hydro solver.
 *
 *          The function computes total energy and divergence for hydro solver runs.
 *          Only the root rank (rank 0) writes the output.
 *          One line is written to the standard I/O, while another is written to the time series dat file.
 *
 ********************************************************************************************************************************************
 */
\brief   Overloaded function to write the time-series data for hydro solver.
The function computes total energy and divergence for hydro solver runs.
Only the root rank (rank 0) writes the output.
One line is written to the standard I/O, while another is written to the time series dat file.
\ brief Overloaded function to write the time - series data for hydro solver . The function computes total energy and divergence for hydro solver runs . Only the root rank ( rank 0 ) writes the output . One line is written to the standard I / O while another is written to the time series dat file .
void tseries::writeTSData() {
    V.divergence(divV, P);
    maxDivergence = divV.fxMax();
    if (maxDivergence > 1.0e5) {
        if (mesh.rankData.rank == 0) std::cout << std::endl << "ERROR: Divergence exceeds permissible limits. ABORTING" << std::endl << std::endl;
        MPI_Finalize();
        exit(0);
    }
    localEnergy = 0.0;
    totalEnergy = 0.0;
#ifdef PLANAR
    int iY = 0;
    for (int iX = xLow; iX <= xTop; iX++) {
        for (int iZ = zLow; iZ <= zTop; iZ++) {
            localEnergy += (pow((V.Vx.F(iX-1, iY, iZ) + V.Vx.F(iX, iY, iZ))/2.0, 2.0) +
                            pow((V.Vz.F(iX, iY, iZ-1) + V.Vz.F(iX, iY, iZ))/2.0, 2.0))*(mesh.dXi/mesh.xi_xColloc(iX))*(mesh.dZt/mesh.zt_zColloc(iZ));
        }
    }
#else
    for (int iX = xLow; iX <= xTop; iX++) {
        for (int iY = yLow; iY <= yTop; iY++) {
            for (int iZ = zLow; iZ <= zTop; iZ++) {
                localEnergy += (pow((V.Vx.F(iX-1, iY, iZ) + V.Vx.F(iX, iY, iZ))/2.0, 2.0) +
                                pow((V.Vy.F(iX, iY-1, iZ) + V.Vy.F(iX, iY, iZ))/2.0, 2.0) +
                                pow((V.Vz.F(iX, iY, iZ-1) + V.Vz.F(iX, iY, iZ))/2.0, 2.0))*(mesh.dXi/mesh.xi_xColloc(iX))*(mesh.dEt/mesh.et_yColloc(iY))*(mesh.dZt/mesh.zt_zColloc(iZ));
            }
        }
    }
#endif
    MPI_Allreduce(&localEnergy, &totalEnergy, 1, MPI_FP_REAL, MPI_SUM, MPI_COMM_WORLD);
    totalEnergy /= totalVol;
    if (mesh.rankData.rank == 0) {
        std::cout << std::fixed << std::setw(6)  << std::setprecision(4) << time << "\t" <<
                                    std::setw(16) << std::setprecision(8) << totalEnergy << "\t" << maxDivergence << std::endl;
        ofFile << std::fixed << std::setw(6)  << std::setprecision(4) << time << "\t" <<
                                std::setw(16) << std::setprecision(8) << totalEnergy << "\t" << maxDivergence << "\t" << tStp << std::endl;
    }
}
void tseries :: writeTSData ( ) { V . divergence ( divV , P ) ; maxDivergence = divV . fxMax ( ) ; if ( maxDivergence > 1.0e5 ) { if ( mesh . rankData . rank == 0 ) std :: cout << std :: endl << " " << std :: endl << std :: endl ; MPI_Finalize ( ) ; exit ( 0 ) ; } localEnergy = 0.0 ; totalEnergy = 0.0 ; #ifdef PLANAR int iY = 0 ; for ( int iX = xLow ; iX <= xTop ; iX ++ ) { for ( int iZ = zLow ; iZ <= zTop ; iZ ++ ) { localEnergy += ( pow ( ( V . Vx . F ( iX - 1 , iY , iZ ) + V . Vx . F ( iX , iY , iZ ) ) / 2.0 , 2.0 ) + pow ( ( V . Vz . F ( iX , iY , iZ - 1 ) + V . Vz . F ( iX , iY , iZ ) ) / 2.0 , 2.0 ) ) * ( mesh . dXi / mesh . xi_xColloc ( iX ) ) * ( mesh . dZt / mesh . zt_zColloc ( iZ ) ) ; } } #else for ( int iX = xLow ; iX <= xTop ; iX ++ ) { for ( int iY = yLow ; iY <= yTop ; iY ++ ) { for ( int iZ = zLow ; iZ <= zTop ; iZ ++ ) { localEnergy += ( pow ( ( V . Vx . F ( iX - 1 , iY , iZ ) + V . Vx . F ( iX , iY , iZ ) ) / 2.0 , 2.0 ) + pow ( ( V . Vy . F ( iX , iY - 1 , iZ ) + V . Vy . F ( iX , iY , iZ ) ) / 2.0 , 2.0 ) + pow ( ( V . Vz . F ( iX , iY , iZ - 1 ) + V . Vz . F ( iX , iY , iZ ) ) / 2.0 , 2.0 ) ) * ( mesh . dXi / mesh . xi_xColloc ( iX ) ) * ( mesh . dEt / mesh . et_yColloc ( iY ) ) * ( mesh . dZt / mesh . zt_zColloc ( iZ ) ) ; } } } #endif MPI_Allreduce ( & localEnergy , & totalEnergy , 1 , MPI_FP_REAL , MPI_SUM , MPI_COMM_WORLD ) ; totalEnergy /= totalVol ; if ( mesh . rankData . rank == 0 ) { std :: cout << std :: fixed << std :: setw ( 6 ) << std :: setprecision ( 4 ) << time << " \t " << std :: setw ( 16 ) << std :: setprecision ( 8 ) << totalEnergy << " \t " << maxDivergence << std :: endl ; ofFile << std :: fixed << std :: setw ( 6 ) << std :: setprecision ( 4 ) << time << " \t " << std :: setw ( 16 ) << std :: setprecision ( 8 ) << totalEnergy << " \t " << maxDivergence << " \t " << tStp << std :: endl ; } }
\brief   Overloaded function to write the time-series data for hydro solver.
\ brief Overloaded function to write the time - series data for hydro solver .