FlashSimpleBlackOil Class Reference

#include <flashsimpleblackoil.h>

Inheritance diagram for FlashSimpleBlackOil:
Inheritance graph
[legend]
Collaboration diagram for FlashSimpleBlackOil:
Collaboration graph
[legend]

List of all members.

Public Types

enum  Phases { OIL = 0, GAS = 1 }

Public Member Functions

 FlashSimpleBlackOil (OrthoMesh &mesh)
virtual ~FlashSimpleBlackOil ()
virtual void execute ()
virtual void flash (Index cell, FlashData &data)
virtual void flash (double P, const VecDouble &compTotalMoles, FlashData &data)
virtual const VecDoublegetComponentsMolarMass () const
virtual void getPhasesViscosities (double P, const FlashData &data, VecDouble &visc)
virtual double getFluidCompressibility (double P, FlashData &data)
virtual void getPhasesVolume (double P, const FlashData &data, VecDouble &phasesVol)
double getBubblePressure (const FlashData &data)
void getTotalVolumeDerivatives (double P, FlashData &data, VecDouble &dv_dm)
virtual void printOutput ()

Private Attributes

VecDouble compMass
OrthoMeshm_mesh
VecDoubleRef m

Detailed Description

This class implements a simple biphasic black oil model of oil and gas where gas can dissolve in oil but oil cannot evaporate into the gas phase.The units are exactly the same as in the paper "A Method for Reducing Numerica Dispersion in Two Black-Oil Reservoir Simulation" Pressure: PSI = 0.000145037738 Pascal Distance: feet time: day

Definition at line 13 of file flashsimpleblackoil.h.


Member Enumeration Documentation

Enumerator:
OIL 
GAS 

Definition at line 20 of file flashsimpleblackoil.h.

00020 {OIL=0,GAS=1}; 


Constructor & Destructor Documentation

FlashSimpleBlackOil::FlashSimpleBlackOil ( OrthoMesh mesh  ) 

Definition at line 9 of file flashsimpleblackoil.cpp.

00010    :FlashCompositional(2,2),m_mesh(mesh),m(2)
00011 {
00012   compMass.reinit(2);
00013   compMass=1;
00014 }

FlashSimpleBlackOil::~FlashSimpleBlackOil (  )  [virtual]

Definition at line 152 of file flashsimpleblackoil.cpp.

00153 {
00154 
00155 }


Member Function Documentation

virtual void FlashSimpleBlackOil::execute (  )  [inline, virtual]

Reimplemented from FlashCompositional.

Definition at line 25 of file flashsimpleblackoil.h.

00025 {}

void FlashSimpleBlackOil::flash ( double  P,
const VecDouble compTotalMoles,
FlashData data 
) [virtual]

Reimplemented from FlashCompositional.

Definition at line 18 of file flashsimpleblackoil.cpp.

00019 {
00020   assert(compTotalMoles.size()==2);
00021   assert(compTotalMoles(0)>=0.0);
00022   assert(compTotalMoles(1)>=0.0);
00023   assert(data.getNPhases()==2);
00024   assert(data.getNComponents()==2);
00025   
00026   data.allocateOwnMemory();
00027 
00028   //Find total moles.
00029   double no=compTotalMoles(OIL);
00030   double ng=compTotalMoles(GAS);
00031 
00032   //Find molar concentration of each component
00033   double ngo = Rl*P*no;
00034   
00035 
00036   data.setMoles(OIL,OIL,compTotalMoles(OIL));
00037   data.setMoles(GAS,OIL,0.0);
00038   
00039 
00040   if (ngo > ng)//Undersaturated case
00041   {
00042     //All gas is dissolved
00043     data.setMoles(OIL,GAS,ng);
00044     data.setMoles(GAS,GAS,0.0);
00045   }
00046   else
00047   {
00048     data.setMoles(OIL,GAS,ngo);
00049     data.setMoles(GAS,GAS,ng-ngo);
00050   }
00051 
00052 }

void FlashSimpleBlackOil::flash ( Index  cell,
FlashData data 
) [virtual]

Reimplemented from FlashCompositional.

Definition at line 157 of file flashsimpleblackoil.cpp.

00158 {
00159 
00160   getTransportModule().getSolutionAtCells().getVecValues(cell,&m);
00161   flash(getDynamicModule().getPressureAtCells()(cell),m,data);
00162 }

double FlashSimpleBlackOil::getBubblePressure ( const FlashData data  ) 

Definition at line 143 of file flashsimpleblackoil.cpp.

00144 {
00145   assert(data.getMoles(GAS,OIL)==0.0);
00146   assert(data.getMoles(GAS,GAS)==0.0);
00147   return data.getMoles(OIL,GAS)/(Rl*data.getMoles(OIL,OIL));
00148 }

const VecDouble & FlashSimpleBlackOil::getComponentsMolarMass (  )  const [virtual]

Get the molar mass for each component in Kg/mol

Reimplemented from FlashCompositional.

Definition at line 58 of file flashsimpleblackoil.cpp.

00059 {
00060   return compMass;
00061 }

double FlashSimpleBlackOil::getFluidCompressibility ( double  P,
FlashData data 
) [virtual]

Get derivation of total fluid volume (m^3) in terms of pressure (N/m^2)

Reimplemented from FlashCompositional.

Definition at line 65 of file flashsimpleblackoil.cpp.

00066 {
00067   double ngg = data.getMoles(GAS,GAS);
00068   if (ngg != 0.0) //Saturated case
00069   {
00070     double ng=data.getMoles(GAS,GAS)+data.getMoles(OIL,GAS);
00071     double no=data.getMoles(OIL,OIL);
00072     return -(-(0.3*no + 0.06*ng)/pow(6+0.06*P,2.0) + 0.0001*no);
00073   }
00074   else 
00075   {
00076     double no=data.getMoles(OIL,OIL);
00077     double pb=data.getMoles(OIL,GAS)/(Rl*no);
00078     return -(-(1+0.0001*pb)*Cbl*no/pow(1+Cbl*(P-pb),2));
00079   }
00080 
00081 
00082 }

