00001 #include "facefluxwithindependentequations.h" 00002 #include "numericmethods.h" 00003 00004 00005 FaceFluxWithIndependentEquations::FaceFluxWithIndependentEquations(OrthoMesh &mesh,Function1D *f1,Function1D *Df1,Function1D *f2,Function1D *Df2,bool deleteObjs) 00006 :FaceFluxFunction(2),m_Vel(mesh.numFaces(),3) 00007 { 00008 m_fs.push_back(f1); 00009 m_fs.push_back(f2); 00010 m_Dfs.push_back(Df1); 00011 m_Dfs.push_back(Df2); 00012 00013 00014 m_deleteObjs = deleteObjs; 00015 } 00016 00017 FaceFluxWithIndependentEquations::~FaceFluxWithIndependentEquations() 00018 { 00019 if (m_deleteObjs) 00020 { 00021 for (unsigned i = 0;i<m_fs.size();i++) 00022 { 00023 delete m_fs[i]; 00024 } 00025 } 00026 } 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00045 void FaceFluxWithIndependentEquations::maxGlobalCharVelocity(double vel[3]) 00046 { 00047 VecDouble minVel(3); 00048 VecDouble maxVel(3); 00049 double maxGrad=0.0; 00050 for (unsigned i=0;i<m_fs.size();i++) 00051 { 00052 double maxGradCmp = m_Dfs[i]->getMaxNorm(0,1); 00053 if (maxGradCmp > maxGrad) 00054 maxGrad = maxGradCmp; 00055 } 00056 NumericMethods::getMinMaxValueByColumn(m_Vel,minVel,maxVel); 00057 vel[X]= NumericMethods::maxMod(minVel(X),maxVel(X))*maxGrad; 00058 vel[Y]= NumericMethods::maxMod(minVel(Y),maxVel(Y))*maxGrad; 00059 vel[Z]= NumericMethods::maxMod(minVel(Z),maxVel(Z))*maxGrad; 00060 00061 } 00062 00063 00064 00065 void FaceFluxWithIndependentEquations::updateDynamicData(DynamicBase &dynMod) 00066 { 00067 dynMod.getVelocitiesAtFaces(m_Vel); 00068 } 00069 00070 00071 00072 00073 00074 void FaceFluxWithIndependentEquations::fluxAtFace(VecDouble &vFlux, const FaceInfo &face,const VecDouble &Q1,const VecDouble &Q2) 00075 { 00076 assert((unsigned) face.index < m_Vel.m()); 00077 00078 00079 vFlux(0)= (*(m_fs[0]))(Q1(0)) + (*(m_fs[0]))(Q2(0)); 00080 vFlux(1)= (*(m_fs[1]))(Q1(1)) + (*(m_fs[1]))(Q2(1)); 00081 vFlux*=m_Vel(face.index,face.normal)/2.0; 00082 00083 } 00084 00085 double FaceFluxWithIndependentEquations::maxLocalCharVelocity(const FaceInfo &face,const VecDouble &Q1, const VecDouble &Q2) 00086 { 00087 assert(Q1.size() == numComponents()); 00088 assert(Q2.size() == numComponents()); 00089 double a1,a2; 00090 if (Q1(0) <= Q2(0)) 00091 a1=m_Vel(face.index,face.normal) * m_Dfs[0]->getMaxNorm(Q1(0),Q2(0)); 00092 else 00093 a1=m_Vel(face.index,face.normal) * m_Dfs[0]->getMaxNorm(Q2(0),Q1(0)); 00094 00095 if (Q1(1) <= Q2(1)) 00096 a2=m_Vel(face.index,face.normal) * m_Dfs[1]->getMaxNorm(Q1(1),Q2(1)); 00097 else 00098 a2=m_Vel(face.index,face.normal) * m_Dfs[1]->getMaxNorm(Q2(1),Q1(1)); 00099 return std::max(a1,a2); 00100 00101 } 00102 00103 00104