Ignis
Loading...
Searching...
No Matches
driver_flamelet.cc
Go to the documentation of this file.
1#include "ignis.h"
2#include "cantera/base/Solution.h"
3#include "yaml-cpp/yaml.h"
4#include "sootHeaders.h"
5
6#include <iostream>
7#include <sstream>
8#include <string>
9#include <iomanip>
10#include <algorithm>
11
12using namespace std;
13using namespace soot;
14
20
22
23 // auto csol = Cantera::newSolution("gri30.yaml");
24 auto csol = Cantera::newSolution("../input/c2h4det.yaml");
25 auto gas = csol->thermo();
26
27 //===================== read input file
28
29 YAML::Node inputFile = YAML::LoadFile("../input/input_flamelet.yaml");
30
31 //---------------------
32
33 bool isFlamelet = inputFile["isFlamelet"].as<bool>();
34
35 size_t ngrd = inputFile["ngrd"].as<size_t>();
36 double nTauSS = inputFile["nTauSS"].as<double>();
37 int nsaveSS = inputFile["nsaveSS"].as<int>();
38
39 double chi0 = inputFile["chi0"].as<double>();
40
41 vector<double> Ls;
42 for(size_t i=0; i<inputFile["Ls"].size(); i++)
43 Ls.push_back(inputFile["Ls"][i].as<double>());
44
45 //--------------------- gas streams
46
47 double P = inputFile["P"].as<double>();
48
49 double TLbc = inputFile["LBC"]["TLbc"].as<double>();
50 vector<double> yLbc(gas->nSpecies());
51 YAML::Node yy = inputFile["LBC"]["comp"];
52 for(auto it=yy.begin(); it!=yy.end(); it++)
53 yLbc[gas->speciesIndex(it->first.as<string>())] = it->second.as<double>();
54
55 double TRbc = inputFile["RBC"]["TRbc"].as<double>();
56 vector<double> yRbc(gas->nSpecies());
57 yy = inputFile["RBC"]["comp"];
58 for(auto it=yy.begin(); it!=yy.end(); it++)
59 yRbc[gas->speciesIndex(it->first.as<string>())] = it->second.as<double>();
60
61 //--------------------- soot
62
63 bool doSoot = inputFile["doSoot"].as<bool>();
64 size_t nsoot = doSoot ? inputFile["nsoot"].as<size_t>() : 0;
65
66 shared_ptr<sootModel> SM;
67 shared_ptr<state> SMstate;
68
69 if(doSoot) {
70
71 nucleationModel *nucl = new soot::nucleationModel_LL();
72 growthModel *grow = new soot::growthModel_LL();
73 oxidationModel *oxid = new soot::oxidationModel_LL();
74 coagulationModel *coag = new soot::coagulationModel_FM();
75
76 SM = make_shared<sootModel_QMOM>(nsoot, nucl, grow, oxid, coag);
77 //SM->coag->set_FM_multiplier(9.0/2.0/2.2);
78 SM->coag->set_FM_multiplier(9.0/2.2);
79 SMstate = make_shared<state>(nsoot);
80 }
81
82 //--------------------- radiation
83
84 string radType = inputFile["radType"] ? inputFile["radType"].as<string>() : "planckmean";
85
86 //---------------------
87
88 bool doEnergyEqn = true;
89 bool isPremixed = false;
90 double L = 1.0;
91
92 //=====================
93
94 ignis flm(isPremixed, doEnergyEqn, isFlamelet, doSoot,
95 ngrd, L, P, csol, radType,
96 yLbc, yRbc, TLbc, TRbc,
97 SM, SMstate);
98
99 //flm.doLe1 = true;
100 flm.setChi(chi0);
101
102 flm.setIC("equilibrium");
103 flm.writeFile("IC.dat");
104
105 flm.doRadiation = false;
106 flm.solveUnsteady(nTauSS, nsaveSS, true);
107
108 stringstream ss; ss << "X_" << chi0 << "S_" << setfill('0') << setw(3) << 0 << ".dat";
109 string fname = ss.str();
110 flm.writeFile(fname);
111
112 //---------------
113
114 return 0;
115}
Definition ignis.h:29
bool doRadiation
radiation flag
Definition ignis.h:77
void writeFile(const std::string fname)
Definition ignis.cc:345
void setChi(const double _chi0)
Definition ignis.cc:1607
void setIC(const std::string icType, const std::string fname="")
Definition ignis.cc:485
void solveUnsteady(const double nTauRun, const int nsteps, const bool doWriteTime=true, const double Tmin=0, const double Tmax=0)
Definition ignis.cc:1122
int driver_flamelet()