#include <russanovmpioverlap.h>
Public Member Functions | |
RussanovMPIOverlap (OrthoMesh &mesh, Function3D &fInitU, const VecDouble &cPor, Function3D &fPrescribedU, FaceFluxFunction &flux, double CFL, int mesh_overlap) | |
virtual | ~RussanovMPIOverlap () |
virtual void | iterate (double t, double tEnd) |
Definition at line 9 of file russanovmpioverlap.h.
RussanovMPIOverlap::RussanovMPIOverlap | ( | OrthoMesh & | mesh, | |
Function3D & | fInitU, | |||
const VecDouble & | cPor, | |||
Function3D & | fPrescribedU, | |||
FaceFluxFunction & | flux, | |||
double | CFL, | |||
int | mesh_overlap | |||
) |
Definition at line 2 of file russanovmpioverlap.cpp.
00003 :LaxFriedrichsMPIOverlap(mesh,fInitU,cPor,fPrescribedU,flux, CFL, mesh_overlap) 00004 { 00005 00006 }
RussanovMPIOverlap::~RussanovMPIOverlap | ( | ) | [virtual] |
Definition at line 77 of file russanovmpioverlap.cpp.
void RussanovMPIOverlap::iterate | ( | double | t, | |
double | tEnd | |||
) | [virtual] |
Reimplemented from LaxFriedrichsMPIOverlap.
Definition at line 11 of file russanovmpioverlap.cpp.
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); //number of iteractions 00021 00022 00023 //For each time step 00024 for (int count = 0; count < nIteraction; count++) 00025 { 00026 //Get the face iterator and the number of faces. 00027 OrthoMesh::Face_It face = m_mesh.begin_face(); 00028 unsigned nFaces = m_mesh.numFaces(); 00029 00030 m_cValuesPrev=m_cValues; 00031 00032 //For each face 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 //Get the values of the previous solution in the right and left of the face 00039 double SwPos,SwNeg; 00040 unsigned cell1,cell2; 00041 this->getValuesOfTheFaceCells(m_mesh,m_fValues,m_cValuesPrev,face,SwNeg,SwPos); 00042 00043 //Get the values of the cells that contain the face. 00044 //If the face is at boundary, it has just one cell. 00045 //In this case the method getAdjCells() return cell1 == cell2 00046 face->getValidCellIndices(cell1,cell2); 00047 00048 00049 00050 double posPor = getPorosity()(cell1); 00051 double negPor = getPorosity()(cell2); 00052 00053 //calculate the right coefficient of diffusion 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 //printf("%g ",a); 00061 //Calculate the amount of the mass passed through the face and divide it by the cell volume 00062 double flux = dt*face->areaPerCellVol()* ( m_flux.fluxAtFace(face,faceIndex,cell1,cell2,SwPos,SwNeg) - a*(SwNeg-SwPos)/2.0); 00063 //printf("face %d = %g,Pos: %d,Neg %d, SwPos = %g,SwNeg = %g \n",faceIndex,flux,face->getPosCellIndex(),face->getNegCellIndex(),SwPos,SwNeg); 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 }