ODT
Loading...
Searching...
No Matches
dv_rho_mf.cc
Go to the documentation of this file.
1
7#include "dv_rho_mf.h"
8#include "domain.h"
9
11
18 const string s,
19 const bool Lt,
20 const bool Lo) {
21
22 domn = line;
23 var_name = s;
24 L_transported = Lt;
25 L_output = Lo;
26 d = vector<double>(domn->ngrd, domn->pram->rho0);
27
28 rho0 = domn->io->streamProps["rho0"] ? domn->io->streamProps["rho0"].as<double>() : 1.0; //errMsg<double>("rho0");
29 rho1 = domn->io->streamProps["rho1"] ? domn->io->streamProps["rho1"].as<double>() : 1.0; //errMsg<double>("rho1");
30
31 temp0 = domn->io->streamProps["temp0"] ? domn->io->streamProps["temp0"].as<double>() : 1.0; //errMsg<double>("temp0");
32 temp1 = domn->io->streamProps["temp1"] ? domn->io->streamProps["temp1"].as<double>() : 1.0; //errMsg<double>("temp1");
33 tempFlame = domn->io->streamProps["tempFlame"] ? domn->io->streamProps["tempFlame"].as<double>() : 1.0; //errMsg<double>("tempFlame");
34 Zst = domn->io->streamProps["Zst"] ? domn->io->streamProps["Zst"].as<double>() : 0.5; //errMsg<double>("Zst");
35
36 if ( !(domn->io->streamProps["tempFlame"]) && ( domn->io->streamProps["temp1"] || domn->io->streamProps["temp1"] ) ) {
37 // if ( ( ( temp0 > 1.01 ) || (temp1 > 1.01 ) ) && ( tempFlame < 1.01 ) ) {
38 cout << endl << "ERROR: If tempFlame is not specified, do not specify different temp0 and temp1." << endl;
39 cout << endl << "If you want different temp0 and temp1, specify a colinear tempFlame with Zst." << endl;
40 exit(2);
41 }
42 if ( !( ( Zst >= 0.0 ) && (Zst <= 1.000001 ) ) ) {
43 cout << endl << "ERROR: Need Zst between 0 and 1." << endl;
44 exit(2);
45 }
46
47
48 }
49
51
60 void dv_rho_mf::merge2cells(const int imrg,
61 const double m1,
62 const double m2,
63 const bool LconstVolume) {
64
65 setVar(imrg);
66 d.erase(d.begin() + imrg+1);
67 }
68
70
74 void dv_rho_mf::setVar(const int ipt) {
75
76 double temp;
77 d.resize(domn->ngrd,domn->pram->rho0);
78 if(ipt == -1)
79 for(int i=0; i<domn->ngrd; i++) {
80 if ( domn->mixf->d.at(i) < Zst )
81 temp = temp0 * ( Zst - domn->mixf->d.at(i) ) / Zst + tempFlame * domn->mixf->d.at(i) / Zst;
82 else
83 temp = temp1 * ( domn->mixf->d.at(i) - Zst ) / ( 1 - Zst ) + tempFlame * ( 1 - domn->mixf->d.at(i) ) / ( 1 - Zst );
84 d.at(i) = 1.0 / temp / ( (1-domn->mixf->d.at(i))/(rho0*temp0) + domn->mixf->d.at(i)/(rho1*temp1) );
85 }
86 else {
87 //d.at(ipt) = 1.0/( (1-domn->mixf->d.at(ipt))/rho0 + domn->mixf->d.at(ipt)/rho1 );
88 if ( domn->mixf->d.at(ipt) < Zst )
89 temp = temp0 * ( Zst - domn->mixf->d.at(ipt) ) / Zst + tempFlame * domn->mixf->d.at(ipt) / Zst;
90 else
91 temp = temp1 * ( domn->mixf->d.at(ipt) - Zst ) / ( 1 - Zst ) + tempFlame * ( 1 - domn->mixf->d.at(ipt) ) / ( 1 - Zst );
92 d.at(ipt) = 1.0 / temp / ( (1-domn->mixf->d.at(ipt))/(rho0*temp0) + domn->mixf->d.at(ipt)/(rho1*temp1) );
93
94 }
95 }
96
int ngrd
number of grid cells
Definition domain.h:42
inputoutput * io
pointer to input/output object
Definition domain.h:72
dv * mixf
Definition domain.h:59
param * pram
pointer to the parameters object
Definition domain.h:73
double tempFlame
read from input file (streams section)
Definition dv_rho_mf.h:36
double rho1
read from input file (streams section)
Definition dv_rho_mf.h:33
double Zst
read from input file (streams section)
Definition dv_rho_mf.h:37
double temp1
read from input file (streams section)
Definition dv_rho_mf.h:35
virtual void merge2cells(const int imrg, const double m2, const double m1, const bool LconstVolume=false)
Definition dv_rho_mf.cc:60
double temp0
read from input file (streams section)
Definition dv_rho_mf.h:34
double rho0
read from input file (streams section)
Definition dv_rho_mf.h:32
virtual void setVar(const int ipt=-1)
Definition dv_rho_mf.cc:74
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
YAML::Node streamProps
yaml sub node
Definition inputoutput.h:41
double rho0
initial uniform density (kg/m^3)
Definition param.h:36
Header file for class domain.
Header file for class dv_rho_mf.