ODT
Loading...
Searching...
No Matches
dv_hr.cc
Go to the documentation of this file.
1
6#include "dv_hr.h"
7#include "domain.h"
8#include <cstdlib>
9#include <cmath>
10
12// Declare the global function prototype so it can be used in this source file
13
14void getProblemSpecificRR(double rho, double temp, double pres, double *yi, double *rr);
15
17
24 const string s,
25 const bool Lt,
26 const bool Lo) {
27
28 domn = line;
29 var_name = s;
30 L_transported = Lt;
31 L_output = Lo;
32 d = vector<double>(domn->ngrd, 0.0);
33
34}
35
37
41void dv_hr::setVar(const int ipt){
42
43 if(ipt != -1) {
44 cout << endl << "ERROR in setVar: ipt must be -1" << endl;
45 exit(0);
46 }
47
48 d.resize(domn->ngrd);
49
50 int nsp = domn->gas->nSpecies();
51 vector<double> rr(nsp);
52 vector<double> yi(nsp);
53 vector<double> hsp(nsp);
54
55 for(int i=0; i<domn->ngrd; i++){
57 // catch extremes of temperature due to diff-diff
58 double temperatureHere = domn->gas->temperature();
59 temperatureHere = ( temperatureHere < 250.0 ) ? 250.0 : temperatureHere;
60#ifdef PROBLEMSPECIFICRR
61 domn->gas->getMassFractions( &yi[0] );
62 // getProblemSpecificRR(domn->gas->density(), domn->gas->temperature(), domn->pram->pres, &yi.at(0), &rr.at(0));
63 getProblemSpecificRR(domn->gas->density(), temperatureHere, domn->pram->pres, &yi.at(0), &rr.at(0));
64#else
65 domn->gas->getNetProductionRates(&rr.at(0));
66#endif
67 domn->gas->getEnthalpy_RT(&hsp.at(0)); // non-dimensional enthalpy
68 d.at(i) = 0.0;
69 for(int k=0; k<nsp; k++)
70 d.at(i) -= rr.at(k)*(hsp.at(k)*temperatureHere*GasConstant);
71 }
72}
73
int ngrd
number of grid cells
Definition domain.h:42
domaincase * domc
domaincase class: set specific vars...
Definition domain.h:84
IdealGasPhase * gas
pointer to cantera thermochemistry object (reaction rates, Cp, etc.)
Definition domain.h:69
param * pram
pointer to the parameters object
Definition domain.h:73
virtual void setGasStateAtPt(const int &ipt)
Definition domaincase.h:34
virtual void setVar(const int ipt=-1)
Definition dv_hr.cc:41
dv_hr()
Definition dv_hr.h:41
vector< double > d
the data
Definition dv.h:30
bool L_transported
flag true if var is transported
Definition dv.h:31
string var_name
name of variable
Definition dv.h:29
bool L_output
flag true if included in output
Definition dv.h:32
domain * domn
pointer to domain object (parent)
Definition dv.h:35
double pres
initial pressure (Pa)
Definition param.h:40
Header file for class domain.
void getProblemSpecificRR(double rho, double temp, double pres, double *yi, double *rr)
Definition simple_dlr.cc:13
Header file for class dv_hr.