ODT
Loading...
Searching...
No Matches
dv_chi_dmf.cc
Go to the documentation of this file.
1
7#include "dv_chi_dmf.h"
8#include "domain.h"
9#include <cstdlib>
10#include <cmath>
11
13
20 const string s,
21 const bool Lt,
22 const bool Lo) {
23
24 domn = line;
25 var_name = s;
26 L_transported = Lt;
27 L_output = Lo;
28 d = vector<double>(domn->ngrd, 0.0);
29
30 Dmf = domn->io->streamProps["Dmf"] ? domn->io->streamProps["Dmf"].as<double>() : 0.0;
31 if(Dmf == 0.0) {
32 cout << endl << "ERROR: if you are defining dv_chi_dmf for chi, you need to set Dmf";
33 exit(0);
34 }
35
36}
37
39
51void dv_chi_dmf::setVar(const int ipt){
52
53 if(ipt != -1) {
54 cout << endl << "ERROR in setVar: ipt must be -1" << endl;
55 exit(0);
56 }
57
58 d.resize(domn->ngrd);
59
60 domn->mixf->setVar(); // this may be redundant
61
62 vector<double> gradZ(domn->ngrd);
63
64 //------------- Compute chi
65
66 gradZ.at(0) = (domn->mixf->d.at(1)-domn->mixf->d.at(0))/(domn->pos->d.at(1)-domn->pos->d.at(0));
67 double d1, d2;
68 for(int i=1; i<domn->ngrd-1; i++) {
69 d1 = 0.5*(domn->pos->d.at(i) -domn->pos->d.at(i-1));
70 d2 = 0.5*(domn->pos->d.at(i+1)-domn->pos->d.at(i));
71 gradZ.at(i) = (d2*d2*(domn->mixf->d.at(i) -domn->mixf->d.at(i-1)) +
72 d1*d1*(domn->mixf->d.at(i+1)-domn->mixf->d.at(i)))/(2*d1*d2*(d1+d2));
73 }
74 gradZ.at(domn->ngrd-1) = (domn->mixf->d.at(domn->ngrd-1)-domn->mixf->d.at(domn->ngrd-2)) /
75 (domn->pos->d.at(domn->ngrd-1)-domn->pos->d.at(domn->ngrd-2));
76
77 for(int i=0; i<domn->ngrd; i++)
78 d.at(i) = 2.0*Dmf*gradZ.at(i)*gradZ.at(i);
79
80}
81
int ngrd
number of grid cells
Definition domain.h:42
dv * pos
pointers to gas properties
Definition domain.h:47
inputoutput * io
pointer to input/output object
Definition domain.h:72
dv * mixf
Definition domain.h:59
virtual void setVar(const int ipt=-1)
Definition dv_chi_dmf.cc:51
double Dmf
default mixture fraction diffusivity (read from input file)
Definition dv_chi_dmf.h:29
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
virtual void setVar(const int ipt=-1)
Definition dv.h:44
YAML::Node streamProps
yaml sub node
Definition inputoutput.h:41
Header file for class domain.
Header file for class dv_chi_dmf – uses constant Dmf for computing chi.