#include <flashco2brine.h>


Public Types | |
| enum | Phases { AQUEOUS, CO2_RICH, SOLID } |
| enum | Components { WATER, CO2, SALT } |
| typedef double | Gradient [3][3] |
Public Member Functions | |
| FlashCO2Brine (OrthoMesh &mesh, double referenceT, double v1=5.7870370370370369e-9, double v2=6.944445e-10) | |
| virtual | ~FlashCO2Brine () |
| virtual void | flash (double P, const VecDouble &compTotalMoles, FlashData &data) |
| virtual const VecDouble & | getComponentsMolarMass () const |
| virtual double | getFluidCompressibility (double P, FlashData &data) |
| virtual void | getPhasesVolume (double P, const FlashData &data, VecDouble &phasesVol) |
| virtual void | getPhasesViscosities (double P, const FlashData &data, VecDouble &visc) |
| virtual void | getTotalVolumeDerivatives (double P, FlashData &data, VecDouble &dv_dm) |
| double | getPureCO2MolarVolume (double P, double T) |
| double | getCO2MolarVolume (double P, double T) |
| double | getTotalMolarVolume (Flash::BrineCO2Data &data, double P, double T) |
| double | getAqueousMolarVolume (Flash::BrineCO2Data &data, double P, double T) |
| double | getCO2MolarVolume (Flash::BrineCO2Data &data, double P, double T) |
| double | getDissolvedCO2ApparentVolume (double P) |
| void | flash (VecDouble &m_Aq, VecDouble &m_g, const VecDouble &m_T, double P, double T) |
| void | getSaturationDerivatives () |
| void | printFlashPropertiesTable (double P0, double P1, unsigned nP, double T, double zSalt) |
| void | printCO2RichMolarVolume (double P0, double P1, unsigned nP, double T) |
| void | getGradient (Matrix &gradMaq, Matrix &gradMg, const VecDouble &m_T, double P, double T, double h) |
| void | getVolGradient (VecDouble &GradVaq, VecDouble &GradVc, double P, double T, double zSalt, double zH2O, double zCO2, double h) |
| void | getMolesAqueousPhase (VecDouble &M_aq, const Flash::BrineCO2Data &data, double nT) |
| void | getMolesCO2RichPhase (VecDouble &M_g, const Flash::BrineCO2Data &data, double nT) |
| virtual void | printOutput () |
Protected Attributes | |
| VecDouble | m_components_molar_mass |
| double | m_T |
| double | m_volCell |
| OrthoMesh & | m_mesh |
| double | m_A |
| double | m_B |
| double | m_v1 |
| double | m_v2 |
Static Protected Attributes | |
| static bool | bFirstTime |
This is the flash module that uses Allan code.
=============== IMPORTANT: ==============
It is very important to note that the units of the fields matters a lot here. We use N/m^2 for pressure, Kelvin for temperature, and the volumes are measured in m^3. Please pay attention on that issue. Always ask yourself what is the unit of the parameters you pass to the methods here.
Definition at line 28 of file flashco2brine.h.
| typedef double FlashCO2Brine::Gradient[3][3] |
Definition at line 42 of file flashco2brine.h.
Definition at line 40 of file flashco2brine.h.
| FlashCO2Brine::FlashCO2Brine | ( | OrthoMesh & | mesh, | |
| double | referenceT, | |||
| double | v1 = 5.7870370370370369e-9, |
|||
| double | v2 = 6.944445e-10 | |||
| ) |
Definition at line 16 of file flashco2brine.cpp.
00017 :FlashCompositional(2,3),m_T(referenceT),m_mesh(mesh),m_v1(v1),m_v2(v2) 00018 { 00019 m_volCell = mesh.cellVolume(); 00020 //m_volMolarH2O= 18.16E-6; // m³/mol 00021 00022 //Set some coeficients used to calculate the apparent molar volume of dissolved co2 (see this::getDissolvedCO2ApparentVolume) 00023 m_A=0.38384020e-3*m_T*m_T -0.55953850*m_T + 0.30429268e+3 -0.72044305e+5/m_T + 0.63003388e+7/(m_T*m_T); 00024 m_B=-0.57709332e-5*m_T*m_T +0.82764653e-2*m_T -0.43813556e+1 +0.10144907e+4/m_T - 0.86777045e+5/(m_T*m_T); 00025 00026 //Set the vector of molar masses (in Kg) for each component 00027 m_components_molar_mass.reinit(3); 00028 m_components_molar_mass(WATER)=18.01528e-3; 00029 m_components_molar_mass(CO2 )=44.01e-3; 00030 m_components_molar_mass(SALT )=58.443e-3; 00031 00032 }
| virtual FlashCO2Brine::~FlashCO2Brine | ( | ) | [inline, virtual] |
Definition at line 44 of file flashco2brine.h.
| void FlashCO2Brine::flash | ( | VecDouble & | m_Aq, | |
| VecDouble & | m_g, | |||
| const VecDouble & | m_T, | |||
| double | P, | |||
| double | T | |||
| ) |
Definition at line 464 of file flashco2brine.cpp.
00465 { 00466 assert(m_T.size()==3); 00467 assert(m_aq.size()==3); 00468 assert(m_g.size()==3); 00469 00470 //Find total moles. 00471 Flash::BrineCO2Data brineco2Data; 00472 double nT=m_T(WATER)+m_T(CO2)+m_T(SALT); 00473 //Find molar concentration of each component 00474 double zH2O =m_T(WATER)/nT; 00475 double zCO2 =m_T(CO2) /nT; 00476 double zSalt=m_T(SALT) /nT; 00477 00478 Flash::ProgressiveFlashBrineCO2(brineco2Data, T, P, zSalt, zH2O, zCO2); 00479 getMolesCO2RichPhase(m_g ,brineco2Data,nT); 00480 getMolesAqueousPhase(m_aq,brineco2Data,nT); 00481 00482 00483 }
| void FlashCO2Brine::flash | ( | double | P, | |
| const VecDouble & | compTotalMoles, | |||
| FlashData & | data | |||
| ) | [virtual] |
Reimplemented from FlashCompositional.
Reimplemented in FlashCO2BrinePw.
Definition at line 42 of file flashco2brine.cpp.
00043 { 00044 //Gambiarra 00045 static VecDouble compTotalMoles(3); 00046 compTotalMoles(0)=std::max(compTotalMoles2(0),0.0); 00047 compTotalMoles(1)=std::max(compTotalMoles2(1),0.0); 00048 compTotalMoles(2)=std::max(compTotalMoles2(2),0.0); 00049 00050 00051 assert(compTotalMoles.size()==3); 00052 assert(data.getNPhases()==2); 00053 assert(data.getNComponents()==3); 00054 00055 00056 assert(compTotalMoles(0)>=0.0); 00057 assert(compTotalMoles(1)>=0.0); 00058 assert(compTotalMoles(2)>=0.0); 00059 00060 //Allans code does not handle the case we dont have water. 00061 //So I have to add this case. 00062 if (compTotalMoles(WATER) == 0.0) 00063 { 00064 data.zeroEntries(); 00065 data.setMoles(CO2_RICH,CO2,compTotalMoles(CO2)); 00066 return; 00067 } 00068 00069 //Find total moles. 00070 Flash::BrineCO2Data brineco2Data; 00071 double nT=compTotalMoles(WATER)+compTotalMoles(CO2)+compTotalMoles(SALT); 00072 //Find molar concentration of each component 00073 double zH2O =compTotalMoles(WATER)/nT; 00074 double zCO2 =compTotalMoles(CO2) /nT; 00075 double zSalt=compTotalMoles(SALT) /nT; 00076 00077 00078 Flash::ProgressiveFlashBrineCO2(brineco2Data, m_T, Units::NewtonToBars(P), zSalt, zH2O, zCO2); 00079 00080 data.setMoles(CO2_RICH,WATER,nT*brineco2Data.betaC*brineco2Data.yH2O); 00081 data.setMoles(CO2_RICH,CO2 ,nT*brineco2Data.betaC*brineco2Data.yCO2); 00082 data.setMoles(CO2_RICH,SALT ,0); 00083 data.setMoles(AQUEOUS ,WATER,nT*brineco2Data.betaA*brineco2Data.xH2O); 00084 data.setMoles(AQUEOUS ,CO2 ,nT*brineco2Data.betaA*brineco2Data.xCO2); 00085 data.setMoles(AQUEOUS ,SALT ,nT*brineco2Data.betaA*brineco2Data.xNaCl); 00086 00087 if ( brineco2Data.betaS != 0) 00088 printf("Warning, Salt Production\n"); 00089 if ( brineco2Data.stateCO2 == Flash::LIQUID) 00090 printf("Warning, Liquid CO2 produced P=%g Bars\n",Units::NewtonToBars(P)); 00091 }
| double FlashCO2Brine::getAqueousMolarVolume | ( | Flash::BrineCO2Data & | data, | |
| double | P, | |||
| double | T | |||
| ) |
Definition at line 273 of file flashco2brine.cpp.
00274 { 00275 return data.betaA*(data.xH2O*LIQ_WATER_MOLAR_VOLUME + data.xNaCl*DISSOLVED_SALT_MOLAR_VOLUME + data.xCO2*getDissolvedCO2ApparentVolume(P)); 00276 }
| double FlashCO2Brine::getCO2MolarVolume | ( | Flash::BrineCO2Data & | data, | |
| double | P, | |||
| double | T | |||
| ) |
Definition at line 278 of file flashco2brine.cpp.
00279 { 00280 return data.betaC*Flash::ComputeVolumeCO2(T,P,data.stateCO2);//Add the co2 rich phase molar volume 00281 }
| double FlashCO2Brine::getCO2MolarVolume | ( | double | P, | |
| double | T | |||
| ) |
| const VecDouble & FlashCO2Brine::getComponentsMolarMass | ( | ) | const [virtual] |
Get the molar mass for each component in kg/mol
Reimplemented from FlashCompositional.
Definition at line 154 of file flashco2brine.cpp.
00155 { 00156 return m_components_molar_mass; 00157 }
| double FlashCO2Brine::getDissolvedCO2ApparentVolume | ( | double | P | ) |
Return the dissolved co2 apparent volume
| P | Pressure in BARS | |
| T | Temperature in Kelvins |
Definition at line 301 of file flashco2brine.cpp.
00302 { 00303 //Volume in cm^3 00304 return LIQ_WATER_MOLAR_VOLUME*(1+m_A+P*m_B); 00305 }
| double FlashCO2Brine::getFluidCompressibility | ( | double | P, | |
| FlashData & | data | |||
| ) | [virtual] |
This function gives the negative of the derivative of the volume of the mixture in relation to pressure
| P | (N/m^2) |
Reimplemented from FlashCompositional.
Reimplemented in FlashCO2BrineUncomp.
Definition at line 101 of file flashco2brine.cpp.
00102 { 00103 00104 Flash::BrineCO2Data brineco2Data; 00105 double h=P*1.e-07; 00106 double nT; 00107 static VecDouble compC(3); 00108 data.getMixtureComposition(compC,nT); 00109 //Calculate the Volume adding h to Pressure 00110 double Ph=Units::NewtonToBars(P+h); 00111 if (compC(WATER) == 0.0) 00112 { 00113 brineco2Data.xCO2 = 0.0; 00114 brineco2Data.xH2O = 0.0; 00115 brineco2Data.xNaCl= 0.0; 00116 brineco2Data.yCO2 = 1.0; 00117 brineco2Data.yH2O = 0; 00118 brineco2Data.betaC = compC(CO2)/(compC(CO2)+compC(SALT)); 00119 brineco2Data.betaS = 1.-brineco2Data.betaC; 00120 brineco2Data.stateCO2=Flash::GAS; 00121 } 00122 else 00123 Flash::ProgressiveFlashBrineCO2(brineco2Data, m_T, Ph, compC(SALT), compC(WATER), compC(CO2)); 00124 double Vpos=Units::cm3Tom3(getTotalMolarVolume(brineco2Data,Ph,m_T)); 00125 00126 //Calculate the Volume subtracting h to Pressure 00127 Ph=Units::NewtonToBars(P-h); 00128 if (compC(WATER) != 0.0) 00129 { 00130 Flash::ProgressiveFlashBrineCO2(brineco2Data, m_T, Ph, compC(SALT), compC(WATER), compC(CO2)); 00131 } 00132 double Vneg=Units::cm3Tom3(getTotalMolarVolume(brineco2Data,Ph,m_T)); 00133 00134 //Approximate the derivative using the central difference scheme. 00135 return -nT*(Vpos-Vneg)/(2*h); 00136 }
| void FlashCO2Brine::getGradient | ( | Matrix & | gradMaq, | |
| Matrix & | gradMg, | |||
| const VecDouble & | m_T, | |||
| double | P, | |||
| double | T, | |||
| double | h | |||
| ) |
| gradMaq | The gradient of moles composition of the aquous phase as function of total moles compositions | |
| gradMg | The gradient of moles composition of the co2-rich phase as function of total moles compositions | |
| P | Total pressure | |
| T | Temperature | |
| h | Space discretization |
Definition at line 436 of file flashco2brine.cpp.
00437 { 00438 assert(WATER==0 && CO2==1 && SALT==2); 00439 static VecDouble maqPos(3),maqNeg(3); 00440 static VecDouble mgPos(3),mgNeg(3); 00441 static VecDouble m_TPos(3),m_TNeg(3); 00442 00443 double dx=2*h; 00444 00445 for (unsigned i=0;i<3;i++) 00446 { 00447 m_TPos=m_T; 00448 m_TNeg=m_T; 00449 m_TPos(i)+=h; 00450 m_TNeg(i)-=h; 00451 flash(maqPos,mgPos,m_TPos,P,T); 00452 flash(maqNeg,mgNeg,m_TNeg,P,T); 00453 00454 gradMaq(WATER,i)=(maqPos(WATER) - maqNeg(WATER))/dx; 00455 gradMaq(CO2 ,i)=(maqPos(CO2 ) - maqNeg(CO2 ))/dx; 00456 gradMaq(SALT ,i)=(maqPos(SALT ) - maqNeg(SALT ))/dx; 00457 gradMg (WATER,i)=(mgPos (WATER) - mgNeg(WATER ))/dx; 00458 gradMg (CO2 ,i)=(mgPos (CO2 ) - mgNeg(CO2 ))/dx; 00459 gradMg (SALT ,i)=(mgPos (SALT ) - mgNeg(SALT ))/dx; 00460 } 00461 00462 }
| void FlashCO2Brine::getMolesAqueousPhase | ( | VecDouble & | M_aq, | |
| const Flash::BrineCO2Data & | data, | |||
| double | nT | |||
| ) |
Given the flash output data and the amount of total moles in the mixture, this functions returns the moles at the Aquous phase at the vector M_aq
| M_aq | Vector to contain the moles of each component in the aquous phase. | |
| data | Data of the flash | |
| nT | Total number of moles in the system. |
Definition at line 403 of file flashco2brine.cpp.
00404 { 00405 assert(M_aq.size()==3); 00406 M_aq(FlashCO2Brine::WATER)=nT*data.betaA*data.xH2O; 00407 M_aq(FlashCO2Brine::CO2)= nT*data.betaA*data.xCO2; 00408 M_aq(FlashCO2Brine::SALT)= nT*data.betaA*data.xNaCl; 00409 00410 }
| void FlashCO2Brine::getMolesCO2RichPhase | ( | VecDouble & | M_g, | |
| const Flash::BrineCO2Data & | data, | |||
| double | nT | |||
| ) |
Given the flash output data and the amount of total moles in the mixture, this functions returns the moles at the Aquous phase at the vector M_aq
| M_aq | Vector to contain the moles of each component in the aquous phase. | |
| data | Data of the flash | |
| nT | Total number of moles in the system. |
Definition at line 419 of file flashco2brine.cpp.
00420 { 00421 assert(M_g.size()==3); 00422 M_g(FlashCO2Brine::WATER)=nT*data.betaC*data.yH2O; 00423 M_g(FlashCO2Brine::CO2)= nT*data.betaC*data.yCO2; 00424 M_g(FlashCO2Brine::SALT)= 0.0; 00425 00426 }
| void FlashCO2Brine::getPhasesViscosities | ( | double | P, | |
| const FlashData & | data, | |||
| VecDouble & | visc | |||
| ) | [virtual] |
Reimplemented from FlashCompositional.
Definition at line 492 of file flashco2brine.cpp.
| void FlashCO2Brine::getPhasesVolume | ( | double | P, | |
| const FlashData & | data, | |||
| VecDouble & | phasesVol | |||
| ) | [virtual] |
Get phases volumes in m^3
Reimplemented from FlashCompositional.
Reimplemented in FlashCO2BrinePw, and FlashCO2BrineUncomp.
Definition at line 140 of file flashco2brine.cpp.
00141 { 00142 assert(phasesVol.size()==2); 00143 assert(data.getNPhases()==2); 00144 assert(data.getNComponents()==3); 00145 double PBars=Units::NewtonToBars(P); 00146 phasesVol(AQUEOUS)=Units::cm3Tom3(data.getMoles(AQUEOUS,WATER)*LIQ_WATER_MOLAR_VOLUME + data.getMoles(AQUEOUS,SALT)*DISSOLVED_SALT_MOLAR_VOLUME + data.getMoles(AQUEOUS,CO2)*getDissolvedCO2ApparentVolume(PBars)); 00147 phasesVol(CO2_RICH)=Units::cm3Tom3((data.getMoles(CO2_RICH,WATER)+data.getMoles(CO2_RICH,CO2))*Flash::ComputeVolumeCO2(m_T,PBars)); 00148 00149 }
| double FlashCO2Brine::getPureCO2MolarVolume | ( | double | P, | |
| double | T | |||
| ) |
Gets the molar volume of pure CO2
| P | Pressure in Newtons | |
| T | Temperature in Kelvins |
Definition at line 288 of file flashco2brine.cpp.
00289 { 00290 return Units::cm3Tom3(Flash::ComputeVolumeCO2(T,Units::NewtonToBars(P)));//Add the co2 rich phase molar volume 00291 }
| void FlashCO2Brine::getSaturationDerivatives | ( | ) |
| double FlashCO2Brine::getTotalMolarVolume | ( | Flash::BrineCO2Data & | data, | |
| double | P, | |||
| double | T | |||
| ) |
Calculate the molar volume of the mixture in cm^3
| data | Data containing the distribution of compoenents along phases | |
| nT | Total number of moles in the mixture | |
| T | Total temperature | |
| P | Pressure in bars |
Definition at line 256 of file flashco2brine.cpp.
00257 { 00258 double tV; //To contain the result 00259 00260 tV=getCO2MolarVolume(data,P,T);//Add the co2 rich phase molar volume 00261 //Add the aquous phase molar volume 00262 tV+=getAqueousMolarVolume(data,P,T); 00263 00264 //Add the solid (pure salt) molar volume 00265 //tV+=data.betaS*SOLID_SALT_MOLAR_VOLUME; //Assuming no production of salt for while 00266 00267 return tV; 00268 }
| void FlashCO2Brine::getTotalVolumeDerivatives | ( | double | P, | |
| FlashData & | data, | |||
| VecDouble & | dv_dm | |||
| ) | [virtual] |
Reimplemented from FlashCompositional.
Reimplemented in FlashCO2BrineUncomp.
Definition at line 559 of file flashco2brine.cpp.
00560 { 00561 static VecDouble m(3); 00562 data.getTotalComponentsMoles(m); 00563 getNumericTotalVolumeDerivative(P,m,dv_dm,1e-04); 00564 00565 00566 00567 }
| void FlashCO2Brine::getVolGradient | ( | VecDouble & | GradVaq, | |
| VecDouble & | GradVc, | |||
| double | P, | |||
| double | T, | |||
| double | zSalt, | |||
| double | zH2O, | |||
| double | zCO2, | |||
| double | h | |||
| ) |
Definition at line 310 of file flashco2brine.cpp.
00311 { 00312 assert(GradVaq.size()==3); 00313 assert(GradVco.size()==3); 00314 Flash::BrineCO2Data brineco2Data; 00315 double Hpos,Hneg; 00316 double VposAq,VnegAq,VposCO,VnegCO; 00317 double dx; 00318 00319 00320 //Calculate the derivatives of molar volumes of each phase 00321 //for positive and negative increment of the water component 00322 dx=2*h; 00323 Hpos=zH2O+h; 00324 Hneg=zH2O-h; 00325 if (Hpos>1.0) 00326 { 00327 Hpos=zH2O; 00328 dx=h; 00329 } 00330 if (Hneg<0.0) 00331 { 00332 Hneg=zH2O; 00333 dx=h; 00334 } 00335 Flash::ProgressiveFlashBrineCO2(brineco2Data, T, P, zSalt, Hpos, zCO2); 00336 VposAq=getAqueousMolarVolume(brineco2Data,P,T); 00337 VposCO=getCO2MolarVolume(brineco2Data,P,T); 00338 Flash::ProgressiveFlashBrineCO2(brineco2Data, T, P, zSalt, Hneg, zCO2); 00339 VnegAq=getAqueousMolarVolume(brineco2Data,P,T); 00340 VnegCO=getCO2MolarVolume(brineco2Data,P,T); 00341 GradVaq(FlashCO2Brine::WATER)=(VposAq-VnegAq)/(dx); 00342 GradVco(FlashCO2Brine::WATER)=(VposCO-VnegCO)/(dx); 00343 00344 //Calculate the derivatives of molar volumes of each phase for 00345 //positive and negative increment of the CO2 component 00346 dx=2*h; 00347 Hpos=zCO2+h; 00348 Hneg=zCO2-h; 00349 if (Hpos>1.0) 00350 { 00351 Hpos=zCO2; 00352 dx=h; 00353 } 00354 if (Hneg<0.0) 00355 { 00356 Hneg=zCO2; 00357 dx=h; 00358 } 00359 Flash::ProgressiveFlashBrineCO2(brineco2Data, T, P, zSalt, zH2O, Hpos); 00360 VposAq=getAqueousMolarVolume(brineco2Data,P,T); 00361 VposCO=getCO2MolarVolume(brineco2Data,P,T); 00362 Flash::ProgressiveFlashBrineCO2(brineco2Data, T, P, zSalt, zH2O, Hneg); 00363 VnegAq=getAqueousMolarVolume(brineco2Data,P,T); 00364 VnegCO=getCO2MolarVolume(brineco2Data,P,T); 00365 GradVaq(FlashCO2Brine::CO2)=(VposAq-VnegAq)/(dx); 00366 GradVco(FlashCO2Brine::CO2)=(VposCO-VnegCO)/(dx); 00367 00368 00369 //Calculate the molar volumes for positive and negative increment 00370 dx=2*h; 00371 Hpos=zSalt+h; 00372 Hneg=zSalt-h; 00373 if (Hpos>1.0) 00374 { 00375 Hpos=zSalt; 00376 dx=h; 00377 } 00378 if (Hneg<0.0) 00379 { 00380 Hneg=zSalt; 00381 dx=h; 00382 } 00383 Flash::ProgressiveFlashBrineCO2(brineco2Data, T, P, Hpos, zH2O, zCO2); 00384 VposAq=getAqueousMolarVolume(brineco2Data,P,T); 00385 VposCO=getCO2MolarVolume(brineco2Data,P,T); 00386 Flash::ProgressiveFlashBrineCO2(brineco2Data, T, P, Hneg, zH2O, zCO2); 00387 VnegAq=getAqueousMolarVolume(brineco2Data,P,T); 00388 VnegCO=getCO2MolarVolume(brineco2Data,P,T); 00389 GradVaq(FlashCO2Brine::SALT)=(VposAq-VnegAq)/(dx); 00390 GradVco(FlashCO2Brine::SALT)=(VposCO-VnegCO)/(dx); 00391 00392 00393 00394 00395 }
| void FlashCO2Brine::printCO2RichMolarVolume | ( | double | P0, | |
| double | P1, | |||
| unsigned | nP, | |||
| double | T | |||
| ) |
Definition at line 225 of file flashco2brine.cpp.
00226 { 00227 double dP=(P1-P0)/nP; 00228 double P=P0; 00229 std::ofstream file1("co2GasMolarVolume.dat"); 00230 std::ofstream file2("co2CriticMolarVolume.dat"); 00231 char str[1500]; 00232 sprintf(str,"#Molar Volume of Gas CO2\n#Parameters: T=%gK\n#PRESSURE (BARS)\tVolume (cm^3)\n",T); 00233 file1 << str; 00234 sprintf(str,"#Molar Volume of Super Critic CO2\n#Parameters: T=%gK\n#PRESSURE (BARS)\tVolume (cm^3)\n",T); 00235 file2 << str; 00236 00237 for (unsigned i=0;i<nP;P+=dP,i++) 00238 { 00239 file1 << P << "\t" << Flash::ComputeVolumeCO2(T,P,Flash::GAS)<<std::endl; 00240 file2 << P << "\t" << Flash::ComputeVolumeCO2(T,P,Flash::SUPERCRITICAL)<<std::endl; 00241 } 00242 }
| void FlashCO2Brine::printFlashPropertiesTable | ( | double | P0, | |
| double | P1, | |||
| unsigned | nP, | |||
| double | T, | |||
| double | zSalt | |||
| ) |
Print the molar volume of the mixture as function of pressure, and concentration of CO2 and Water assuming a constant salt concentration
| P0 | Initial Pressure in bars | |
| P1 | End Pressure in bars | |
| nP | Number of points | |
| cSalt | Salt concentration in the system |
Definition at line 183 of file flashco2brine.cpp.
00184 { 00185 std::string solid; 00186 double dP=(P1-P0)/nP; 00187 double dZ=(1.0-zSalt)/nP; 00188 Flash::BrineCO2Data brineco2Data; 00189 static VecDouble m_aq(3),m_co(3),m_t(3),w(3); 00190 double P=P0; 00191 Matrix GradVaq(3,3),GradVco(3,3); 00192 printf("#Table of properties of the flash computations\n"); 00193 printf("#Fixed Parameters: T=%g zSalt=%g\n",T,zSalt); 00194 printf("#PRESSURE\tzCO2\tMolar Volume(cm^3)\tFluid Compressibility\tdSg/dm_g*m_aq"); 00195 for (unsigned i=0;i<=nP;P+=dP,i++) 00196 { 00197 double zCO2=0; 00198 for (unsigned j=0;j<nP;zCO2+=dZ,j++) 00199 { 00200 double zH2O=(1-zCO2-zSalt); 00201 Flash::ProgressiveFlashBrineCO2(brineco2Data, T, P, zSalt, zH2O, zCO2); 00202 00203 m_t(SALT )=zSalt; 00204 m_t(WATER)=zH2O; 00205 m_t(CO2 )=zCO2; 00206 00207 getGradient(GradVaq,GradVco,m_t,P,T,0.01); 00208 getMolesAqueousPhase(m_aq,brineco2Data,1); 00209 getMolesCO2RichPhase(m_co,brineco2Data,1); 00210 GradVaq.vmult(w,m_co); 00211 //w-=m_aq; 00212 if (brineco2Data.betaS != 0.0) 00213 solid="S"; 00214 else 00215 solid=""; 00216 //printf("%g\t%g\t%g\t%g\n",zCO2,GradVaq(0),GradVaq(1),GradVaq(2)); 00217 //printf("%g\t%g\n",P,Flash::ComputeVolumeCO2(T,P,brineco2Data.stateCO2)); 00218 printf("%g\t%g\t%g\t<%g,%g,%g> %s\n",P,zCO2,getTotalMolarVolume(brineco2Data,P,T),w(0),w(1),w(2),solid.c_str()); 00219 } 00220 printf("\n"); 00221 } 00222 }
| void FlashCO2Brine::printOutput | ( | ) | [virtual] |
(phasesVol(AQUEOUS)+phasesVol(CO2_RICH));
Reimplemented from FlashCompositional.
Definition at line 499 of file flashco2brine.cpp.
00500 { 00501 HDF5OrthoWriter &hdf5 = HDF5OrthoWriter::getHDF5OrthoWriter(); 00502 unsigned nCells = m_mesh.numCells(); 00503 VecDouble vc(nCells); 00504 VecDouble vcSatC(nCells); 00505 FlashData data(numPhases(),numComponents(),NULL); 00506 VecDouble vv(m_mesh.numVertices()); 00507 VecDouble phasesVol(2); 00508 for (unsigned i=0;i<nCells;i++) 00509 { 00510 FlashCompositional::flash(i,data); 00511 getPhasesVolume(getDynamicModule().getPressureAtCells()(i),data,phasesVol); 00512 vcSatC(i)=phasesVol(CO2_RICH); 00513 } 00514 m_mesh.projectCentralValuesAtVertices(vcSatC,vv); 00515 hdf5.writeScalarField(vv,"SatC"); 00516 00517 getFlashDataArray().getVectorData(CO2_RICH,WATER,vc); 00518 m_mesh.projectCentralValuesAtVertices(vc,vv); 00519 hdf5.writeScalarField(vv,"ngw"); 00520 00521 00522 getFlashDataArray().getVectorData(CO2_RICH,CO2,vc); 00523 m_mesh.projectCentralValuesAtVertices(vc,vv); 00524 hdf5.writeScalarField(vv,"ngc"); 00525 00526 00527 getFlashDataArray().getVectorData(AQUEOUS,WATER,vc); 00528 m_mesh.projectCentralValuesAtVertices(vc,vv); 00529 hdf5.writeScalarField(vv,"naqw"); 00530 00531 getFlashDataArray().getVectorData(AQUEOUS,CO2,vc); 00532 m_mesh.projectCentralValuesAtVertices(vc,vv); 00533 hdf5.writeScalarField(vv,"naqc"); 00534 00535 { 00536 VecDouble vc2(nCells); 00537 getFlashDataArray().getVectorData(AQUEOUS,WATER,vc2); 00538 NumericMethods::divideEachElement(vc,vc,vc2); 00539 m_mesh.projectCentralValuesAtVertices(vc,vv); 00540 hdf5.writeScalarField(vv,"Cco2"); 00541 00542 00543 } 00544 00545 00546 00547 getFlashDataArray().getVectorData(AQUEOUS,SALT,vc); 00548 m_mesh.projectCentralValuesAtVertices(vc,vv); 00549 hdf5.writeScalarField(vv,"naqs"); 00550 00551 00552 m_mesh.projectCentralValuesAtVertices(vcSatC,vv); 00553 hdf5.writeScalarField(vv,"SatC"); 00554 00555 00556 }
bool FlashCO2Brine::bFirstTime [static, protected] |
Definition at line 36 of file flashco2brine.h.
double FlashCO2Brine::m_A [protected] |
Definition at line 37 of file flashco2brine.h.
double FlashCO2Brine::m_B [protected] |
Definition at line 37 of file flashco2brine.h.
VecDouble FlashCO2Brine::m_components_molar_mass [protected] |
To contain the molar mass for each component g/mol
Definition at line 32 of file flashco2brine.h.
OrthoMesh& FlashCO2Brine::m_mesh [protected] |
Definition at line 35 of file flashco2brine.h.
double FlashCO2Brine::m_T [protected] |
Reference temperature
Definition at line 33 of file flashco2brine.h.
double FlashCO2Brine::m_v1 [protected] |
Definition at line 38 of file flashco2brine.h.
double FlashCO2Brine::m_v2 [protected] |
Definition at line 38 of file flashco2brine.h.
double FlashCO2Brine::m_volCell [protected] |
Volume of the cells
Definition at line 34 of file flashco2brine.h.
1.6.3