Saras
Finite   Difference   Solver   for   Fluid   Dynamics   Simulations
parser.h
Go to the documentation of this file.
1/********************************************************************************************************************************************
2 * Saras
3 *
4 * Copyright (C) 2019, Mahendra K. Verma
5 *
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. Neither the name of the copyright holder nor the
16 * names of its contributors may be used to endorse or promote products
17 * derived from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
30 ********************************************************************************************************************************************
31 */
43#ifndef PARSER_H
44#define PARSER_H
45
46#include <math.h>
47#include <string>
48#include <sstream>
49#include <fstream>
50#include <blitz/array.h>
51#include <yaml-cpp/yaml.h>
52
53#ifdef REAL_DOUBLE
54#define H5T_NATIVE_REAL H5T_NATIVE_DOUBLE
55#define MPI_FP_REAL MPI_DOUBLE
56#define real double
57#else
58#define H5T_NATIVE_REAL H5T_NATIVE_FLOAT
59#define MPI_FP_REAL MPI_FLOAT
60#define real float
61#endif
62
63class parser {
64 public:
65 int ioCnt;
66 int rbcType;
67 int nThreads;
68 int npY, npX;
69 int forceType;
70 int solnFormat;
71 int xInd, yInd, zInd;
72 int resType, vcDepth, vcCount;
73 int gsSmooth, preSmooth, postSmooth;
74
75 int icType;
76 int dScheme;
77 int iScheme;
78 int probType;
79 int xGrid, yGrid, zGrid;
80
81 bool useCFL;
82 bool nonHgBC;
83 bool readProbes;
84 bool restartFlag;
85 bool printResidual;
86 bool xPer, yPer, zPer;
87
88 real Re;
89 real Ra;
90 real Pr;
91 real Ta;
92 real Ro;
93
94 real fwInt;
95 real rsInt;
96 real prInt;
97 real Lx, Ly, Lz;
98 real tStp, tMax;
99 real patchRadius;
100 real courantNumber;
101 real betaX, betaY, betaZ;
102 real cnTolerance, mgTolerance;
103
104 std::vector<blitz::TinyVector<int, 3> > probesList;
105
106 parser();
107
108 void writeParams();
109
110 private:
111 std::string meshType;
112 std::string domainType;
113 std::string probeCoords;
114
115 void parseYAML();
116 void checkData();
117
118 void testProbes();
119 void parseProbes();
120
121 void setGrids();
122 void setPeriodicity();
123};
124
136#endif
Contains all the global variables set by the user through the yaml file.
Definition: parser.h:63
void writeParams()
Function to write all the parameter values to I/O.
Definition: parser.cc:586