FlashHenryLaw Class Reference

#include <flashhenrylaw.h>

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

List of all members.

Public Types

enum  Phases { AQUEOUS, CO2_RICH, SOLID }
enum  Components { WATER, CO2 }

Public Member Functions

 FlashHenryLaw (OrthoMesh &mesh, double Kh, double vn, double R, double T, double mc, double mw, double vc, double vw)
 ~FlashHenryLaw ()
virtual void getPhasesVolume (double P, const FlashData &data, VecDouble &phasesVol)
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 void printOutput ()

Private Attributes

double m_invKh
double m_c
double m_mc
double m_mw
double m_vc
double m_vw
double m_co2MV
double m_H2OMV
VecDouble m_components_molar_mass
OrthoMeshm_mesh

Detailed Description

This class implements a simple flash for CO2 dissolution in pure water assuming the Henry Law. This Flash has just two components Water and CO2. Such Flash was used in the Obi Blunt model. For now the temperature is constant and set to 80 C. We have ideal mixing and supercritic co2 incompressibility.

Definition at line 15 of file flashhenrylaw.h.


Member Enumeration Documentation

Enumerator:
WATER 
CO2 

Definition at line 26 of file flashhenrylaw.h.

00026 {WATER,CO2};

Enumerator:
AQUEOUS 
CO2_RICH 
SOLID 

Definition at line 25 of file flashhenrylaw.h.

00025 {AQUEOUS, CO2_RICH, SOLID};


Constructor & Destructor Documentation

FlashHenryLaw::FlashHenryLaw ( OrthoMesh mesh,
double  Kh,
double  vn,
double  R,
double  T,
double  mc,
double  mw,
double  vc,
double  vw 
)

Construct the flass module with the constants used in the Henry Law

Parameters:
Kh Henry Law Coefficien
vn Apparent volume of CO2 at infinite dissolution
R Universal constant of gas
T Temperature (Kelvin)
mc Molar volume of the supercriticCO2
mw Molar volume of the water
Returns:

Definition at line 13 of file flashhenrylaw.cpp.

00014    :FlashCompositional(2,2),
00015     m_invKh(1.0/Kh),
00016     m_c(-vn/(R*T)),
00017     m_vc(vc),
00018     m_vw(vw),
00019     m_co2MV(mc),
00020     m_H2OMV(mw),
00021     m_mesh(mesh)
00022 {
00023   m_components_molar_mass.reinit(2);
00024   m_components_molar_mass(WATER)=18.01528e-3;
00025   m_components_molar_mass(CO2)=44.01e-3;
00026 
00027   //set the molar volumes
00028   //m_co2MV=6.1957868649318467E-5; //m3/moles
00029   //m_H2OMV=1.7157409523809526E-5;
00030 }

FlashHenryLaw::~FlashHenryLaw (  ) 

Definition at line 97 of file flashhenrylaw.cpp.

00098 {
00099 
00100 }


Member Function Documentation

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

Reimplemented from FlashCompositional.

Definition at line 60 of file flashhenrylaw.cpp.

00061 {
00062   //Calculate the maximum allowed mole fraction of dissolved co2
00063   double XD = P*m_invKh*exp(m_c*P);
00064 
00065   //Calculate the maximum co2 moles that can dissolve.
00066   double mdCO2=XD*compTotalMoles(WATER)/(1-XD);
00067 
00068   //Get the total moles of co2;
00069   double totalCO2=compTotalMoles(CO2);
00070 
00071   if (totalCO2>mdCO2)
00072   {
00073     //water always in the aqueous phase
00074     data.setMoles(AQUEOUS,WATER,compTotalMoles(WATER));
00075     data.setMoles(CO2_RICH,WATER,0);
00076 
00077     //Maximum dissolved co2 goes to water
00078     data.setMoles(AQUEOUS,CO2,mdCO2);
00079     //the remaining co2 stays in co2 rich phase
00080     data.setMoles(CO2_RICH,CO2,totalCO2-mdCO2);
00081     
00082   }
00083   else
00084   {
00085     //water always in the aqueous phase
00086     data.setMoles(AQUEOUS,WATER,compTotalMoles(WATER));
00087     data.setMoles(CO2_RICH,WATER,0);
00088 
00089     //All the CO2 goes into water
00090     data.setMoles(AQUEOUS,CO2,totalCO2);
00091     //nothing to be in the co2  rich phase
00092     data.setMoles(CO2_RICH,CO2,0);
00093   }
00094 }

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

Get the molar mass for each component

Reimplemented from FlashCompositional.

Definition at line 41 of file flashhenrylaw.cpp.

00042 {
00043   return m_components_molar_mass;
00044 }

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

Reimplemented from FlashCompositional.

Definition at line 34 of file flashhenrylaw.cpp.

00035 {
00036   assert(visc.size() == 2);
00037   visc(0)=m_vw;
00038   visc(1)=m_vc;
00039 }

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

Get phases volumes

Reimplemented from FlashCompositional.

Definition at line 47 of file flashhenrylaw.cpp.

00048 {
00049   assert(data.getNPhases() == 2);
00050   assert(data.getNComponents() ==2);
00051   assert(phasesVol.size() ==2);
00052 
00053   phasesVol(1)=(data.getMoles(AQUEOUS,CO2) + data.getMoles(CO2_RICH,CO2))*m_co2MV;
00054   phasesVol(0)=data.getMoles(AQUEOUS,WATER)*m_H2OMV;
00055 
00056   
00057   
00058 }

void FlashHenryLaw::printOutput (  )  [virtual]

Reimplemented from FlashCompositional.

Definition at line 103 of file flashhenrylaw.cpp.

00104 {
00105   HDF5OrthoWriter &hdf5 = HDF5OrthoWriter::getHDF5OrthoWriter(); 
00106   unsigned nCells = m_mesh.numCells();
00107   VecDouble vc(nCells);
00108   VecDouble vcSatC(nCells);
00109   FlashData data(numPhases(),numComponents(),NULL);
00110   VecDouble vv(m_mesh.numVertices());
00111   VecDouble phasesVol(2);
00112   for (unsigned i=0;i<nCells;i++)
00113   {
00114     FlashCompositional::flash(i,data);
00115     getPhasesVolume(getDynamicModule().getPressureAtCells()(i),data,phasesVol);
00116     vcSatC(i)=phasesVol(CO2_RICH)/(phasesVol(AQUEOUS)+phasesVol(CO2_RICH));
00117   }
00118   m_mesh.projectCentralValuesAtVertices(vcSatC,vv);
00119   hdf5.writeScalarField(vv,"SatC");
00120 
00121 }


Member Data Documentation

double FlashHenryLaw::m_c [private]

Definition at line 18 of file flashhenrylaw.h.

double FlashHenryLaw::m_co2MV [private]

Definition at line 19 of file flashhenrylaw.h.

Definition at line 20 of file flashhenrylaw.h.

double FlashHenryLaw::m_H2OMV [private]

Definition at line 19 of file flashhenrylaw.h.

double FlashHenryLaw::m_invKh [private]

Definition at line 18 of file flashhenrylaw.h.

double FlashHenryLaw::m_mc [private]

Definition at line 18 of file flashhenrylaw.h.

Definition at line 21 of file flashhenrylaw.h.

double FlashHenryLaw::m_mw [private]

Definition at line 18 of file flashhenrylaw.h.

double FlashHenryLaw::m_vc [private]

Definition at line 18 of file flashhenrylaw.h.

double FlashHenryLaw::m_vw [private]

Definition at line 18 of file flashhenrylaw.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