lib/io/parser.cc
/**
 ********************************************************************************************************************************************
 * \brief   Function to perform a check on the consistency of user-set parameters
 *
 *          In order to catch potential errors early on, a few basic checks are performed here to validate the paramters set
 *          by the user.
 *          Additional checks to be performed on the paramters can be added to this function if necessary.
 ********************************************************************************************************************************************
 */
\brief   Function to perform a check on the consistency of user-set parameters
In order to catch potential errors early on, a few basic checks are performed here to validate the paramters set
by the user.
Additional checks to be performed on the paramters can be added to this function if necessary.
\ brief Function to perform a check on the consistency of user - set parameters In order to catch potential errors early on a few basic checks are performed here to validate the paramters set by the user . Additional checks to be performed on the paramters can be added to this function if necessary .
void parser::checkData() {
    int gridSize, localSize, coarsestSize;
#ifdef PLANAR
    if (yInd != 0) {
        std::cout << "WARNING: Y Index parameter of YAML file is non-zero although solver has been compiled with PLANAR flag. Setting Y Index to 0" << std::endl;
        yInd = 0;
    }
#else
    if (yInd == 0) {
        std::cout << "ERROR: Y Index parameter of YAML file is 0 for 3D simulation. ABORTING" << std::endl;
        MPI_Finalize();
        exit(0);
    }
#endif
    if (npX < 1) {
        std::cout << "WARNING: Number of processors in X-direction is less than 1. Setting it to 1" << std::endl;
        npX = 1;
    }
    if (npY < 1) {
        std::cout << "WARNING: Number of processors in Y-direction is less than 1. Setting it to 1" << std::endl;
        npY = 1;
    }
    if (domainType.length() != 3) {
        std::cout << "ERROR: Domain type string is not correct. Aborting" << std::endl;
        MPI_Finalize();
        exit(0);
    }
    if (meshType.length() != 3) {
        std::cout << "ERROR: Mesh type string is not correct. Aborting" << std::endl;
        MPI_Finalize();
        exit(0);
    }
    if (tStp > tMax) {
        std::cout << "ERROR: Time step is larger than the maximum duration assigned for simulation. Aborting" << std::endl;
        MPI_Finalize();
        exit(0);
    }
    if (yInd == 0 and npY > 1) {
        std::cout << "ERROR: More than 1 processor is specified along Y-direction, but the yInd parameter is set to 0. Aborting" << std::endl;
        MPI_Finalize();
        exit(0);
    }
    gridSize = int(pow(2, xInd));
    localSize = gridSize/npX;
    coarsestSize = int(pow(2, vcDepth+1));
    if (localSize < coarsestSize) {
        std::cout << "ERROR: The grid size and domain decomposition along X-direction results in sub-domains too coarse to reach the V-Cycle depth specified. Aborting" << std::endl;
        MPI_Finalize();
        exit(0);
    }
#ifndef PLANAR
    gridSize = int(pow(2, yInd));
    localSize = gridSize/npY;
    coarsestSize = int(pow(2, vcDepth+1));
    if (yInd > 0 and localSize < coarsestSize) {
        std::cout << "ERROR: The grid size and domain decomposition along Y-direction results in sub-domains too coarse to reach the V-Cycle depth specified. Aborting" << std::endl;
        MPI_Finalize();
        exit(0);
    }
#endif
    gridSize = int(pow(2, zInd));
    coarsestSize = int(pow(2, vcDepth+1));
    if (gridSize < coarsestSize) {
        std::cout << "ERROR: The grid size along Z-direction is too coarse to reach the V-Cycle depth specified. Aborting" << std::endl;
        MPI_Finalize();
        exit(0);
    }
#ifdef REAL_SINGLE
    if ((cnTolerance < 5.0e-6) or (mgTolerance < 5.0e-6)) {
        std::cout << "ERROR: The specified tolerance for iterative solvers is too small for single precision calculations. Aborting" << std::endl;
        MPI_Finalize();
        exit(0);
    }
#endif
    if (resType > 2) {
        std::cout << "ERROR: The specified value for printing error at end of V-Cycles is not defined. Aborting" << std::endl;
        MPI_Finalize();
        exit(0);
    }
}
void parser :: checkData ( ) { int gridSize , localSize , coarsestSize ; #ifdef PLANAR if ( yInd != 0 ) { std :: cout << " " << std :: endl ; yInd = 0 ; } #else if ( yInd == 0 ) { std :: cout << " " << std :: endl ; MPI_Finalize ( ) ; exit ( 0 ) ; } #endif if ( npX < 1 ) { std :: cout << " " << std :: endl ; npX = 1 ; } if ( npY < 1 ) { std :: cout << " " << std :: endl ; npY = 1 ; } if ( domainType . length ( ) != 3 ) { std :: cout << " " << std :: endl ; MPI_Finalize ( ) ; exit ( 0 ) ; } if ( meshType . length ( ) != 3 ) { std :: cout << " " << std :: endl ; MPI_Finalize ( ) ; exit ( 0 ) ; } if ( tStp > tMax ) { std :: cout << " " << std :: endl ; MPI_Finalize ( ) ; exit ( 0 ) ; } if ( yInd == 0 and npY > 1 ) { std :: cout << " " << std :: endl ; MPI_Finalize ( ) ; exit ( 0 ) ; } gridSize = int ( pow ( 2 , xInd ) ) ; localSize = gridSize / npX ; coarsestSize = int ( pow ( 2 , vcDepth + 1 ) ) ; if ( localSize < coarsestSize ) { std :: cout << " " << std :: endl ; MPI_Finalize ( ) ; exit ( 0 ) ; } #ifndef PLANAR gridSize = int ( pow ( 2 , yInd ) ) ; localSize = gridSize / npY ; coarsestSize = int ( pow ( 2 , vcDepth + 1 ) ) ; if ( yInd > 0 and localSize < coarsestSize ) { std :: cout << " " << std :: endl ; MPI_Finalize ( ) ; exit ( 0 ) ; } #endif gridSize = int ( pow ( 2 , zInd ) ) ; coarsestSize = int ( pow ( 2 , vcDepth + 1 ) ) ; if ( gridSize < coarsestSize ) { std :: cout << " " << std :: endl ; MPI_Finalize ( ) ; exit ( 0 ) ; } #ifdef REAL_SINGLE if ( ( cnTolerance < 5.0e-6 ) or ( mgTolerance < 5.0e-6 ) ) { std :: cout << " " << std :: endl ; MPI_Finalize ( ) ; exit ( 0 ) ; } #endif if ( resType > 2 ) { std :: cout << " " << std :: endl ; MPI_Finalize ( ) ; exit ( 0 ) ; } }
\brief   Function to perform a check on the consistency of user-set parameters
          In order to catch potential errors early on, a few basic checks are performed here to validate the paramters set
          by the user.
\ brief Function to perform a check on the consistency of user - set parameters In order to catch potential errors early on a few basic checks are performed here to validate the paramters set by the user .
// CHECK IF THE yInd VARIABLE IS SET CORRECTLY FOR A 2D/3D SIMULATION // CHECK IF LESS THAN 1 PROCESSOR IS ASKED FOR ALONG X-DIRECTION. IF SO, WARN AND SET IT TO DEFAULT VALUE OF 1 // CHECK IF LESS THAN 1 PROCESSOR IS ASKED FOR ALONG Y-DIRECTION. IF SO, WARN AND SET IT TO DEFAULT VALUE OF 1 // CHECK IF DOMAIN TYPE STRING IS OF CORRECT LENGTH // CHECK IF MESH TYPE STRING IS OF CORRECT LENGTH // CHECK IF THE TIME-STEP SET BY USER IS LESS THAN THE MAXIMUM TIME SPECIFIED FOR SIMULATION. // CHECK IF MORE THAN 1 PROCESSOR IS ASKED FOR ALONG Y-DIRECTION FOR A 2D SIMULATION // CHECK IF GRID SIZE SPECIFIED ALONG EACH DIRECTION IS SUFFICIENT ALONG WITH THE DOMAIN DIVIIONS TO REACH THE LOWEST LEVEL OF V-CYCLE DEPTH SPECIFIED // ALONG X-DIRECTION // ALONG Y-DIRECTION // ALONG Z-DIRECTION