RussanovSystemMPI Class Reference

#include <russanovsystemmpi.h>

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

List of all members.

Public Member Functions

 RussanovSystemMPI (OrthoMesh &mesh, Function3D &fInitU, const VecDouble &cPor, Function3D &fPrescribedU, FaceFluxFunction &flux, double CFL, int mesh_overlap)
virtual ~RussanovSystemMPI ()
virtual void iterateN (unsigned nSteps, double dt)

Detailed Description

Definition at line 9 of file russanovsystemmpi.h.


Constructor & Destructor Documentation

RussanovSystemMPI::RussanovSystemMPI ( OrthoMesh mesh,
Function3D fInitU,
const VecDouble cPor,
Function3D fPrescribedU,
FaceFluxFunction flux,
double  CFL,
int  mesh_overlap 
)

Definition at line 4 of file russanovsystemmpi.cpp.

00005    :LaxFriedrichsSystemMPI(mesh,fInitU,cPor,fPrescribedU,flux,CFL,mesh_overlap)
00006 {
00007   
00008 }

RussanovSystemMPI::~RussanovSystemMPI (  )  [virtual]

Definition at line 100 of file russanovsystemmpi.cpp.

00101 {
00102 
00103 }


Member Function Documentation

void RussanovSystemMPI::iterateN ( unsigned  nSteps,
double  dt 
) [virtual]

Reimplemented from LaxFriedrichsSystemMPI.

Definition at line 13 of file russanovsystemmpi.cpp.

00014 {
00015   unsigned posCell,negCell;
00016 
00017   //We iterate the method along faces, so 
00018   //alloc the vectors to contain the solutions in neg
00019   //and pos cells of the faces.  Remeber that the solution
00020   //in a cell is vector with a value for each component
00021   static VecDouble  vQPos(n_components),vQNeg(n_components),vBC(n_components);
00022 
00023 
00024   //For each time step
00025   for (unsigned count = 0; count < nSteps; count++)
00026   {
00027     //Get the face iterator and the number of faces.
00028     OrthoMesh::Face_It face = m_mesh.begin_face();
00029     unsigned nFaces = m_mesh.numFaces();
00030 
00031     //m_solAnt receives the solution in time tn since
00032     //m_sol will contain the solution in tn+1. 
00033     m_solAnt = m_sol;
00034 
00035     //For each face
00036     VecTag::iterator itDZ = fDeadZone.begin();
00037     for (unsigned faceIndex=0;faceIndex < nFaces; faceIndex++,face++,itDZ++)
00038     {
00039       if (*itDZ != ACTIVE_ZONE)
00040         continue;
00041       //Get the values of the previous solution in the right and left of the face
00042       this->getValuesOfTheFaceCells(m_mesh,m_fBC,m_solAnt,face,vQNeg,vQPos);
00043 
00044       //Get the boundary conditions in that face.
00045       //If the face doesnt have boundary condition for the ith
00046       //componente, then vBC == infinity.
00047       getBC(faceIndex,vBC);
00048 
00049       
00050       //Get the indices of the cells that contain the face.
00051       //If the face is at boundary, it has just one cell.
00052       //In this case the method getAdjCells() return posCell == negCell
00053       face->getValidCellIndices(posCell,negCell);
00054 
00055       //Get the porsity
00056       double posPor = getPorosity()(posCell);
00057       double negPor = getPorosity()(negCell);
00058       //double mPor = (posPor + negPor)/2.0;
00059 
00060       //Now get the flux component by component
00061       for (unsigned cmp=0;cmp<n_components;cmp++)
00062       {
00063         //See if the face has prescribed boundary condition BC      
00064         double flux;
00065         if (vBC(cmp) == INFINITY)    
00066         {
00067           /*
00068             The face doesnt have boundary condition BC
00069             proceed to the usual computation of the flux
00070             to calculate the amount of the mass passed through
00071             the face and divide it by the cell volume
00072           */
00073           double a = fabs(m_flux.maxLocalCharVelocity(face,faceIndex,posCell,negCell,vQPos,vQNeg,cmp));
00074 
00075           flux = dt*face->areaPerCellVol()*( m_flux.fluxAtFace(face,faceIndex,posCell,negCell,vQPos,vQNeg,cmp) -a*(vQNeg(cmp)-vQPos(cmp))/2.0);
00076         }
00077         else //the face has BC, so dont add the stability term
00078         {
00079           flux = dt*face->areaPerCellVol() * m_flux.fluxAtFace(face,faceIndex,posCell,negCell,vBC,vBC,cmp);
00080         }
00081 
00082       
00083       
00084         //printf("face %d = %g,Pos: %d,Neg %d, SwPos = %g,SwNeg = %g \n",faceIndex,flux,face->getPosCellIndex(),face->getNegCellIndex(),SwPos,SwNeg);
00085         if (face->hasPosCell())
00086           m_sol[cmp](face->getPosCell()) +=  - flux/posPor;
00087 
00088         if (face->hasNegCell())
00089           m_sol[cmp](face->getNegCell()) +=  + flux/negPor;
00090         
00091       } //end for each component
00092     } //end for each face
00093 
00094 
00095   } //end for each time step
00096   updateGhostCells();
00097 }


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