ODT
Loading...
Searching...
No Matches
domaincase_odt_jetMixlRxn.cc
Go to the documentation of this file.
1
7#include "domain.h"
8#include "dv.h"
9#include "dv_pos.h"
10#include "dv_posf.h"
11#include "dv_rho.h"
12#include "dv_dvisc.h"
13#include "dv_uvw.h"
14#include "dv_enth.h"
15#include "dv_temp.h"
16#include "dv_ygas.h"
17#include "dv_mixf.h"
18#include "dv_chi.h"
19#include "dv_hr.h"
20
21#include <cmath>
22#include <string>
23
25
32
33 domn = p_domn;
34
35 vector<double> gammas(4,0.0);
36 gammas[0] = 2.0/domn->gas->atomicWeight(domn->gas->elementIndex("C"));
37 gammas[1] = 0.5/domn->gas->atomicWeight(domn->gas->elementIndex("H"));
38 gammas[2] = -1.0/domn->gas->atomicWeight(domn->gas->elementIndex("O"));
39 gammas[3] = 0.0;
40 domn->strm->init(domn, gammas);
41
42 domn->v.push_back(new dv_pos( domn, "pos", false, true )); // last are: L_transported, L_output
43 domn->v.push_back(new dv_posf( domn, "posf", false, true ));
44 domn->v.push_back(new dv_rho( domn, "rho", false, true ));
45 domn->v.push_back(new dv_dvisc( domn, "dvisc", false, true ));
46 domn->v.push_back(new dv_uvw( domn, "uvel", true, true ));
47 domn->v.push_back(new dv_uvw( domn, "vvel", true, true ));
48 domn->v.push_back(new dv_uvw( domn, "wvel", true, true ));
49 domn->v.push_back(new dv_temp( domn, "temp", false, true ));
50 domn->v.push_back(new dv_mixf( domn, "mixf", false, true ));
51 domn->v.push_back(new dv_chi( domn, "chi", false, true ));
52 domn->v.push_back(new dv_hr( domn, "hr", false, true ));
53 for(int k=0; k<domn->gas->nSpecies(); k++)
54 domn->v.push_back(new dv_ygas(domn, "y_"+domn->gas->speciesName(k), true, true ));
55 domn->v.push_back(new dv_enth( domn, "enth", true, true )); // enth AFTER ygas for enth flux (see dv_enth)
56
57 int ii = 0;
58 domn->pos = domn->v.at(ii++);
59 domn->posf = domn->v.at(ii++);
60 domn->rho = domn->v.at(ii++);
61 domn->dvisc = domn->v.at(ii++);
62 domn->uvel = domn->v.at(ii++);
63 domn->vvel = domn->v.at(ii++);
64 domn->wvel = domn->v.at(ii++);
65 domn->temp = domn->v.at(ii++);
66 domn->mixf = domn->v.at(ii++);
67 domn->chi = domn->v.at(ii++);
68 domn->hr = domn->v.at(ii++);
69 domn->ysp = domn->v.begin()+ii; // access as domn->ysp[k]->d[i], etc. where k is the species starting from 0.
70 ii += domn->gas->nSpecies();
71 domn->enth = domn->v.at(ii++);
72
73 //------------------- set variables used for mesh adaption
74
75 vector<dv*> phi;
76 phi.push_back(domn->uvel);
77 phi.push_back(domn->temp);
78 domn->mesher->init(domn, phi);
79
80 //------------------- set profiles
81
82 string jetOrMixl = domn->io->initParams["jetOrMixl"].as<string>();
83 double delta_mixf = domn->io->initParams["delta_mixf"].as<double>();
84 double fyc1 = domn->io->initParams["fyc1"].as<double>();
85 double delta_vel = domn->io->initParams["delta_vel"].as<double>();
86 double vyc1 = domn->io->initParams["vyc1"].as<double>();
87 double vel_min = domn->io->initParams["vel_min"].as<double>();
88 double vel_max = domn->io->initParams["vel_max"].as<double>();
89 double vel_diff = vel_max - vel_min;
90
91 //--------------------
92
93 if(jetOrMixl == "MIXL") { // mixing layer
94
95 fyc1 += 0.5*(domn->posf->d.at(0)+domn->posf->d.at(domn->ngrd)); // fyc1=dist from center --> dist from left
96 for(int i=0; i<domn->ngrd; i++)
97 domn->mixf->d.at(i) = 0.5*(1.0+tanh(2.0/delta_mixf*(domn->pos->d.at(i)-fyc1)));
98
99 vyc1 += 0.5*(domn->posf->d.at(0)+domn->posf->d.at(domn->ngrd)); // vyc1=dist from center --> dist from left
100 for(int i=0; i<domn->ngrd; i++)
101 domn->uvel->d.at(i) = vel_diff*0.5*(1.0+tanh(2.0/delta_vel*(domn->pos->d.at(i)-vyc1))) + vel_min;
102 }
103 //--------------------
104
105 else if(jetOrMixl == "JET") { // jet
106
107 double fyc2 = domn->io->initParams["fyc2"].as<double>();
108 double vyc2 = domn->io->initParams["vyc2"].as<double>();
109 fyc1 += 0.5*(domn->posf->d.at(0)+domn->posf->d.at(domn->ngrd)); // fyc1=dist from center --> dist from left
110 fyc2 += 0.5*(domn->posf->d.at(0)+domn->posf->d.at(domn->ngrd)); // fyc2=dist from center --> dist from left
111 for(int i=0; i<domn->ngrd; i++){
112 domn->mixf->d.at(i) = 0.5*(1.0+tanh(2.0/delta_mixf*(domn->pos->d.at(i)-fyc1))) *
113 0.5*(1.0+tanh(2.0/delta_mixf*(fyc2-domn->pos->d.at(i))));
114 }
115
116 vyc1 += 0.5*(domn->posf->d.at(0)+domn->posf->d.at(domn->ngrd)); // vyc1=dist from center --> dist from left
117 vyc2 += 0.5*(domn->posf->d.at(0)+domn->posf->d.at(domn->ngrd)); // vyc2=dist from center --> dist from left
118 for(int i=0; i<domn->ngrd; i++){
119 domn->uvel->d.at(i) = vel_diff * 0.5 * (1.0 + tanh(2.0 / delta_vel * (domn->pos->d.at(i) - vyc1))) *
120 0.5 * (1.0 + tanh(2.0 / delta_vel * (vyc2 - domn->pos->d.at(i)))) + vel_min;
121 }
122 }
123 else {
124 *domn->io->ostrm << endl << "Error setting the domain: option " << jetOrMixl
125 << " not recognized " << endl;
126 exit(0);
127 }
128
129 //--------------------
130
131 int nsp = domn->gas->nSpecies();
132 vector<double> ysp(nsp); // dummy storage
133 for(int i=0; i<domn->ngrd; i++) {
134 if ( domn->pram->Lignition ) {
135 /* non-reacting mixing for ignition */
136 domn->strm->getMixingState(domn->mixf->d.at(i), ysp, domn->enth->d.at(i), domn->temp->d.at(i));
137 }
138 else {
139 /* products of combustion for equilibrium initial state */
140 domn->strm->getProdOfCompleteComb(domn->mixf->d.at(i), ysp, domn->enth->d.at(i), domn->temp->d.at(i));
141 }
142 for(int k=0; k<nsp; k++)
143 domn->ysp[k]->d.at(i) = ysp.at(k);
144 }
145
147
148 domn->rho->setVar();
149 domn->dvisc->setVar();
150
151}
152
154
160
161 int nsp = domn->gas->nSpecies();
162 vector<double> yi(nsp);
163 for(int k=0; k<nsp; k++)
164 yi.at(k) = domn->ysp[k]->d.at(ipt);
165 domn->gas->setState_PY(domn->pram->pres, &yi.at(0));
166 domn->gas->setState_HP(domn->enth->d.at(ipt), domn->pram->pres, 1.E-10);
167
168}
169
171
176
178 domn->rho->setVar();
179 domn->dvisc->setVar();
180 domn->temp->setVar();
181
182 domn->enth->LagSrc = false; // reset to false; in enth source the src is computed if false, then set to true on subsequent calls.
183}
184
186
191 domn->rho->setVar(ipt);
192 domn->temp->setVar(ipt);
193}
int ngrd
number of grid cells
Definition domain.h:42
dv * enth
Definition domain.h:57
IdealGasPhase * gas
pointer to cantera thermochemistry object (reaction rates, Cp, etc.)
Definition domain.h:69
dv * uvel
Definition domain.h:51
dv * hr
Definition domain.h:61
dv * posf
access as: posf->d[i], or posf->var_name, etc.
Definition domain.h:48
dv * vvel
Definition domain.h:52
dv * wvel
Definition domain.h:53
dv * pos
pointers to gas properties
Definition domain.h:47
meshManager * mesher
pointer to mesh manager object
Definition domain.h:78
inputoutput * io
pointer to input/output object
Definition domain.h:72
dv * dvisc
Definition domain.h:50
dv * mixf
Definition domain.h:59
streams * strm
pointer to gas stream properties
Definition domain.h:71
vector< dv * > v
All domain variables are stored in here.
Definition domain.h:45
vector< dv * >::iterator ysp
access as: ysp=v.begin(), (*ysp)->d[i] or (*(ysp+k))->d[i], or ysp[k]->d[i].
Definition domain.h:63
dv * chi
Definition domain.h:60
param * pram
pointer to the parameters object
Definition domain.h:73
dv * rho
Definition domain.h:49
dv * temp
Definition domain.h:58
virtual void setCaseSpecificVars_cvode(const int &ipt)
virtual void setGasStateAtPt(const int &ipt)
virtual void init(domain *p_domn)
virtual void enforceMassFractions()
Definition domaincase.cc:12
domain * domn
pointer to domain object (parent)
Definition domaincase.h:28
Definition dv_hr.h:23
vector< double > d
the data
Definition dv.h:30
bool LagSrc
flag to lag source term in implicit solve (initially put in for enthalpy radiation)
Definition dv.h:33
virtual void setVar(const int ipt=-1)
Definition dv.h:44
ostream * ostrm
Runtime: points to cout or to a file.
Definition inputoutput.h:33
YAML::Node initParams
yaml sub node
Definition inputoutput.h:42
void init(domain *p_domn, const vector< dv * > p_phi)
bool Lignition
true if starting with unreacted mixing profile to allow ignition
Definition param.h:65
double pres
initial pressure (Pa)
Definition param.h:40
void init(domain *p_domn, const vector< double > &gammas)
Definition streams.cc:18
void getMixingState(const double mixf, vector< double > &ymix, double &hmix, double &Tmix)
Definition streams.cc:106
void getProdOfCompleteComb(const double mixf, vector< double > &ypcc, double &hpcc, double &Tpcc)
Definition streams.cc:128
Header file for class domain.
Header file for class domaincase_odt_jetMixlRxn.
Header file for class dv.
Header file for class dv_chi.
Header file for class dv_dvisc.
Header file for class dv_enth.
Header file for class dv_hr.
Header file for class dv_mixf.
Header file for class dv_pos.
Header file for class dv_posf.
Header file for class dv_rho.
Header file for class dv_temp.
Header file for class dv_uvw.
Header file for class dv_ygas.