TraceFaceFluxWithGravity Class Reference

#include <tracefacefluxwithgravity.h>

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

List of all members.

Public Member Functions

 TraceFaceFluxWithGravity (unsigned numFaces, Function1D &fMobW, Function1D &fMobGrav, VecDouble &cK, double gc)
 ~TraceFaceFluxWithGravity ()
virtual double fluxAtFace (OrthoMesh::Face_It &faceIt, int face, int cell1, int cell2, double &u1, double &u2)
virtual void setVelocity (DynamicBase &dynMod)
virtual void setSw (VecDouble &cSw)
virtual VecDoublegetSw ()
virtual void maxGlobalCharVelocity (double vel[3])
virtual double maxLocalCharVelocity (OrthoMesh::Face_It &faceIt, int face, int cell1, int cell2, double &u1, double &u2)
virtual ~FaceFluxFunction ()

Private Attributes

Function1Dm_fMobW
Function1Dm_fMobGrav
VecDoublem_cK
VecDoublem_pcSw
double m_gc
double m_maxK
Matrix m_Vel

Detailed Description

Implement the flux function of the dissolved CO2 equation given by the expression: ((1-mobW(Sw))*Vdt + mobGrav(Sw)*gc*Grad(Z))/(1-Sw)

IMPORTANT: This flux function assumers that the domain of the functions mobW e mobGrav is beetween [0,1] and that the mobW is a non decreasing function ( derivative is always greater than zero). Remeber that grad (Z) == <0, 0, 1>.

Definition at line 16 of file tracefacefluxwithgravity.h.


Constructor & Destructor Documentation

TraceFaceFluxWithGravity::TraceFaceFluxWithGravity ( unsigned  numFaces,
Function1D fMobW,
Function1D fMobGrav,
VecDouble cK,
double  gc 
)

Definition at line 4 of file tracefacefluxwithgravity.cpp.

00005   :m_fMobW(fMobW),m_fMobGrav(fMobGrav),m_cK(cK),m_Vel(numFaces,3)
00006 {
00007   m_gc = gc;
00008   m_maxK = cK.linfty_norm();
00009 }

TraceFaceFluxWithGravity::~TraceFaceFluxWithGravity (  ) 
virtual TraceFaceFluxWithGravity::~FaceFluxFunction (  )  [inline, virtual]

Reimplemented from FaceFluxFunction.

Definition at line 37 of file tracefacefluxwithgravity.h.

00037 {}


Member Function Documentation

double TraceFaceFluxWithGravity::fluxAtFace ( OrthoMesh::Face_It faceIt,
int  face,
int  cell1,
int  cell2,
double &  u1,
double &  u2 
) [virtual]

This method compute the flux at a face using the values of u1 and u2 located in the two cells that share the face.

Parameters:
faceIt The face iteratator of the OrthoMesh.
face Index of the face
cell1 Index of the cell that contains the face
cell2 Index of the second cell that contains the face
u1 Value of the numeric solution for cell1
u2 Value of the numeric solution for cell2
Returns:
The flux at face

Definition at line 21 of file tracefacefluxwithgravity.cpp.

