#include <flashcompositional.h>
Public Member Functions | |
FlashCompositional (unsigned n_phases, unsigned n_components) | |
virtual | ~FlashCompositional () |
void | getNumericTotalVolumeDerivative (double P, const VecDouble &compTotalMoles, VecDouble &compTotalDeriv, double h) |
double | getNumericFluidCompressibility (double P, const FlashData &data, double tol=1.e-6) |
virtual void | getPhasesVolume (double P, const FlashData &data, VecDouble &phasesVol) |
virtual void | flash (double P, const VecDouble &compTotalMoles, FlashData &data) |
virtual void | flash (Index cell, FlashData &data) |
virtual void | execute () |
virtual void | printOutput () |
virtual const VecDouble & | getComponentsMolarMass () const |
virtual double | getFluidCompressibility (double P, FlashData &data) |
virtual void | getPhasesViscosities (double P, const FlashData &data, VecDouble &visc) |
virtual void | getTotalVolumeDerivatives (double P, FlashData &data, VecDouble &dv_dm) |
Protected Member Functions | |
const FlashDataArray & | getFlashDataArray () |
Protected Attributes | |
FlashDataArray | m_dataArray |
Definition at line 9 of file flashcompositional.h.
FlashCompositional::FlashCompositional | ( | unsigned | n_phases, | |
unsigned | n_components | |||
) |
Definition at line 30 of file flashcompositional.cpp.
00030 :FlashBase(n_phases,n_components) 00031 { 00032 00033 00034 }
virtual FlashCompositional::~FlashCompositional | ( | ) | [inline, virtual] |
Definition at line 20 of file flashcompositional.h.
void FlashCompositional::execute | ( | ) | [virtual] |
Implements FlashBase.
Reimplemented in FlashCO2H2O, and FlashSimpleBlackOil.
Definition at line 147 of file flashcompositional.cpp.
00148 { 00149 //Get pressure vector and transport module; 00150 const VecDouble &vP=getDynamicModule().getPressureAtCells(); 00151 TransportBase &trans=getTransportModule(); 00152 assert(vP.size() == trans.getSolutionAtCells().size()); 00153 assert(trans.getSolutionAtCells().vecs_size() == numComponents()); 00154 //Allocate the vector of total components m 00155 static VecDoubleRef m(this->numComponents()); 00156 00157 //Initialize data if necessary 00158 if (m_dataArray.size() == 0) 00159 { 00160 m_dataArray.reinit(numPhases(),numComponents(),trans.getSolutionAtCells().size()); 00161 } 00162 00163 unsigned nCells = m_dataArray.size(); 00164 FlashData data(numPhases(),numComponents(),NULL); 00165 for (unsigned i=0;i<nCells;i++) 00166 { 00167 m_dataArray.getData(i,data); 00168 trans.getSolutionAtCells().getVecValues(i,&m); 00169 this->flash(vP(i),m,data); 00170 } 00171 }
Reimplemented in FlashSimpleBlackOil.
Definition at line 142 of file flashcompositional.cpp.
00143 { 00144 m_dataArray.getData(cell,data); 00145 }
void FlashCompositional::flash | ( | double | P, | |
const VecDouble & | compTotalMoles, | |||
FlashData & | data | |||
) | [virtual] |
Reimplemented in DummyFlash, FlashCO2Brine, FlashCO2BrinePw, FlashHenryLaw, and FlashSimpleBlackOil.
Definition at line 7 of file flashcompositional.cpp.
00008 { 00009 throw new Exception("Invalid Method called FlashCompositional::flash(double P, double T,const VecDouble &compTotalMoles, FlashData &data)"); 00010 }
const VecDouble & FlashCompositional::getComponentsMolarMass | ( | ) | const [virtual] |
Get the molar mass for each component
Reimplemented in DummyFlash, FlashCO2Brine, FlashHenryLaw, and FlashSimpleBlackOil.
Definition at line 37 of file flashcompositional.cpp.
00038 { 00039 throw new Exception("This flash module does not override FlashCompositional::getComponentsMolarMass()\nProbably this flash module was not designed for compositional module.\n Please check that reading the config.conf file"); 00040 00041 }
const FlashDataArray& FlashCompositional::getFlashDataArray | ( | ) | [inline, protected] |
Definition at line 15 of file flashcompositional.h.
00015 {return m_dataArray;}
double FlashCompositional::getFluidCompressibility | ( | double | P, | |
FlashData & | data | |||
) | [virtual] |
Get derivation of total fluid volume in terms of pressure
This function returns the negative of the derivative of the total volume of the mixture with respect to the pressure
P | Pressure | |
data | Flash Data having the actual state of the mixture. |
Reimplemented in DummyFlash, FlashCO2Brine, FlashCO2BrineUncomp, and FlashSimpleBlackOil.
Definition at line 18 of file flashcompositional.cpp.
00019 { 00020 return getNumericFluidCompressibility(P,data); 00021 00022 }
double FlashCompositional::getNumericFluidCompressibility | ( | double | P, | |
const FlashData & | data, | |||
double | tol = 1.e-6 | |||
) |
This function provides the functionality to calculate numerically the compressibility parameter. Is just used for the children classes in case they dont have a explicit expression to the total fluid compressibility
P | Pressure. | |
data |
Definition at line 57 of file flashcompositional.cpp.
00058 { 00059 00060 double h=P*tol; 00061 00062 static FlashData data1(n_phases,n_components); 00063 static VecDouble totalComponents(n_components); 00064 static VecDouble phasesVol(n_phases); 00065 data1.allocateOwnMemory(); 00066 data.getTotalComponentsMoles(totalComponents); 00067 00068 00069 flash(P+h,totalComponents,data1); 00070 getPhasesVolume(P+h,data1,phasesVol); 00071 double volPos=NumericMethods::vectorSum(phasesVol); 00072 00073 flash(P-h,totalComponents,data1); 00074 getPhasesVolume(P-h,data1,phasesVol); 00075 double volNeg=NumericMethods::vectorSum(phasesVol); 00076 00077 return -(volPos-volNeg)/(2*h); 00078 00079 }
void FlashCompositional::getNumericTotalVolumeDerivative | ( | double | P, | |
const VecDouble & | compTotalMoles, | |||
VecDouble & | compTotalDeriv, | |||
double | h | |||
) |
Get the derivatives of the total volume with respect of total moles of each component
P | ||
compTotalMoles | Vector indexed by components containing the total amount of moles for each component |
Definition at line 88 of file flashcompositional.cpp.
00089 { 00090 static FlashData data(numPhases(),numComponents()); 00091 static VecDouble compTotalDX; 00092 static VecDouble phasesVol(numPhases()); 00093 compTotalDX=compTotalMoles; 00094 00095 assert(compTotalMoles.size() == compTotalDeriv.size()); 00096 00097 00098 for (unsigned cmp=0;cmp<numComponents();cmp++) 00099 { 00100 compTotalDX(cmp)=compTotalMoles(cmp)+h; 00101 flash(P,compTotalDX,data); 00102 getPhasesVolume(P,data,phasesVol); 00103 double posVol=NumericMethods::vectorSum(phasesVol); 00104 00105 compTotalDX(cmp)=compTotalMoles(cmp)-h; 00106 if (compTotalDX(cmp) >= 0.0) 00107 { 00108 flash(P,compTotalDX,data); 00109 getPhasesVolume(P,data,phasesVol); 00110 double negVol=NumericMethods::vectorSum(phasesVol); 00111 compTotalDeriv(cmp)=(posVol-negVol)/(2*h); 00112 compTotalDX(cmp)=compTotalMoles(cmp); 00113 } 00114 else 00115 { 00116 compTotalDX(cmp)=compTotalMoles(cmp); 00117 flash(P,compTotalDX,data); 00118 getPhasesVolume(P,data,phasesVol); 00119 double negVol=NumericMethods::vectorSum(phasesVol); 00120 compTotalDeriv(cmp)=(posVol-negVol)/(h); 00121 } 00122 00123 00124 } 00125 00126 }
void FlashCompositional::getPhasesViscosities | ( | double | P, | |
const FlashData & | data, | |||
VecDouble & | visc | |||
) | [virtual] |
Reimplemented in DummyFlash, FlashCO2Brine, FlashHenryLaw, and FlashSimpleBlackOil.
Definition at line 44 of file flashcompositional.cpp.
00045 { 00046 throw new Exception("This flash module does not override FlashCompositional::getPhasesViscosities()\nProbably this flash module was not designed for compositional module.\n Please check that reading the config.conf file"); 00047 00048 }
void FlashCompositional::getPhasesVolume | ( | double | P, | |
const FlashData & | data, | |||
VecDouble & | phasesVol | |||
) | [virtual] |
Get phases volumes
Reimplemented in DummyFlash, FlashCO2Brine, FlashCO2BrinePw, FlashCO2BrineUncomp, FlashHenryLaw, and FlashSimpleBlackOil.
Definition at line 24 of file flashcompositional.cpp.
00025 { 00026 throw new Exception("This flash module does not override FlashCompositional::getPhasesVolume(double P, const FlashData &data, VecDouble &phasesVol)\nProbably this flash module was not designed for compositional models.\n Please check that reading the config.conf file"); 00027 }
void FlashCompositional::getTotalVolumeDerivatives | ( | double | P, | |
FlashData & | data, | |||
VecDouble & | dv_dm | |||
) | [virtual] |
Reimplemented in DummyFlash, FlashCO2Brine, FlashCO2BrineUncomp, and FlashSimpleBlackOil.
Definition at line 130 of file flashcompositional.cpp.
00131 { 00132 throw new Exception("This flash module does not implement FlashCompositional:::getTotalVolumeDerivatives(double P,FlashData &data,VecDouble &dv_dm)\nProbably this flash module was not designed for compositional module.\n Please check that by reading the config.conf file"); 00133 00134 }
void FlashCompositional::printOutput | ( | ) | [virtual] |
Implements FlashBase.
Reimplemented in FlashCO2Brine, FlashHenryLaw, and FlashSimpleBlackOil.
Definition at line 137 of file flashcompositional.cpp.
FlashDataArray FlashCompositional::m_dataArray [protected] |
Definition at line 14 of file flashcompositional.h.