MixedHybridCompressibleNewton Class Reference

#include <mixedhybridcompressiblenewton.h>

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

List of all members.

Public Member Functions

 MixedHybridCompressibleNewton (OrthoMesh &mesh, Function3D &fPrescribedVelocities, Function3D &fPrescribedPression, const VecDouble &K, Function1D &density, LinearSolver &solver, int debugLevel)
 ~MixedHybridCompressibleNewton ()
virtual void iterate (TransportBase &trans)

Private Attributes

OrthoMeshm_mesh
Function1Dm_density
const VecDoublem_vK
double m_dt
SparsityPattern m_sparsePattern
SparseMatrix< double > m_A
VecDouble m_B
VecDouble m_Pn
VecDouble m_Pnn
LinearSolverm_solver
int _debugLevel
HybridFaceBC m_bc

Detailed Description

MixedHybridCompressibleNewton implements a monophasic compressible flow in porous media through Newton iterations assuming isothermal flow. The incompressible flow equatios are given by B(p)*dp/dt + div(g(p) Vdt) = q Vdt = -K Grad(P) Where B(p) = dg/dp g(p) = the density of the fluid K = intrinsic permeability

Definition at line 17 of file mixedhybridcompressiblenewton.h.


Constructor & Destructor Documentation

MixedHybridCompressibleNewton::MixedHybridCompressibleNewton ( OrthoMesh mesh,
Function3D fPrescribedVelocities,
Function3D fPrescribedPression,
const VecDouble K,
Function1D density,
LinearSolver solver,
int  debugLevel 
)
MixedHybridCompressibleNewton::~MixedHybridCompressibleNewton (  ) 

Member Function Documentation

void MixedHybridCompressibleNewton::iterate ( TransportBase trans  )  [virtual]

Implements DynamicBase.

Definition at line 22 of file mixedhybridcompressiblenewton.cpp.

00023 {
00024   //Zero entries 
00025   A = 0;
00026   B = 0;
00027   //Get the face iterator and the number of faces.
00028   OrthoMesh::Face_It face = mesh.begin_face();
00029   unsigned nFaces = mesh.numFaces();
00030     
00031   //For each face
00032   for (unsigned faceIndex=0;faceIndex < nFaces; faceIndex++,face++)
00033   {
00034     unsigned c1,c2;
00035     face->getAdjCellIndices(c1,c2);
00036     
00037     //Make sure the face is not at boundary
00038     if (!face->at_boundary())
00039     {
00040       const double P1 = Pn(c1);
00041       const double P2 = Pn(c2);
00042       const double K1 = K(c1);
00043       const double K2 = K(c2);
00044       const double Kh1 = K1*g(P1);
00045       const double Kh2 = K2*g(P2);
00046       const double Mh = 2*Kh1*Kh2/(Kh1+Kh2); //Harmonic average
00047       const double Keff =Mh*Inv_DX2;
00048       const double vv = Keff*(P1-P2);
00049       const double den = (Kh1+Kh2)*(Kh1+Kh2); 
00050       const double d1 = Kh2*Kh2*K1*dg(P1)/den*(P1-P2)*Inv_DX2;
00051       const double d2 = Kh1*Kh1*K2*dg(P2)/den*(P1-P2)*Inv_DX2;
00052 
00053  
00054       
00055       A.add(c1,c1,  d1+Keff);
00056       A.add(c1,c2,  d2-Keff);
00057       A.add(c2,c2, -d2+Keff);
00058       A.add(c2,c1, -d1-Keff);
00059       
00060       B(c1)-=vv;
00061       B(c2)+=vv;
00062     }
00063   }
00064   //Now process the boundary conditions
00065     
00066     HybridFaceBC::iterator bcEnd = bc.end();
00067     for(HybridFaceBC::iterator bcIt = bc.begin();bcIt!=bcEnd;bcIt++)
00068     {
00069       OrthoMesh::Face_It face = bcIt->face;
00070       assert(face->at_boundary());
00071       
00072       unsigned c1,c2;
00073       face->getAdjCellIndices(c1,c2);
00074 
00075       if (bcIt->bcType == Dirichlet)
00076       {
00077         double vv 
00078         double c = (c1 != OrthoMesh::invalidIndex()) ? c1 : c2;
00079         double Keff = 2*K(c)*vMobT(c)*face->area()*face->areaPerCellVol();
00080         A.add(c,c,Keff);
00081         B(c) += Keff*bcIt->value;
00082       }
00083       else //Neumann condition
00084       {
00085         if (c1 != OrthoMesh::invalidIndex())
00086           B(c1) += -bcIt->value;
00087         else
00088           B(c2) += +bcIt->value;
00089       }
00090     }
00091 
00092 }


Member Data Documentation

Definition at line 36 of file mixedhybridcompressiblenewton.h.

SparseMatrix<double> MixedHybridCompressibleNewton::m_A [private]

Definition at line 27 of file mixedhybridcompressiblenewton.h.

Right hand side of the system

Definition at line 28 of file mixedhybridcompressiblenewton.h.

Definition at line 39 of file mixedhybridcompressiblenewton.h.

Definition at line 22 of file mixedhybridcompressiblenewton.h.

Time step

Definition at line 24 of file mixedhybridcompressiblenewton.h.

The mesh

Definition at line 20 of file mixedhybridcompressiblenewton.h.

To contain the previous solution of the newton iteration

Definition at line 29 of file mixedhybridcompressiblenewton.h.

To contain the current solution of the newton iteration

Definition at line 30 of file mixedhybridcompressiblenewton.h.

The solver

Definition at line 31 of file mixedhybridcompressiblenewton.h.

Definition at line 26 of file mixedhybridcompressiblenewton.h.

Store the permeability

Definition at line 23 of file mixedhybridcompressiblenewton.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:22 2012 for CO2INJECTION by  doxygen 1.6.3