lib/grid/grid.cc
/**
 ********************************************************************************************************************************************
 * \brief   Function to check the anisotropy of the grid
 *
 *          The function is called only if non-uniform grid is made.
 *          It scans through the entire grid cell-by-cell and checks the 2 aspect-ratios of the cell (one for 2D grids)
 *          The maximum value of aspect ratio is stored.
 *          Each MPI sub-domain checks within its limits and an MPI_Reduce call gets the global maximum.
 *
 ********************************************************************************************************************************************
 */
\brief   Function to check the anisotropy of the grid
The function is called only if non-uniform grid is made.
It scans through the entire grid cell-by-cell and checks the 2 aspect-ratios of the cell (one for 2D grids)
The maximum value of aspect ratio is stored.
Each MPI sub-domain checks within its limits and an MPI_Reduce call gets the global maximum.
\ brief Function to check the anisotropy of the grid The function is called only if non - uniform grid is made . It scans through the entire grid cell - by - cell and checks the 2 aspect - ratios of the cell ( one for 2D grids ) The maximum value of aspect ratio is stored . Each MPI sub - domain checks within its limits and an MPI_Reduce call gets the global maximum .
void grid::checkAnisotropy() {
    real xWidth, yWidth, zWidth;
    real localMax, globalMax;
    real xyRatio, yzRatio;
    real cellMaxAR;
    localMax = 0.0;
    for (int i = 0; i < collocCoreSize.ubound(0); i++) {
        for (int j = 0; j < collocCoreSize.ubound(0); j++) {
            for (int k = 0; k < collocCoreSize.ubound(0); k++) {
                xWidth = xColloc(i-1) - xColloc(i);
                yWidth = yColloc(j-1) - yColloc(j);
                zWidth = zColloc(k-1) - zColloc(k);
                xyRatio = std::max(xWidth/yWidth, yWidth/xWidth);
                yzRatio = std::max(yWidth/zWidth, zWidth/yWidth);
                cellMaxAR = std::max(xyRatio, yzRatio);
                if (cellMaxAR > localMax) localMax = cellMaxAR;
            }
        }
    }
    MPI_Allreduce(&localMax, &globalMax, 1, MPI_FP_REAL, MPI_MAX, MPI_COMM_WORLD);
    MPI_Barrier(MPI_COMM_WORLD);
    if (globalMax > 5.0) {
        if (rankData.rank == 0) std::cout << "\nWARNING: Grid anisotropy exceeds limits. Finite-difference calculations will be inaccurate" << std::endl;
    } else {
        if (rankData.rank == 0) std::cout << "\nMaximum grid anisotropy is " << globalMax << std::endl;
    }
}
void grid :: checkAnisotropy ( ) { real xWidth , yWidth , zWidth ; real localMax , globalMax ; real xyRatio , yzRatio ; real cellMaxAR ; localMax = 0.0 ; for ( int i = 0 ; i < collocCoreSize . ubound ( 0 ) ; i ++ ) { for ( int j = 0 ; j < collocCoreSize . ubound ( 0 ) ; j ++ ) { for ( int k = 0 ; k < collocCoreSize . ubound ( 0 ) ; k ++ ) { xWidth = xColloc ( i - 1 ) - xColloc ( i ) ; yWidth = yColloc ( j - 1 ) - yColloc ( j ) ; zWidth = zColloc ( k - 1 ) - zColloc ( k ) ; xyRatio = std :: max ( xWidth / yWidth , yWidth / xWidth ) ; yzRatio = std :: max ( yWidth / zWidth , zWidth / yWidth ) ; cellMaxAR = std :: max ( xyRatio , yzRatio ) ; if ( cellMaxAR > localMax ) localMax = cellMaxAR ; } } } MPI_Allreduce ( & localMax , & globalMax , 1 , MPI_FP_REAL , MPI_MAX , MPI_COMM_WORLD ) ; MPI_Barrier ( MPI_COMM_WORLD ) ; if ( globalMax > 5.0 ) { if ( rankData . rank == 0 ) std :: cout << " \n " << std :: endl ; } else { if ( rankData . rank == 0 ) std :: cout << " \n " << globalMax << std :: endl ; } }
\brief   Function to check the anisotropy of the grid
          The function is called only if non-uniform grid is made.
\ brief Function to check the anisotropy of the grid The function is called only if non - uniform grid is made .