lib/grid/grid.cc
/**
 ********************************************************************************************************************************************
 * \brief   Constructor of the grid class
 *
 *          The class constructor initializes the mesh for computational problem.
 *          The pad widths, global grid limits in the full domain, local grid limits in the MPI decomposed sub-domains,
 *          grid spacings, domain lengths, etc., along each direction are set.
 *          Appropriate stretching functions are chosen according to user preferences and their corresponding grid
 *          transformation derivatives are also computed and stored.
 *
 * \param   solParam is a const reference to the global data contained in the parser class
 * \param   parallelData is a reference to the global data contained in the parallel class
 ********************************************************************************************************************************************
 */
\brief   Constructor of the grid class
The class constructor initializes the mesh for computational problem.
The pad widths, global grid limits in the full domain, local grid limits in the MPI decomposed sub-domains,
grid spacings, domain lengths, etc., along each direction are set.
Appropriate stretching functions are chosen according to user preferences and their corresponding grid
transformation derivatives are also computed and stored.

\param   solParam is a const reference to the global data contained in the parser class
\param   parallelData is a reference to the global data contained in the parallel class
\ brief Constructor of the grid class The class constructor initializes the mesh for computational problem . The pad widths global grid limits in the full domain local grid limits in the MPI decomposed sub - domains grid spacings domain lengths etc . along each direction are set . Appropriate stretching functions are chosen according to user preferences and their corresponding grid transformation derivatives are also computed and stored . \ param solParam is a const reference to the global data contained in the parser class \ param parallelData is a reference to the global data contained in the parallel class
grid::grid(const parser &solParam, parallel &parallelData): inputParams(solParam),
                                                            rankData(parallelData) {
    if (inputParams.dScheme == 1) {
        padWidths = 1, 1, 1;
    } else {
        if (rankData.rank == 0) {
            std::cout << "Undefined finite differencing scheme in YAML file. ABORTING" << std::endl;
        }
        MPI_Finalize();
        exit(0);
    }
    makeSizeArray();
    sizeIndex = inputParams.xInd, inputParams.yInd, inputParams.zInd;
    globalSize = sizeArray(sizeIndex(0)), sizeArray(sizeIndex(1)), sizeArray(sizeIndex(2));
    xLen = inputParams.Lx;
    yLen = inputParams.Ly;
    zLen = inputParams.Lz;
    thBeta = inputParams.betaX, inputParams.betaY, inputParams.betaZ;
    dXi = 1.0/real(globalSize(0) - 1);
    dEt = 1.0/real(globalSize(1) - 1);
    dZt = 1.0/real(globalSize(2) - 1);
#ifdef PLANAR
    padWidths(1) = 1;
    yLen = 1.0;
    dEt = 1.0;
#endif
    computeGlobalLimits();
    setDomainSizes();
    resizeGrid();
    globalXiEtaZeta();
    xi = xiGlo(blitz::Range(subarrayStarts(0) - padWidths(0), subarrayEnds(0) + padWidths(0)));
    et = etGlo(blitz::Range(subarrayStarts(1) - padWidths(1), subarrayEnds(1) + padWidths(1)));
    zt = ztGlo(blitz::Range(subarrayStarts(2) - padWidths(2), subarrayEnds(2) + padWidths(2)));
    createUniformGrid();
    bool gridCheck = false;
    if (inputParams.xGrid == 2) {
        createTanHypGrid(0);
        gridCheck = true;
    }
    if (inputParams.yGrid == 2) {
        createTanHypGrid(1);
        gridCheck = true;
    }
    if (inputParams.zGrid == 2) {
        createTanHypGrid(2);
        gridCheck = true;
    }
    if (gridCheck) checkAnisotropy();
    gatherGlobal();
}
grid :: grid ( const parser & solParam , parallel & parallelData ) : inputParams ( solParam ) , rankData ( parallelData ) { if ( inputParams . dScheme == 1 ) { padWidths = 1 , 1 , 1 ; } else { if ( rankData . rank == 0 ) { std :: cout << " " << std :: endl ; } MPI_Finalize ( ) ; exit ( 0 ) ; } makeSizeArray ( ) ; sizeIndex = inputParams . xInd , inputParams . yInd , inputParams . zInd ; globalSize = sizeArray ( sizeIndex ( 0 ) ) , sizeArray ( sizeIndex ( 1 ) ) , sizeArray ( sizeIndex ( 2 ) ) ; xLen = inputParams . Lx ; yLen = inputParams . Ly ; zLen = inputParams . Lz ; thBeta = inputParams . betaX , inputParams . betaY , inputParams . betaZ ; dXi = 1.0 / real ( globalSize ( 0 ) - 1 ) ; dEt = 1.0 / real ( globalSize ( 1 ) - 1 ) ; dZt = 1.0 / real ( globalSize ( 2 ) - 1 ) ; #ifdef PLANAR padWidths ( 1 ) = 1 ; yLen = 1.0 ; dEt = 1.0 ; #endif computeGlobalLimits ( ) ; setDomainSizes ( ) ; resizeGrid ( ) ; globalXiEtaZeta ( ) ; xi = xiGlo ( blitz :: Range ( subarrayStarts ( 0 ) - padWidths ( 0 ) , subarrayEnds ( 0 ) + padWidths ( 0 ) ) ) ; et = etGlo ( blitz :: Range ( subarrayStarts ( 1 ) - padWidths ( 1 ) , subarrayEnds ( 1 ) + padWidths ( 1 ) ) ) ; zt = ztGlo ( blitz :: Range ( subarrayStarts ( 2 ) - padWidths ( 2 ) , subarrayEnds ( 2 ) + padWidths ( 2 ) ) ) ; createUniformGrid ( ) ; bool gridCheck = false ; if ( inputParams . xGrid == 2 ) { createTanHypGrid ( 0 ) ; gridCheck = true ; } if ( inputParams . yGrid == 2 ) { createTanHypGrid ( 1 ) ; gridCheck = true ; } if ( inputParams . zGrid == 2 ) { createTanHypGrid ( 2 ) ; gridCheck = true ; } if ( gridCheck ) checkAnisotropy ( ) ; gatherGlobal ( ) ; }
\brief   Constructor of the grid class
          The class constructor initializes the mesh for computational problem.
\ brief Constructor of the grid class The class constructor initializes the mesh for computational problem .
/** Depending on the finite-difference scheme chosen for calculating derivatives, set the \ref padWidths along all directions. */ // THE ARRAY sizeArray HAS ELEMENTS [1, 3, 5, 9, 17, 33 ..... ] - STAGGERED GRID SIZE // COMPUTE THE LOCAL ARRAY SIZES, collocCoreSize, START AND END INDICES, subarrayStarts AND subarrayEnds // SET THE TinyVector AND RectDomain VARIABLES BASED ON VALUES COMPUTED IN computeGlobalLimits, FOR RESIZING ALL LOCAL GRIDS // RESIZE GRID USING THE VARIABLES CONSTRUCTED ABOVE IN setDomainSizes // GENERATE THE GLOBAL TRANSFORMED GRID // SET LOCAL TRANSFORMED GRID AS SLICES FROM THE GLOBAL TRANSFORMED GRID GENERATED ABOVE IN globalXiEtaZeta // CREATE UNIFORM GRID WHICH IS DEFAULT ALONG ALL THREE DIRECTIONS // FLAG TO CHECK FOR GRID ANISOTROPY - FALSE BY DEFAULT UNLESS NON-UNIFORM GRID IS CREATED // DEPENDING ON THE USER-SET PARAMETERS, SWITCH TO TAN-HYP ALONG SELECTED DIRECTIONS