RussanovForSystem Class Reference

#include <russanovforsystem.h>

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

List of all members.

Public Member Functions

 ~RussanovForSystem ()
 RussanovForSystem (OrthoMesh &mesh, Function3D &fInitU, const VecDouble &cPor, Function3D &fPrescribedU, FaceFluxFunction &flux, FixedValueCondition &fixedC, double CFL)
virtual void iterateN (unsigned nSteps, double dt)

Detailed Description

Definition at line 9 of file russanovforsystem.h.


Constructor & Destructor Documentation

RussanovForSystem::~RussanovForSystem (  ) 

Definition at line 12 of file russanovforsystem.cpp.

00013 {
00014 
00015 }

RussanovForSystem::RussanovForSystem ( OrthoMesh mesh,
Function3D fInitU,
const VecDouble cPor,
Function3D fPrescribedU,
FaceFluxFunction flux,
FixedValueCondition fixedC,
double  CFL 
)

Definition at line 4 of file russanovforsystem.cpp.

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


Member Function Documentation

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

Reimplemented from LaxFriedrichsForSystem.

Definition at line 20 of file russanovforsystem.cpp.

00021 {
00022   //To contain the left and right indices of the adjacent cells
00023   //for each face
00024   unsigned posCell,negCell;
00025   double a;
00026   //We iterate the method along faces, so 
00027   //alloc the vectors to contain the solutions in neg
00028   //and pos cells of the faces.  Remeber that the solution
00029   //in a cell is vector with a value for each component
00030   static VecDouble  vBC(n_components),vFlux(n_components),vA(n_components);
00031 
00032   VecDoubleRef  vQPos(n_components),vQNeg(n_components);
00033 
00034   //For each time step
00035   for (unsigned count = 0; count < nSteps; count++)
00036   {
00037     //Get the face iterator and the number of faces.
00038     //OrthoMesh::Cash_Face_It face = m_mesh.begin_cash_face();
00039     //OrthoMesh::Cash_Face_It endf = m_mesh.end_cash_face();
00040     OrthoMesh::Face_It face = m_mesh.begin_face();
00041     OrthoMesh::Face_It endf = m_mesh.end_face();
00042     bool hasbc;
00043     m_vbc.rewind();
00044     //m_solAnt receives the solution in time tn since
00045     //m_sol will contain the solution in tn+1. 
00046     m_solAnt = m_sol;
00047 
00048     //For each face
00049     for (;face!=endf; face++)
00050     {
00051       //Get the values of the previous solution in the right and left of the face
00052       face->getAdjCellIndices(negCell,posCell);
00053       hasbc=this->getValuesOfTheFaceCells(m_mesh,m_vbc,m_solAnt,face->index(),negCell,posCell,vQNeg,vQPos);
00054 
00055       FaceInfo fInfo(face);
00056 
00057       
00058       
00059 
00060 
00061 
00062       //Get the porsity
00063       double posPor = getPorosity()(fInfo.cell2);
00064       double negPor = getPorosity()(fInfo.cell1);
00065       //double mPor = (posPor + negPor)/2.0;
00066 
00067       //get Flux
00068       m_flux.fluxAtFace(vFlux,fInfo,vQNeg,vQPos);
00069       if (!hasbc)
00070       {
00071         a=fabs(m_flux.maxLocalCharVelocity(fInfo,vQNeg,vQPos));
00072       }
00073 
00074       //Now update the cell values component by compoenent
00075       for (unsigned cmp=0;cmp<n_components;cmp++)
00076       {
00077         //See if the face has prescribed boundary condition BC      
00078         double flux;
00079         if (!hasbc)    
00080         {
00081           /*
00082             The face doesnt have boundary condition BC
00083             proceed to the usual computation of the flux
00084             to calculate the amount of the mass passed through
00085             the face and divide it by the cell volume
00086           */
00087           assert(a*dt<=m_mesh.get_dx()/2.0);
00088           flux = dt*face->areaPerCellVol()*(vFlux(cmp) -a*(vQPos(cmp)-vQNeg(cmp))/2.0);
00089         }
00090         else //the face has BC, so dont add the stability term
00091         {
00092           flux = dt*face->areaPerCellVol() * vFlux(cmp);
00093         }
00094 
00095       
00096       
00097         //printf("face %d = %g,Pos: %d,Neg %d, SwPos = %g,SwNeg = %g \n",faceIndex,flux,face->getPosCellIndex(),face->getNegCellIndex(),SwPos,SwNeg);
00098         if (face->hasPosCell())
00099           m_sol(posCell,cmp) +=  + flux/posPor;
00100 
00101         if (face->hasNegCell())
00102           m_sol(negCell,cmp) +=  - flux/negPor;
00103         
00104       } //end for each component
00105     } //end for each face
00106   } //end for each time step
00107 }


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:28 2012 for CO2INJECTION by  doxygen 1.6.3