void FlashSimpleBlackOil::getPhasesViscosities ( double  P,
const FlashData data,
VecDouble visc 
) [virtual]

Get the viscosity of the phases

Parameters:
P Pressure in PSI
data The fluids composition
visc Vector containing the viscosity for each phase. The units used are PSI*day

Reimplemented from FlashCompositional.

Definition at line 117 of file flashsimpleblackoil.cpp.

00118 {
00119   assert(visc.size() == 2);
00120   visc(OIL)=1.10366e-12;
00121   visc(GAS)=9.19289e-14;
00122   return;
00123     
00124 
00125 
00126   visc(GAS)=0.012+3e-5*P;
00127   //Oil
00128   if (data.getMoles(GAS,GAS) != 0.0)//Saturated case
00129   {
00130     visc(OIL)=0.8-0.0001*P;
00131   }
00132   else
00133   {
00134     double pb= getBubblePressure(data);
00135     visc(OIL)=(0.8-0.0001*pb)*(1.0 + 0.0000678 * (P-pb));
00136   }
00137 
00138   //The formulas above ar for cp units. To change to PSI*day we need to multiply the viscosities by a factor
00139   visc*=1.6786775231481482e-12;
00140 }

void FlashSimpleBlackOil::getPhasesVolume ( double  P,
const FlashData data,
VecDouble phasesVol 
) [virtual]

Get phases volumes in m^3

Reimplemented from FlashCompositional.

Definition at line 84 of file flashsimpleblackoil.cpp.

00085 {
00086   assert(data.getMoles(GAS,OIL)==0.0);
00087   assert(data.getNPhases()==2);
00088   assert(data.getNComponents()==2);
00089   
00090   //Sg = Bv*ngg == ngg/(6+0.06P)
00091   double ngg = data.getMoles(GAS,GAS);
00092   double noo = data.getMoles(OIL,OIL);
00093   
00094   if (ngg !=0.0) //Saturated case
00095   {
00096     phasesVol(GAS)=ngg/(6+0.06*P);
00097     phasesVol(OIL)=(1+1.e-4*P)*noo;
00098   }
00099   else
00100   {
00101     //No gas => no gas volume
00102     phasesVol(GAS)=0.0;
00103 
00104     //find Bubble pressure
00105     double pb = data.getMoles(OIL,GAS)/(Rl*noo);
00106     phasesVol(OIL)=(1+1.e-4*pb)*noo/(1+Cbl*(P-pb));
00107   }
00108 }

void FlashSimpleBlackOil::getTotalVolumeDerivatives ( double  P,
FlashData data,
VecDouble dv_dm 
) [virtual]

Reimplemented from FlashCompositional.

Definition at line 165 of file flashsimpleblackoil.cpp.

00166 {
00167   assert(dv_dm.size()  == 2);
00168   
00169   double ngg = data.getMoles(GAS,GAS);
00170   double no = data.getMoles(OIL,OIL);
00171 
00172   if (ngg != 0.0 )
00173   {
00174     //Saturated case
00175     
00176     dv_dm(OIL)=-0.05*P/(0.06*P + 6) + P/10000.0 + 1;
00177     dv_dm(GAS)=1.0/(0.06*P+6);
00178   }
00179   else //Unsaturated case
00180   {
00181     double ng=data.getMoles(OIL,GAS);
00182     dv_dm(OIL)=(((2.31e-5 *P + 1)*no +  -9.24e-4 * ng)*no -9.24e-7*ng*ng)/
00183       pow((2.31e-5*P+1)*no-ng*4.62e-4,2);
00184     dv_dm(GAS)=(4.62e-8*P + 0.002462)*no*no/pow( (2.31e-5*P + 1)*no - 4.62e-4*ng, 2);
00185   }
00186 
00187   
00188 }

void FlashSimpleBlackOil::printOutput (  )  [virtual]

Reimplemented from FlashCompositional.

Definition at line 191 of file flashsimpleblackoil.cpp.

00192 {
00193   HDF5OrthoWriter &hdf5 = HDF5OrthoWriter::getHDF5OrthoWriter(); 
00194   unsigned nCells = m_mesh.numCells();
00195   VecDouble vc(nCells);
00196   VecDouble vcSatC(nCells);
00197   FlashData data(numPhases(),numComponents());
00198   VecDouble vv(m_mesh.numVertices());
00199   VecDouble phasesVol(2);
00200   for (unsigned i=0;i<nCells;i++)
00201   {
00202     flash(i,data);
00203     //vc(i)=data.getMoles(AQUEOUS,CO2);
00204     getPhasesVolume(getDynamicModule().getPressureAtCells()(i),data,phasesVol);
00205     vcSatC(i)=phasesVol(1)/(phasesVol(0)+phasesVol(1));
00206   }
00207   //m_mesh.projectCentralValuesAtVertices(vc,vv);
00208   //hdf5.writeScalarField(vv,"ngw");
00209 
00210 
00211   m_mesh.projectCentralValuesAtVertices(vcSatC,vv);
00212   hdf5.writeScalarField(vv,"SatC");
00213 
00214 }


Member Data Documentation

Definition at line 16 of file flashsimpleblackoil.h.

Definition at line 18 of file flashsimpleblackoil.h.

Definition at line 17 of file flashsimpleblackoil.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Sun Apr 8 23:13:08 2012 for CO2INJECTION by  doxygen 1.6.3