00001 #include "russanovsystemmpi.h"
00002
00003
00004 RussanovSystemMPI::RussanovSystemMPI(OrthoMesh &mesh,Function3D &fInitU,const VecDouble &cPor,Function3D &fPrescribedU,FaceFluxFunction &flux, double CFL,int mesh_overlap)
00005 :LaxFriedrichsSystemMPI(mesh,fInitU,cPor,fPrescribedU,flux,CFL,mesh_overlap)
00006 {
00007
00008 }
00009
00010
00011
00012
00013 void RussanovSystemMPI::iterateN(unsigned nSteps, double dt)
00014 {
00015 unsigned posCell,negCell;
00016
00017
00018
00019
00020
00021 static VecDouble vQPos(n_components),vQNeg(n_components),vBC(n_components);
00022
00023
00024
00025 for (unsigned count = 0; count < nSteps; count++)
00026 {
00027
00028 OrthoMesh::Face_It face = m_mesh.begin_face();
00029 unsigned nFaces = m_mesh.numFaces();
00030
00031
00032
00033 m_solAnt = m_sol;
00034
00035
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
00042 this->getValuesOfTheFaceCells(m_mesh,m_fBC,m_solAnt,face,vQNeg,vQPos);
00043
00044
00045
00046
00047 getBC(faceIndex,vBC);
00048
00049
00050
00051
00052
00053 face->getValidCellIndices(posCell,negCell);
00054
00055
00056 double posPor = getPorosity()(posCell);
00057 double negPor = getPorosity()(negCell);
00058
00059
00060
00061 for (unsigned cmp=0;cmp<n_components;cmp++)
00062 {
00063
00064 double flux;
00065 if (vBC(cmp) == INFINITY)
00066 {
00067
00068
00069
00070
00071
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
00078 {
00079 flux = dt*face->areaPerCellVol() * m_flux.fluxAtFace(face,faceIndex,posCell,negCell,vBC,vBC,cmp);
00080 }
00081
00082
00083
00084
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 }
00092 }
00093
00094
00095 }
00096 updateGhostCells();
00097 }
00098
00099
00100 RussanovSystemMPI::~RussanovSystemMPI()
00101 {
00102
00103 }