00022 {
00023   assert( (unsigned) face < m_Vel.m());
00024   assert( (unsigned) cell1 < m_cK.size());
00025   assert( (unsigned) cell2 < m_cK.size());
00026   assert(m_cK.size() == getSw().size());
00027   VecDouble &cVSw = getSw();
00028   double S1 = cVSw(cell1);
00029   double S2 = cVSw(cell2);
00030   
00031   double dMobW1 = 1-m_fMobW(S1);
00032   double dMobW2 = 1-m_fMobW(S2);
00033   double *vel = &m_Vel(face,0);
00034   double flux = (dMobW1+dMobW2)/2.0*faceIt->normal_multiply(vel);
00035   
00036   //If the face has normal in the Z direction, then add the gravity term.
00037   if (faceIt->getNormalNonZeroComponent() == Z && !faceIt->at_boundary() )
00038   {
00039     VecDouble &cK = getPermeability();
00040     double K1 = cK(cell1);
00041     double K2 = cK(cell2);
00042     flux += (m_fMobGrav(S1) + m_fMobGrav(S2)) * K1*K2/(K1+K2) * m_gc; 
00043   }
00044   return (u1+u2)/(S1+S2)*flux/(S;
00045 }

virtual VecDouble& TraceFaceFluxWithGravity::getSw (  )  [inline, virtual]

Definition at line 34 of file tracefacefluxwithgravity.h.

00034 {assert(m_pcS);return *m_pcSw;}

void TraceFaceFluxWithGravity::maxGlobalCharVelocity ( double  vel[3]  )  [virtual]

Reimplemented from FaceFluxFunction.

Definition at line 49 of file tracefacefluxwithgravity.cpp.

00050 {
00051   VecDouble minVel(3);
00052   VecDouble maxVel(3);
00053 
00054   NumericMethods::getMinMaxValueByColumn(m_Vel,minVel,maxVel);
00055   vel[X]= NumericMethods::maxMod(minVel(X),maxVel(X))*m_fMobW.getMaxNormGrad(0,1);
00056   vel[Y]= NumericMethods::maxMod(minVel(Y),maxVel(Y))*m_fMobW.getMaxNormGrad(0,1);
00057   vel[Z]= NumericMethods::maxMod(minVel(Z),maxVel(Z))*m_fMobW.getMaxNormGrad(0,1) + m_maxK*fabs(m_fMobGrav.getMaxNormGrad(0,1)*m_gc);
00058 }

double TraceFaceFluxWithGravity::maxLocalCharVelocity ( OrthoMesh::Face_It faceIt,
int  face,
int  cell1,
int  cell2,
double &  u1,
double &  u2 
) [virtual]

Definition at line 62 of file tracefacefluxwithgravity.cpp.

00063 {
00064   assert(u1<=u2);
00065   double *vel = &(m_Vel(face,0));
00066   
00067   if (faceIt->getNormalNonZeroComponent() != Z)
00068     return  faceIt->normal_multiply(vel)*m_fMobW.getMaxNormGrad(u1,u2);
00069   else
00070   {
00071     double term1 = faceIt->normal_multiply(vel)*m_fMobW.getMaxNormGrad(u1,u2);
00072 
00073     //Get the max permeability
00074     double K = fmax(getPermeability()(cell1), getPermeability()(cell2));
00075 
00076     //The m_fMobGrav function can have negative derivative.
00077     //An the gravity term of the flux can be negative or positive.
00078     double dMax,dMin;
00079     m_fMobGrav.getMinMaxGradValues(u1,u2,dMin,dMax); 
00080 
00081     double result1 = term1 + K*dMin*m_gc;
00082     double result2 = term1 + K*dMax*m_gc;
00083 
00084     if (fabs(result1) < fabs(result2))
00085       return result2;
00086     else
00087       return result1;
00088   }
00089 }

virtual void TraceFaceFluxWithGravity::setSw ( VecDouble cSw  )  [inline, virtual]

Definition at line 33 of file tracefacefluxwithgravity.h.

00033 {m_pcSw = &cSw;}

void TraceFaceFluxWithGravity::setVelocity ( DynamicBase dynMod  )  [virtual]

Definition at line 92 of file tracefacefluxwithgravity.cpp.

00093 {
00094   dynMod.getVelocitiesAtFaces(m_Vel);
00095 }


Member Data Documentation

Definition at line 20 of file tracefacefluxwithgravity.h.

Definition at line 19 of file tracefacefluxwithgravity.h.

Definition at line 19 of file tracefacefluxwithgravity.h.

Definition at line 22 of file tracefacefluxwithgravity.h.

Definition at line 23 of file tracefacefluxwithgravity.h.

Definition at line 21 of file tracefacefluxwithgravity.h.

Definition at line 24 of file tracefacefluxwithgravity.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:29 2012 for CO2INJECTION by  doxygen 1.6.3