00001 #include "russanovmpioverlap.h"
00002 RussanovMPIOverlap::RussanovMPIOverlap(OrthoMesh &mesh,Function3D &fInitU,const VecDouble &cPor,Function3D &fPrescribedU,FaceFluxFunction &flux, double CFL,int mesh_overlap)
00003 :LaxFriedrichsMPIOverlap(mesh,fInitU,cPor,fPrescribedU,flux, CFL, mesh_overlap)
00004 {
00005
00006 }
00007
00008
00009
00010
00011 void RussanovMPIOverlap::iterate(double t, double tEnd)
00012 {
00013
00014 double timeInterval = tEnd-t;
00015 double localDt = this->calculateTimeStep(m_mesh,timeInterval,m_CFL,getPorosity(),m_flux);
00016 double dt=negotiateTimeStep(localDt);
00017 printf("Russ Negotiating dt: Sent %g, got %g\n",localDt,dt);
00018
00019
00020 int nIteraction = (int) round(timeInterval/dt);
00021
00022
00023
00024 for (int count = 0; count < nIteraction; count++)
00025 {
00026
00027 OrthoMesh::Face_It face = m_mesh.begin_face();
00028 unsigned nFaces = m_mesh.numFaces();
00029
00030 m_cValuesPrev=m_cValues;
00031
00032
00033 VecTag::iterator itDZ = fDeadZone.begin();
00034 for (unsigned faceIndex=0;faceIndex < nFaces; faceIndex++,face++,itDZ++)
00035 {
00036 if (*itDZ != ACTIVE_ZONE)
00037 continue;
00038
00039 double SwPos,SwNeg;
00040 unsigned cell1,cell2;
00041 this->getValuesOfTheFaceCells(m_mesh,m_fValues,m_cValuesPrev,face,SwNeg,SwPos);
00042
00043
00044
00045
00046 face->getValidCellIndices(cell1,cell2);
00047
00048
00049
00050 double posPor = getPorosity()(cell1);
00051 double negPor = getPorosity()(cell2);
00052
00053
00054 double a;
00055 if ( SwPos >= SwNeg)
00056 a = fabs(m_flux.maxLocalCharVelocity(face,faceIndex,cell1,cell2,SwNeg,SwPos));
00057 else
00058 a = fabs(m_flux.maxLocalCharVelocity(face,faceIndex,cell1,cell2,SwPos,SwNeg));
00059
00060
00061
00062 double flux = dt*face->areaPerCellVol()* ( m_flux.fluxAtFace(face,faceIndex,cell1,cell2,SwPos,SwNeg) - a*(SwNeg-SwPos)/2.0);
00063
00064 if (face->hasPosCell())
00065 m_cValues(face->getPosCell()) += - flux/posPor;
00066
00067 if (face->hasNegCell())
00068 m_cValues(face->getNegCell()) += + flux/negPor;
00069 }
00070 updateGhostCells();
00071 }
00072 updateDeadZone();
00073 }
00074
00075
00076
00077 RussanovMPIOverlap::~RussanovMPIOverlap()
00078 {
00079
00080 }