ODT
Loading...
Searching...
No Matches
param.cc
Go to the documentation of this file.
1
6#include "param.h"
7#include "domain.h"
8
10
14void param::init(domain *p_domn) {
15 domn = p_domn;
16}
17
19
25
26 io = p_io;
27
28 seed = io->params["seed"] ? io->params["seed"].as<int>() : -1;
29 tEnd = io->params["tEnd"] ? io->params["tEnd"].as<double>() : errMsg<double>("tEnd");
30 domainLength = io->params["domainLength"] ? io->params["domainLength"].as<double>() : errMsg<double>("domainLength");
31 ngrd0 = io->params["ngrd0"] ? io->params["ngrd0"].as<int>() : 1000; //errMsg<int>("ngrd0");
32 rho0 = io->params["rho0"] ? io->params["rho0"].as<double>() : 1.0; //errMsg<double>("rho0");
33 kvisc0 = io->params["kvisc0"] ? io->params["kvisc0"].as<double>() : 0.001694; //errMsg<double>("kvisc0");
34 sdiff0 = io->params["sdiff0"] ? io->params["sdiff0"].as<double>() : 0.001694; //errMsg<double>("sdiff0");
35 dPdx = io->params["dPdx"] ? io->params["dPdx"].as<double>() : 0.0;
36 pres = io->params["pres"] ? io->params["pres"].as<double>() : 101325.0;
37 chemMechFile = io->params["chemMechFile"] ? io->params["chemMechFile"].as<string>() : errMsg<string>("chemMechFile");
38 probType = io->params["probType"] ? io->params["probType"].as<string>() : errMsg<string>("probType");
39
40 Z_param = io->params["Z_param"] ? io->params["Z_param"].as<double>() : 400.0; //errMsg<double>("Z_param");
41 A_param = io->params["A_param"] ? io->params["A_param"].as<double>() : 0.666667; //errMsg<double>("A_param");
42 C_param = io->params["C_param"] ? io->params["C_param"].as<double>() : 5.0; //errMsg<double>("C_param");
43 LES_type = io->params["LES_type"] ? io->params["LES_type"].as<string>() : "NONE"; //errMsg<string>("LES_type");
44 Z_LES = io->params["Z_LES"] ? io->params["Z_LES"].as<double>() : 0.0;
45 x0virtual = io->params["x0virtual"] ? io->params["x0virtual"].as<double>() : 0.0;
46 diffCFL = io->params["diffCFL"] ? io->params["diffCFL"].as<double>() : errMsg<double>("diffCFL");
47 cvode_atol = io->params["cvode_atol"] ? io->params["cvode_atol"].as<double>() : 1.0E-10;
48 cvode_rtol = io->params["cvode_rtol"] ? io->params["cvode_rtol"].as<double>() : 1.0E-4;
49
50 Lbuoyant = io->params["Lbuoyant"] ? io->params["Lbuoyant"].as<bool>() : false;
51 LPeEddy = io->params["LPeEddy"] ? io->params["LPeEddy"].as<bool>() : false;
52 LplanarExpCent0= io->params["LplanarExpCent0"]? io->params["LplanarExpCent0"].as<bool>() : false;
53 g = io->params["g"] ? io->params["g"].as<double>() : -9.81;
54 LdoDL = io->params["LdoDL"] ? io->params["LdoDL"].as<bool>() : false;
55 Lsolver = io->params["Lsolver"] ? io->params["Lsolver"].as<string>() : errMsg<string>("Lsolver");
56 Lperiodic = io->params["Lperiodic"] ? io->params["Lperiodic"].as<bool>() : false;
57 Lspatial = io->params["Lspatial"] ? io->params["Lspatial"].as<bool>() : false;
58 LTMA = io->params["LTMA"] ? io->params["LTMA"].as<bool>() : false;
59 LplanarTau = io->params["LplanarTau"] ? io->params["LplanarTau"].as<bool>() : false;
60 Lignition = io->params["Lignition"] ? io->params["Lignition"].as<bool>() : false;
61
62 bcType = io->params["bcType"] ? io->params["bcType"].as<string>() : errMsg<string>("bcType");
63 cCoord = io->params["cCoord"] ? io->params["cCoord"].as<int>() : 1;
64 xDomainCenter = io->params["xDomainCenter"] ? io->params["xDomainCenter"].as<double>() : 0.0;
65
66
67 gDens = io->params["gDens"] ? io->params["gDens"].as<double>() : 30; //errMsg<double>("gDens");
68 dxmin = io->params["dxmin"] ? io->params["dxmin"].as<double>() : 0.0; //errMsg<double>("dxmin");
69 dxmax = io->params["dxmax"] ? io->params["dxmax"].as<double>() : 0.2;
70
71 Pmax = io->params["Pmax"] ? io->params["Pmax"].as<double>() : 0.4; //errMsg<double>("Pmax");
72 Pav = io->params["Pav"] ? io->params["Pav"].as<double>() : 0.02; //errMsg<double>("Pav");
73 dtfac = io->params["dtfac"] ? io->params["dtfac"].as<double>() : 2.0; //errMsg<double>("dtfac");
74 nDtSmeanWait = io->params["nDtSmeanWait"] ? io->params["nDtSmeanWait"].as<int>() : 100000; //errMsg<int>("nDtSmeanWait");
75 eddyMinCells = io->params["eddyMinCells"] ? io->params["eddyMinCells"].as<int>() : 3; //errMsg<int>("eddyMinCells");
76 DAtimeFac = io->params["DAtimeFac"] ? io->params["DAtimeFac"].as<double>() : 10.0; //errMsg<double>("DAtimeFac");
77 tdfac = io->params["tdfac"] ? io->params["tdfac"].as<double>() : 1.0;
78 sLastDA = io->params["sLastDA"] ? io->params["sLastDA"].as<int>() : 100; //errMsg<int>("sLastDA");
79 Lp = io->params["Lp"] ? io->params["Lp"].as<double>() : 0.01; //errMsg<double>("Lp");
80 Lmax = io->params["Lmax"] ? io->params["Lmax"].as<double>() : 1.0; //errMsg<double>("Lmax");
81 Lmin = io->params["Lmin"] ? io->params["Lmin"].as<double>() : dxmin*eddyMinCells; //errMsg<double>("Lmin");
82
83 modDump = io->params["modDump"] ? io->params["modDump"].as<int>() : 1000000; //errMsg<int>("modDump");
84 modDisp = io->params["modDisp"] ? io->params["modDisp"].as<int>() : 1;
85 Ltecplot = io->params["Ltecplot"] ? io->params["Ltecplot"].as<bool>() : false; //errMsg<int>("modDump");
86
87 LmultiPhase = io->params["LmultiPhase"] ? io->params["LmultiPhase"].as<bool>() : false;
88 eSurfTens = io->params["eSurfTens"] ? io->params["eSurfTens"].as<double>() : 0.0;
89
90 Lrestart = io->params["Lrestart"] ? io->params["Lrestart"].as<bool>() : false;
91 rstType = io->params["rstType"] ? io->params["rstType"].as<string>() : "single"; // "single" or "multiple"
92 trst = 0.0; // (dont read this in, it comes from the restart file
93
94 umin_spatial = io->params["umin_spatial"] ? io->params["umin_spatial"].as<double>() : 0.5;
95
96 // Radiation variables ---------------------
97
98 Lrad = io->params["Lrad"] ? io->params["Lrad"].as<bool>() : false;
99 radSolveType = io->radParams["radSolveType"] ? io->radParams["radSolveType"].as<string>() : "OPTHIN";
100 radCoefType = io->radParams["radCoefType"] ? io->radParams["radCoefType"].as<string>() : "PLANCKMEAN";
101 ntheta = io->radParams["ntheta"] ? io->radParams["ntheta"].as<int>() : 40;
102 npsi = io->radParams["npsi"] ? io->radParams["npsi"].as<int>() : 80;
103
104 //---------------------
105
106 // Dirichlet velocity BCs (no-slip)
107 uBClo = io->bcCond["uBClo"] ? io->bcCond["uBClo"].as<double>() : 0.0;
108 uBChi = io->bcCond["uBChi"] ? io->bcCond["uBChi"].as<double>() : 0.0;
109 vBClo = io->bcCond["vBClo"] ? io->bcCond["vBClo"].as<double>() : 0.0;
110 vBChi = io->bcCond["vBChi"] ? io->bcCond["vBChi"].as<double>() : 0.0;
111 wBClo = io->bcCond["wBClo"] ? io->bcCond["wBClo"].as<double>() : 0.0;
112 wBChi = io->bcCond["wBChi"] ? io->bcCond["wBChi"].as<double>() : 0.0;
113 // Dirichlet scalar BCs
114 sBClo = io->bcCond["sBClo"] ? io->bcCond["sBClo"].as<double>() : 0.0; //errMsg<double>("sBClo");
115 sBChi = io->bcCond["sBChi"] ? io->bcCond["sBChi"].as<double>() : 0.0; //errMsg<double>("sBChi");
116
117 // Dirichlet temperature BCs
118 hWallBCtype = io->bcCond["hWallBCtype"] ? io->bcCond["hWallBCtype"].as<string>() : "ADIABATIC";
119 if(hWallBCtype == "ISOTHERMAL") {
120 TBClo = io->bcCond["TBClo"] ? io->bcCond["TBClo"].as<double>() : errMsg<double>("TBClo");
121 TBChi = io->bcCond["TBChi"] ? io->bcCond["TBChi"].as<double>() : errMsg<double>("TBChi");
122 }
123 if(Lrad) {
124 TBClo = io->bcCond["TBClo"] ? io->bcCond["TBClo"].as<double>() : errMsg<double>("TBClo");
125 TBChi = io->bcCond["TBChi"] ? io->bcCond["TBChi"].as<double>() : errMsg<double>("TBChi");
126 }
127
128 //--------------------- un-normalize
129
134 Lp *= domainLength;
135
136 //--------------------- sanity checks
137
138 if( (cCoord == 2) && (xDomainCenter != 0.0) && ( abs(xDomainCenter) < 0.5*domainLength) ) {
139 cout << endl << "ERROR: for cylindrical, set xDomainCenter to be 0.0 (e.g, a pipe) or such as gives an annulus";
140 cout << endl << " That is, xDomainCenter should give a domain, that when rotated about the origin, doesnt overlap itself";
141 exit(0);
142 }
143 if( (cCoord == 3) && (xDomainCenter != 0.0) ) {
144 cout << endl << "ERROR: spherical case requires xDomainCenter to be zero";
145 exit(0);
146 }
147
148 if(LTMA && cCoord == 1)
149 cout << endl << "ERROR: don't use LTMA=true for cCoord=1. LTMA is for cylindrical/spherical." << endl;
150 if(LplanarTau && cCoord == 1)
151 cout << endl << "ERROR: don't use LplanarTau=true for cCoord=1. LPlanarTau is for cylindrical/spherical." << endl;
152
153 if(LdoDL && Lsolver=="STRANG")
154 cout << endl << "ERROR: STRANG solver is not set up with Darrieus Landau instability LdoDL" << endl;
155
156}
157
YAML::Node bcCond
yaml sub node
Definition inputoutput.h:47
YAML::Node params
yaml sub node
Definition inputoutput.h:40
YAML::Node radParams
yaml sub node
Definition inputoutput.h:43
string probType
problem type: CHANNEL, CHANNEL_SCALAR, JETMIXL_RXN, COUETTE
Definition param.h:42
double DAtimeFac
time until catch-up adaption is DAtimeFac * dtCUmax
Definition param.h:80
int seed
random number generator seed (negative to randomize it)
Definition param.h:32
int nDtSmeanWait
number of eddy samples before increase dtSmean
Definition param.h:78
int cCoord
1 = planar, 2 = cylindrical, 3 = spherical
Definition param.h:68
bool LPeEddy
flag to turn on potential energy for eddies (vertical domain)
Definition param.h:57
int ntheta
Definition param.h:117
bool LTMA
true for the triplet map TMA: 3 = vol segments; false for TMB: 3 equal length segments
Definition param.h:63
bool LmultiPhase
true if domain has more than one phase (particles don't count)
Definition param.h:91
double diffCFL
multiplies min diffusion timestep
Definition param.h:49
double dxmin
min grid spacing: = dxmin / domain length
Definition param.h:72
double vBChi
Dirichlet velocity boundary condition.
Definition param.h:97
string radCoefType
PLANCKMEAN, WSGG, RCSLW.
Definition param.h:115
double g
gravity (default -9.81)
Definition param.h:59
inputoutput * io
pointer to io object (has the input file)
Definition param.h:30
bool LplanarExpCent0
flag: for planar cases (C=1) set the expansion center at 0 for outflow cases (normally expand about t...
Definition param.h:58
double uBChi
Dirichlet velocity boundary condition.
Definition param.h:95
double sBChi
Dirichlet scalar boundary condition.
Definition param.h:101
double cvode_atol
absolute tolerace atol for cvode
Definition param.h:50
double sdiff0
initial uniform scalar diffusivity (m^2/s)
Definition param.h:38
int eddyMinCells
eddy must overlap at least this many cells
Definition param.h:79
double TBChi
Required if hWallBCtype = ISOTHERMAL.
Definition param.h:104
double domainLength
length of domain (m)
Definition param.h:34
bool Lspatial
spatial formulation if true
Definition param.h:62
bool Lperiodic
periodic if true
Definition param.h:61
double vBClo
Dirichlet velocity boundary condition.
Definition param.h:96
double trst
restart time (from restart file), default is 0.0;
Definition param.h:108
int modDump
accepted eddies before output file
Definition param.h:87
bool Ltecplot
set TRUE for tecplot friendly output
Definition param.h:89
bool Lignition
true if starting with unreacted mixing profile to allow ignition
Definition param.h:65
int ngrd0
initial grid points
Definition param.h:35
double Lp
Most probable eddy size frac of domainLength.
Definition param.h:83
double Z_param
Viscous penalty parameter.
Definition param.h:44
double dPdx
initial pressure gradient (Pa/m)
Definition param.h:39
double Pmax
maximum eddy acceptance probability
Definition param.h:75
double gDens
grid density for mesher
Definition param.h:71
string LES_type
NONE, THIRDS, ELAPSEDTIME, FRACDOMAIN, INTEGRALSCALE.
Definition param.h:47
double xDomainCenter
position of the center of the domain
Definition param.h:69
double TBClo
Required if hWallBCtype = ISOTHERMAL.
Definition param.h:103
double Lmax
Max eddy size frac of domainLength.
Definition param.h:84
string hWallBCtype
ADIABATIC or ISOTHERMAL.
Definition param.h:102
double C_param
Eddy frequency parameter.
Definition param.h:46
double sBClo
Dirichlet scalar boundary condition.
Definition param.h:100
double eSurfTens
surface tension, J/m2 for liquid phases
Definition param.h:92
int modDisp
frequency to display results (# eddies)
Definition param.h:88
double dtfac
maximum factor to increase dtSmean
Definition param.h:77
bool Lrestart
true to restart from file, else false
Definition param.h:106
double Z_LES
large eddy suppression (nonpositive prevents les test)
Definition param.h:48
string rstType
"single" or "multiple"
Definition param.h:107
string radSolveType
OPTHIN, TWOFLUX, FVDOM.
Definition param.h:114
double x0virtual
LES virtual origin.
Definition param.h:52
double rho0
initial uniform density (kg/m^3)
Definition param.h:36
double uBClo
Dirichlet velocity boundary condition.
Definition param.h:94
double A_param
Energy Distribution parameter alpha.
Definition param.h:45
string Lsolver
EXPLICIT, SEMI-IMPLICIT, or STRANG.
Definition param.h:60
bool LdoDL
flag to do the DL energy from the DL instability
Definition param.h:54
double pres
initial pressure (Pa)
Definition param.h:40
double dxmax
max grid spacing = dxmax / domain length
Definition param.h:73
param(inputoutput *p_io)
Definition param.cc:24
double Pav
Average acceptance probability.
Definition param.h:76
bool Lbuoyant
flag to turn on bouyancy (horizontal domain)
Definition param.h:56
bool LplanarTau
true for computing cylindrical/spherical tau_eddy using a planar formulation. If accepted,...
Definition param.h:64
double kvisc0
initial uniform kinematic viscosity (m^2/s)
Definition param.h:37
string bcType
OUTFLOW, PERIODIC, WALL, WALL_OUT.
Definition param.h:67
double tdfac
factor between dtCUmax and dtCFL for temporal flows; DEFAULT = 1.0
Definition param.h:81
int sLastDA
size of the lastDA vector for timing adaptmesh after diff
Definition param.h:82
domain * domn
pointer to domain object
Definition param.h:29
double tEnd
ending time of realization
Definition param.h:33
double umin_spatial
min u for spatial flows; used when kernels pull velocity
Definition param.h:110
void init(domain *p_domn)
Definition param.cc:14
string chemMechFile
name of chemical mechanism file
Definition param.h:41
double wBClo
Dirichlet velocity boundary condition.
Definition param.h:98
bool Lrad
radiation flag
Definition param.h:55
double Lmin
Min eddy size frac of domainLength.
Definition param.h:85
int npsi
Definition param.h:116
double cvode_rtol
relative tolerace rtol for cvode
Definition param.h:51
double wBChi
Dirichlet velocity boundary condition.
Definition param.h:99
Header file for class domain.
Header file for class param.