#include <tracefacefluxwithgravity.h>
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 VecDouble & | getSw () |
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 | |
Function1D & | m_fMobW |
Function1D & | m_fMobGrav |
VecDouble & | m_cK |
VecDouble * | m_pcSw |
double | m_gc |
double | m_maxK |
Matrix | m_Vel |
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.
TraceFaceFluxWithGravity::TraceFaceFluxWithGravity | ( | unsigned | numFaces, | |
Function1D & | fMobW, | |||
Function1D & | fMobGrav, | |||
VecDouble & | cK, | |||
double | gc | |||
) |
Definition at line 4 of file tracefacefluxwithgravity.cpp.
TraceFaceFluxWithGravity::~TraceFaceFluxWithGravity | ( | ) |
virtual TraceFaceFluxWithGravity::~FaceFluxFunction | ( | ) | [inline, virtual] |
Reimplemented from FaceFluxFunction.
Definition at line 37 of file tracefacefluxwithgravity.h.
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.
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 |
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 }
VecDouble& TraceFaceFluxWithGravity::m_cK [private] |
Definition at line 20 of file tracefacefluxwithgravity.h.
Function1D & TraceFaceFluxWithGravity::m_fMobGrav [private] |
Definition at line 19 of file tracefacefluxwithgravity.h.
Function1D& TraceFaceFluxWithGravity::m_fMobW [private] |
Definition at line 19 of file tracefacefluxwithgravity.h.
double TraceFaceFluxWithGravity::m_gc [private] |
Definition at line 22 of file tracefacefluxwithgravity.h.
double TraceFaceFluxWithGravity::m_maxK [private] |
Definition at line 23 of file tracefacefluxwithgravity.h.
VecDouble* TraceFaceFluxWithGravity::m_pcSw [private] |
Definition at line 21 of file tracefacefluxwithgravity.h.
Matrix TraceFaceFluxWithGravity::m_Vel [private] |
Definition at line 24 of file tracefacefluxwithgravity.h.