|
ODT
|
#include <dv_posf.h>

Public Member Functions | |
| virtual void | merge2cells (const int imrg, const double m2, const double m1, const bool LconstVolume=false) |
| virtual void | splitCell (const int isplt, const int nsplt, const vector< double > &cellFaces) |
| virtual void | setDvFromRegion (const int i1, const int i2) |
| virtual void | resize () |
| dv_posf () | |
| dv_posf (domain *line, const string s, const bool Lt, const bool Lo=true) | |
| virtual | ~dv_posf () |
Public Member Functions inherited from dv | |
| virtual void | setVar (const int ipt=-1) |
| virtual void | getRhsSrc (const int ipt=-1) |
| virtual void | getRhsMix (const vector< double > &gf, const vector< double > &dxc) |
| virtual void | interpVarToFacesHarmonic (const vector< double > &cvar, vector< double > &fvar) |
| virtual double | linearInterpToFace (const int &iface, const vector< double > &vec) |
| dv () | |
| dv (domain *line, const string s, const bool Lt, const bool Lo=true) | |
| virtual | ~dv () |
Additional Inherited Members | |
Public Attributes inherited from dv | |
| string | var_name |
| name of variable | |
| vector< double > | d |
| the data | |
| bool | L_transported |
| flag true if var is transported | |
| bool | L_output |
| flag true if included in output | |
| bool | LagSrc |
| flag to lag source term in implicit solve (initially put in for enthalpy radiation) | |
| domain * | domn |
| pointer to domain object (parent) | |
| vector< double > | rhsSrc |
| the data | |
| vector< double > | rhsMix |
| the data | |
| vector< double > | flux |
| dv_posf::dv_posf | ( | domain * | line, |
| const string | s, | ||
| const bool | Lt, | ||
| const bool | Lo = true ) |
dv_posf constructor function
| p_domn | input: set domain pointer with. |
| p_phi | input: set vector pointer with. |
Definition at line 19 of file dv_posf.cc.
|
virtual |
dv_posf merger2cells function
Function presumes that the variable being merged is a quantity per unit mass. Merging conservatively: (rho*phi*dx)_merged = (rho*phi*dx)_1 + (rho*phi*dx)_2 Then solve for phi_merged.
| imrg | input: merge cells imrg and imrg+1 |
| m1 | input: mass in cell imrg |
| m2 | input: mass in cell imrg |
| LconstVolume | input: Thermo says an adiabatic const P mixing will change volume, but sometimes we want to retain the old volume (e.g. when we merge a small cell on the edge of the domain when enforcing the boundaries. In that case, we will chop or extend the cell anyway, so there is no conservation issue. |
Reimplemented from dv.
Definition at line 72 of file dv_posf.cc.
|
virtual |
|
virtual |
dv_posf merger2cells function
Function presumes that the variable being merged is a quantity per unit mass. Merging conservatively: (rho*phi*dx)_merged = (rho*phi*dx)_1 + (rho*phi*dx)_2 Then solve for phi_merged.
| imrg | input: merge cells imrg and imrg+1 |
| m1 | input: mass in cell imrg |
| m2 | input: mass in cell imrg |
| LconstVolume | input: Thermo says an adiabatic const P mixing will change volume, but sometimes we want to retain the old volume (e.g. when we merge a small cell on the edge of the domain when enforcing the boundaries. In that case, we will chop or extend the cell anyway, so there is no conservation issue. |
void dv_posf::merge2cells(const int imrg, const double m1, const double m2, const bool LconstVolume) {
d.erase(d.begin() + imrg+1);
if(LconstVolume || domn->pram->bcType=="WALL") //todo: generalize this (works for constant density flows only, and not spatial (due to velocity)). return;
vector<double> dxc; domn->mesher->setGridDxc(domn, dxc);
double invC = 1.0/domn->pram->cCoord; double C = domn->pram->cCoord;
--------— outflow boundary on both sides.
if(domn->pram->bcType=="OUTFLOW") {
double dmb;
double pm1;
--------— do cell imrg faces
double xc; // position in cell imrg with half cell vol on each side
if(d.at(imrg) >= 0.0) { // all on right (before expand)
xc = pow(pow(d.at(imrg),C)+0.5*dxc.at(imrg),invC); // xc is found using the original cell vol.
dxc.at(imrg) = domn->pram->Lspatial ? (m1+m2)/domn->rho->d.at(imrg)/domn->uvel->d.at(imrg) : (m1+m2)/domn->rho->d.at(imrg); // now we update the vol to compute faces from xc
d.at(imrg+1) = pow(pow(xc,C)+0.5*dxc.at(imrg),invC);
dmb = pow(d.at(imrg+1),C)-dxc.at(imrg);
pm1 = dmb<0.0 ? -1.0 : 1.0; // (may cross after expand)
d.at(imrg) = pm1*pow(pm1*dmb,invC);
}
else if(d.at(imrg+1) <= 0.0) { // all on left (before expand)
xc = -pow(pow(abs(d.at(imrg+1)),C)+0.5*dxc.at(imrg),invC);
dxc.at(imrg) = domn->pram->Lspatial ? (m1+m2)/domn->rho->d.at(imrg)/domn->uvel->d.at(imrg) : (m1+m2)/domn->rho->d.at(imrg);
d.at(imrg) = -pow(pow(abs(xc),C)+0.5*dxc.at(imrg),invC);
dmb = pow(abs(d.at(imrg)),C) - dxc.at(imrg);
pm1 = dmb<0.0 ? -1.0 : 1.0; // (may cross after expand)
d.at(imrg+1) = -pm1*pow(pm1*dmb,invC);
}
else { // cell splits center (before expand)
dmb = pow(d.at(imrg+1),C) - 0.5*dxc.at(imrg);
pm1 = dmb<0.0 ? -1.0 : 1.0;
xc = pm1*pow(pm1*dmb,invC);
dxc.at(imrg) = domn->pram->Lspatial ? (m1+m2)/domn->rho->d.at(imrg)/domn->uvel->d.at(imrg) : (m1+m2)/domn->rho->d.at(imrg);
if(xc >= 0.0) {
d.at(imrg+1) = pow(pow(xc,C)+0.5*dxc.at(imrg),invC);
dmb = pow(d.at(imrg+1),C) - dxc.at(imrg);
pm1 = dmb<0.0 ? -1.0 : 1.0;
d.at(imrg) = pm1*pow(pm1*dmb,invC);
}
else {
d.at(imrg) = -pow(pow(abs(xc),C)+0.5*dxc.at(imrg),invC);
dmb = pow(abs(d.at(imrg)),C)-dxc.at(imrg);
pm1 = dmb<0.0 ? -1.0 : 1.0;
d.at(imrg+1) = -pm1*pow(pm1*dmb,invC);
}
}
--------— work right: imrg+1 to end
for(int ie=imrg+2, iw=imrg+1, i=imrg+1; ie<d.size(); ie++, iw++, i++) {
if(d.at(iw) > 0.0)
d.at(ie) = pow(pow(d.at(iw),C)+dxc.at(i),invC);
else {
dmb = pow(abs(d.at(iw)),C)-dxc.at(i);
pm1 = dmb<0.0 ? -1.0 : 1.0;
d.at(ie) = -pm1*pow(pm1*dmb,invC);
}
}
--------— work left: imrg-1 to 0
for(int iw=imrg-1, i=imrg-1, ie=imrg; iw>=0; iw--, i--, ie--) {
if(d.at(ie) < 0.0)
d.at(iw) = -pow(pow(abs(d.at(ie)),C)+dxc.at(i),invC);
else {
dmb = pow(d.at(ie),C) - dxc.at(i);
pm1 = dmb<0.0 ? -1.0 : 1.0;
d.at(iw) = pm1*pow(pm1*dmb,invC);
}
}
}
---------------— Wall on left, outlet on right. Assume all posf values are >= 0.0, expand to the right.
else if(domn->pram->bcType == "Wall_OUT") {
dxc.at(imrg) = (m1+m2)/domn->rho->d.at(imrg);
for(int iw=imrg, ie=imrg+1, i=imrg; ie<d.size(); ie++, iw++, i++)
d.at(ie) = pow(pow(d.at(iw),C)+dxc.at(imrg),invC);
}
else {
cout << endl << "ERROR: dv_posf::merge2cells: not setup for given bcType" << endl;
exit(0);
}
}
Set data array from region of domain.
| i1 | input: index of starting cell of domn to build from |
| i2 | input: index of ending cell of domn to build from See domain::setDomainFromRegion for additional details. |
Reimplemented from dv.
Definition at line 259 of file dv_posf.cc.
|
virtual |
dv_posf splitCell function
| isplt | input: index of cell to split |
| nsplt | input: number of cells to split cell into |
| cellFaces | input: original left edge, new interior faces, orig. right edge. |
note, the number of cells is changed in the calling function, not here
Reimplemented from dv.
Definition at line 47 of file dv_posf.cc.