Ignis
Loading...
Searching...
No Matches
driver_diffusion.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 gas = csol->thermo();
25
26 //===================== read input file
27
28 YAML::Node inputFile = YAML::LoadFile("../input/input_diffusion.yaml");
29
30 //---------------------
31
32 size_t ngrd = inputFile["ngrd"].as<size_t>();
33 double L = inputFile["L"].as<double>();
34 double nTauSS = inputFile["nTauSS"].as<double>();
35 int nsaveSS = inputFile["nsaveSS"].as<int>();
36
37 vector<double> Ls;
38 for(size_t i=0; i<inputFile["Ls"].size(); i++)
39 Ls.push_back(inputFile["Ls"][i].as<double>());
40
41 //--------------------- gas streams
42
43 double P = inputFile["P"].as<double>();
44
45 double TLbc = inputFile["LBC"]["TLbc"].as<double>();
46 vector<double> yLbc(gas->nSpecies());
47 YAML::Node yy = inputFile["LBC"]["comp"];
48 for(auto it=yy.begin(); it!=yy.end(); it++)
49 yLbc[gas->speciesIndex(it->first.as<string>())] = it->second.as<double>();
50
51 double TRbc = inputFile["RBC"]["TRbc"].as<double>();
52 vector<double> yRbc(gas->nSpecies());
53 yy = inputFile["RBC"]["comp"];
54 for(auto it=yy.begin(); it!=yy.end(); it++)
55 yRbc[gas->speciesIndex(it->first.as<string>())] = it->second.as<double>();
56
57 //--------------------- soot
58
59 bool doSoot = inputFile["doSoot"].as<bool>();
60 size_t nsoot = doSoot ? inputFile["nsoot"].as<size_t>() : 0;
61
62 shared_ptr<sootModel> SM;
63 shared_ptr<state> SMstate;
64
65 if(doSoot) {
66
67 nucleationModel *nucl = new soot::nucleationModel_LIN();
68 growthModel *grow = new soot::growthModel_LIN();
69 oxidationModel *oxid = new soot::oxidationModel_LL();
70 coagulationModel *coag = new soot::coagulationModel_FM();
71
72 SM = make_shared<sootModel_QMOM>(nsoot, nucl, grow, oxid, coag);
73 SM->coag->set_FM_multiplier(9.0/2.0/2.2);
74 SMstate = make_shared<state>(nsoot);
75 }
76 //--------------------- radiation
77
78 string radType = inputFile["radType"] ? inputFile["radType"].as<string>() : "planckmean";
79 bool doRadiation = inputFile["doRadiation"].as<bool>();
80 //---------------------
81
82 bool doEnergyEqn = true;
83 bool isFlamelet = false;
84 bool isPremixed = false;
85
86 //=====================
87
88 ignis flm(isPremixed, doEnergyEqn, isFlamelet, doSoot,
89 ngrd, L, P, csol, radType,
90 yLbc, yRbc, TLbc, TRbc,
91 SM, SMstate);
92
93 //flm.doLe1 = true;
94
95 flm.setIC("equilibrium");
96 flm.writeFile("IC.dat");
97 flm.writeFileHdf5("IC", "IC");
98
99 flm.solveUnsteady(nTauSS, nsaveSS, true);
100
101 stringstream ss; ss << "L_" << L << "S_" << setfill('0') << setw(3) << 0 << ".dat";
102 string fname = ss.str();
103 flm.writeFile(fname);
104 flm.writeFileHdf5(fname, "steady");
105
106 //---------------
107
108 return 0;
109}
Definition ignis.h:29
void writeFile(const std::string fname)
Definition ignis.cc:345
void writeFileHdf5(const std::string gname, const std::string timeType)
Definition ignis.cc:264
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_diffusion()