//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // Source File: QRelations // Author: jcm // Date: Sat - Nov 18, 2000 // Namespace: conejo // Framework: Tecolote // Copyright: Los Alamos National Laboratory // Full Copyright=$(TECOLOTE_ROOT)/Doc/Copyright // RCS_VERSION_ID: $Id: //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: #ifndef __conejo_QRelations_t_hh #define __conejo_QRelations_t_hh #include "PhysicsBaseClasses_src/HelperClasses/MMField.hh" #include "Demo_src/Model/CompatibleHydro/QRelations.hh" #include "Evaluator/ScalarCode.h" //#define ENTER(a) #define ENTER(a) tecout << "Entering " << a << endl; namespace conejo { using namespace TecFramework; using namespace poomalote; using namespace PhysicsBaseClasses; using namespace Hydrodynamics; using namespace std; const Real spokeCutoff = 1.0e-12; // We get this value from Ed's code // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ template BEGIN_PERSISTENT(QRelations) PERSISTENT( linearQ, "LinearQ" ) PERSISTENT( quadQ, "QuadQ" ) END_PERSISTENT //$ linearQ : Real - linear coefficient for Q // //$ quadQ : Real - quadratic coefficient for Q // // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ //----------------------------------------------------------------------------- // Test function //----------------------------------------------------------------------------- template struct EdgeQPressureInfo { void scalarCodeInfo(ScalarCodeInfo &info) const { info.arguments(5); info.write(0, true ); info.write(1, false); info.write(2, false); info.write(3, false); info.write(4, false); // info.write(5, false); // info.write(6, false); // info.write(7, false); info.useGuards(0, false); info.useGuards(1, true); info.useGuards(2, true); info.useGuards(3, true); info.useGuards(4, true); // info.useGuards(5, true); // info.useGuards(6, true); // info.useGuards(7, true); info.dimensions(Traits::Dim); for (int i = 0; i < Traits::Dim; ++i) { info.lowerExtent(i) = 2; info.upperExtent(i) = 2; } } }; template struct ScalarEdgeQPressure : public EdgeQPressureInfo { // Typedefs FIELD_TYPEDEFS(Traits) ScalarEdgeQPressure(const Real& inLinearQ ) : EdgeQPressureInfo(), linearQ(inLinearQ) { } template void operator()(const F1& EdgeQPressure, const F2& EdgeGammaConstant, const F3& EdgeSoundSpeed, const F4& EdgeVelocity, const F5& EdgePsiLimiter, const Loc &loc) { if( EdgePsiLimiter(loc) < eps ) { EdgeQPressure(loc) = 0.0; return; } Real edgeVelocityMagnitude = sqrt(dot(EdgeVelocity(loc),EdgeVelocity(loc))); EdgeQPressure(loc) = edgeVelocityMagnitude * EdgePsiLimiter(loc) * (EdgeGammaConstant(loc) * edgeVelocityMagnitude + sqrt( linearQ * linearQ * EdgeSoundSpeed(loc) * EdgeSoundSpeed(loc) + EdgeGammaConstant(loc) * EdgeGammaConstant(loc) * edgeVelocityMagnitude * edgeVelocityMagnitude)); } private: Real linearQ; }; //====================================================================== // Constructor -- QRelations::QRelations //====================================================================== template QRelations::QRelations( DataDirectory* pDataDir, const string& inName ) : CompatibleRelations(pDataDir,inName), Old(pDataDir->strictGet("CompatibleHydroOld")), linearQ(1.0), quadQ(1.0) { VectorField& EdgeLength = DataDir.get( "EdgeLength", Mesh.getField ( AllEdge() ) ); for(int d=0;d CVert(CoarseVert[d]); RDomain.push_back(CoarseVert); RDomain[d][d] = Interval<1>(CVert.first(), CVert.last() - 2); LDomain.push_back(CoarseVert); LDomain[d][d] = Interval<1>(CVert.first() + 1,CVert.last() - 1); Loc offset(0); offset[d] = 1; RightEdgeNgbr.push_back(RDomain[d]); RightEdgeNgbr[d] += offset; LeftEdgeNgbr.push_back(LDomain[d]); LeftEdgeNgbr[d] -= offset; CoarseEdges.push_back(Range(EdgeLength[d].domain())); LowerVert.push_back(CoarseEdges[d]); UpperVert.push_back(CoarseEdges[d] + offset); EdgeNgbr.push_back( Range(EdgeLength[d].domain() + offset) ); } } // end constructor //====================================================================== // Destructor -- QRelations::~QRelations //====================================================================== template QRelations::~QRelations( ) { } //====================================================================== // Function -- QRelations::createRelations //====================================================================== template void QRelations::createRelations( ) { ENTER("QRelations::createRelations"); gammaConst = 2.6666666666666667 * 0.25 * quadQ; // Dt is an Independent Constant Field used in Relationships ScalarField& Dt = DataDir.get( "Dt", Mesh.getField ( Vert () ) ); // ------------------------------------------------------------------------------------------------------------------------- // Input Fields to QRelations // ------------------------------------------------------------------------------------------------------------------------- ScalarField& OldDt = Old.get ( "Dt", Mesh.getField ( Vert () ) ); VectorField& OldVelocity = Old.get ( "Velocity" , Mesh.getField ( Vert () ) ); VectorField& OldEdgeLength = Old.get ( "EdgeLength" , FineMesh.getField( AllEdge() ) ); VectorField& OldEdgeVelocity = Old.get ( "EdgeVelocity", Mesh.getField ( AllEdge() ) ); ScalarField& Volume = DataDir.get( "Volume", Mesh.getField ( Cell () ) ); ScalarField& SubVolume = DataDir.get( "SubVolume", FineMesh.getField( Cell () ) ); VectorField& SubFaceAreas = DataDir.get( "SubFaceAreas" , FineMesh.getField( AllFace() ) ); VectorField& EdgeLength = DataDir.get( "EdgeLength" , FineMesh.getField( AllEdge() ) ); VectorField& Velocity = DataDir.get( "Velocity", Mesh.getField ( Vert () ) ); ScalarField& CellDensity = DataDir.get( "CellDensity", Mesh.getField ( Cell () ) ); ScalarField& CellSoundSpeedSq = DataDir.get( "CellSoundSpeedSq", Mesh.getField ( Cell () ) ); ScalarField& CellGammaConstant = DataDir.get( "CellGammaConstant", Mesh.getField ( Cell () ) ); CellGammaConstant = gammaConst; // Should go away when we use more sophisticated EOSs. // ------------------------------------------------------------------------------------------------------------------------- // Store the sqrt because it is used to calculate the VertSoundSpeed // ------------------------------------------------------------------------------------------------------------------------- ScalarField& CellSoundSpeed = DataDir.get( "CellSoundSpeed", Mesh.getField ( Cell () ) ); // ------------------------------------------------------------------------------------------------------------------------- // Vertex Fields -- (weighted) sums of SubCell Fields // ------------------------------------------------------------------------------------------------------------------------- ScalarField& VertVolume = DataDir.get( "VertVolume", Mesh.getField ( Vert () ) ); // ScalarField& WeightedVertVol = DataDir.get( "WeightedVertVol", Mesh.getField ( Vert () ) ); ScalarField& VertDensity = DataDir.get( "VertDensity", Mesh.getField ( Vert () ) ); ScalarField& VertSoundSpeed = DataDir.get( "VertSoundSpeed", Mesh.getField ( Vert () ) ); ScalarField& VertGammaConstant = DataDir.get( "VertGammaConstant", Mesh.getField ( Vert () ) ); // ------------------------------------------------------------------------------------------------------------------------- // Edge Fields that hold Q-related quantities // ------------------------------------------------------------------------------------------------------------------------- VectorField& EdgeVelocity = DataDir.get( "EdgeVelocity", Mesh.getField ( AllEdge() ) ); ScalarField& EdgeDensity = DataDir.get( "EdgeDensity", Mesh.getField ( AllEdge() ) ); ScalarField& EdgeQPressure = DataDir.get( "EdgeQPressure", Mesh.getField ( AllEdge() ) ); ScalarField& EdgeSoundSpeed = DataDir.get( "EdgeSoundSpeed", Mesh.getField ( AllEdge() ) ); ScalarField& EdgeGammaConstant = DataDir.get( "EdgeGammaConstant", Mesh.getField ( AllEdge() ) ); ScalarField& EdgeQTmpMax = DataDir.get( "EdgeQTmpMax", Mesh.getField ( AllEdge() ) ); ScalarField& SpokeDVolDt = DataDir.get( "SpokeDVolDt", FineMesh.getField( AllFace() ) ); ScalarField& SpokeQSwitch = DataDir.get( "SpokeQSwitch", FineMesh.getField( AllFace() ) ); ScalarField& RightLimiterRatio = DataDir.get( "RightLimiterRatio", Mesh.getField ( AllEdge() ) ); ScalarField& LeftLimiterRatio = DataDir.get( "LeftLimiterRatio", Mesh.getField ( AllEdge() ) ); ScalarField& EdgePsiLimiter = DataDir.get( "EdgePsiLimiter", Mesh.getField ( AllEdge() ) ); // ------------------------------------------------------------------------------------------------------------------------- // Output Fields from QRelations // ------------------------------------------------------------------------------------------------------------------------- ScalarField& CellQ = DataDir.get( "CellQ", Mesh.getField ( Cell () ) ); VectorField& SubForceQ = DataDir.get( "SubForceQ", FineMesh.getField( Cell () ) ); ScalarField& SubPressureQMod = DataDir.get( "SubPressureQMod", FineMesh.getField( Cell () ) ); Let::NewRelation( *(pParent)this, &Parent::calcSqrt, CellSoundSpeed, CellSoundSpeedSq ); Let::NewRelation( *(pParent)this, &Parent::calcWeightedVertAvg, VertSoundSpeed, CellSoundSpeed, SubVolume, VertVolume ); Let::NewRelation( *(pParent)this, &Parent::calcWeightedVertAvg, VertGammaConstant, CellGammaConstant, SubVolume, VertVolume ); Let::NewRelation( *this, &QRelations::calcEdgeVelocity, EdgeVelocity, OldVelocity ); Let::NewRelation( *this, &QRelations::calcEdgeDensity, EdgeDensity, VertDensity ); Let::NewRelation( *this, &QRelations::calcEdgeGammaConstant, EdgeGammaConstant, VertGammaConstant ); Let::NewRelation( *this, &QRelations::calcEdgeQPressure, EdgeQPressure, EdgeGammaConstant, EdgeSoundSpeed, EdgeVelocity, EdgePsiLimiter ); Let::NewRelation( *this, &QRelations::calcEdgeSoundSpeed, EdgeSoundSpeed, VertSoundSpeed ); Let::NewRelation( *this, &QRelations::calcEdgeQTmpMax, EdgeQTmpMax, EdgeDensity, EdgeQPressure ); Let::NewRelation( *this, &QRelations::calcSpokeDVolDt, SpokeDVolDt, EdgeVelocity, SubFaceAreas ); Let::NewRelation( *this, &QRelations::calcSpokeQSwitch, SpokeQSwitch, SpokeDVolDt, Volume, OldDt ); Let::NewRelation( *this, &QRelations::calcRightLimiterRatio, RightLimiterRatio, OldEdgeLength, OldEdgeVelocity ); Let::NewRelation( *this, &QRelations::calcLeftLimiterRatio, LeftLimiterRatio, OldEdgeLength, OldEdgeVelocity ); Let::NewRelation( *this, &QRelations::calcEdgePsiLimiter, EdgePsiLimiter, RightLimiterRatio, LeftLimiterRatio, OldEdgeLength, OldEdgeVelocity, OldDt ); Let::NewRelation( *this, &QRelations::calcCellQ, CellQ, EdgeQTmpMax, SpokeQSwitch ); Let::NewRelation( *this, &QRelations::calcSubForceQ, SubForceQ, EdgeQTmpMax, EdgeVelocity, SpokeDVolDt, SpokeQSwitch ); Let::NewRelation( *this, &QRelations::calcSubPressureQMod, SubPressureQMod, EdgeQPressure, SpokeQSwitch ); } //====================================================================== // Function -- QRelations::calcEdgeVelocity //====================================================================== template void QRelations::calcEdgeVelocity ( const VectorField& EdgeVelocity, const VectorField& OldVelocity) { ENTER("QRelations::calcEdgeVelocity"); int d = getEdgeDirection(EdgeVelocity); EdgeVelocity(CoarseEdges[d]) = OldVelocity(EdgeNgbr[d]) - OldVelocity(CoarseEdges[d]); } // end function calcEdgeVelocity //====================================================================== // Function -- QRelations::calcEdgeDensity //====================================================================== template void QRelations::calcEdgeDensity ( const ScalarField& EdgeDensity, const ScalarField& VertDensity) { ENTER("QRelations::calcEdgeDensity"); int d = getEdgeDirection(EdgeDensity); EdgeDensity(CoarseEdges[d]) = 2.0 * ( VertDensity(CoarseEdges[d]) * VertDensity(EdgeNgbr[d]) ) / ( VertDensity(CoarseEdges[d]) + VertDensity(EdgeNgbr[d]) ); ScalarField& VertVolume = DataDir.get( "VertVolume", Mesh.getField ( Vert () ) ); ScalarField& CellDensity = DataDir.strictGet( "CellDensity" ); } // end function calcEdgeDensity //====================================================================== // Function -- QRelations::calcEdgeGammaConstant //====================================================================== template void QRelations::calcEdgeGammaConstant ( const ScalarField& EdgeGammaConstant, const ScalarField& VertGammaConstant) { ENTER("QRelations::calcEdgeGammaConstant"); int d = getEdgeDirection(EdgeGammaConstant); EdgeGammaConstant(CoarseEdges[d]) = 0.5 * ( VertGammaConstant(CoarseEdges[d]) + VertGammaConstant(EdgeNgbr[d]) ); } // end function calcEdgeGammaConstant //====================================================================== // Function -- QRelations::calcEdgeQPressure //====================================================================== template void QRelations::calcEdgeQPressure ( const ScalarField& EdgeQPressure, const ScalarField& EdgeGammaConstant, const ScalarField& EdgeSoundSpeed, const VectorField& EdgeVelocity, const ScalarField& EdgePsiLimiter ) { ENTER("QRelations::calcEdgeQPressure"); int d = getEdgeDirection(EdgeQPressure); EdgeGammaConstant[d].update(); EdgeSoundSpeed[d].update(); EdgeVelocity[d].update(); EdgePsiLimiter[d].update(); ScalarEdgeQPressure sEdgeQPressure(linearQ); ScalarCode > scEdgeQPressure(sEdgeQPressure); scEdgeQPressure(EdgeQPressure,EdgeGammaConstant[d], EdgeSoundSpeed[d],EdgeVelocity[d],EdgePsiLimiter[d]); } // end function EdgeQPressure //====================================================================== // Function -- QRelations::calcEdgeSoundSpeed //====================================================================== template void QRelations::calcEdgeSoundSpeed ( const ScalarField& EdgeSoundSpeed, const ScalarField& VertSoundSpeed ) { ENTER("QRelations::calcEdgeSoundSpeed"); int d = getEdgeDirection(EdgeSoundSpeed); VertSoundSpeed.update(); EdgeSoundSpeed(CoarseEdges[d]) = min( VertSoundSpeed(CoarseEdges[d]),VertSoundSpeed(EdgeNgbr[d]) ); } // end function calcEdgeSoundSpeed //====================================================================== // Function -- QRelations::calcEdgeQTmpMax //====================================================================== template void QRelations::calcEdgeQTmpMax ( const ScalarField& EdgeQTmpMax, const ScalarField& EdgeDensity, const ScalarField& EdgeQPressure ) { ENTER("QRelations::calcEdgeQTmpMax"); int d = getEdgeDirection(EdgeQTmpMax); EdgeQTmpMax = EdgeDensity[d] * EdgeQPressure[d]; } // end function calcEdgeQTmpMax //====================================================================== // Function -- QRelations::calcSpokeDVolDt //====================================================================== template void QRelations::calcSpokeDVolDt ( const ScalarField& SpokeDVolDt, const VectorField& EdgeVelocity, const VectorField& SubFaceAreas) { ENTER("QRelations::calcSpokeDVolDt"); int d = getFaceDirection(SpokeDVolDt); EdgeVelocity[d].update(); SubFaceAreas[d].update(); for(int edg=0;edg::calcSpokeQSwitch //====================================================================== template void QRelations::calcSpokeQSwitch ( const ScalarField& SpokeQSwitch, const ScalarField& SpokeDVolDt, const ScalarField& Volume, const ScalarField& Dt ) { ENTER("QRelations::calcSpokeQSwitch"); int d = getFaceDirection(SpokeQSwitch); for(int edg=0;edg spokeCutoff, 1.0, 0.0); } // end function calcSpokeQSwitch //====================================================================== // Function -- QRelations::calcRightLimiterRatio //====================================================================== template void QRelations::calcRightLimiterRatio ( const ScalarField& RightLimiterRatio, const VectorField& EdgeLength, const VectorField& EdgeVelocity) { ENTER("QRelations::calcRightLimiterRatio"); int d = getEdgeDirection(RightLimiterRatio); EdgeLength[d].update(); EdgeVelocity[d].update(); RightLimiterRatio = 1.0; RightLimiterRatio(RDomain[d]) = dot(EdgeLength[d](RightEdgeNgbr[d]), EdgeLength[d](RDomain[d])) * dot(EdgeVelocity[d](RDomain[d]), EdgeVelocity[d](RDomain[d])); RightLimiterRatio(RDomain[d]) = where(RightLimiterRatio(RDomain[d]) > numeric_limits::epsilon(), (dot(EdgeVelocity[d](RightEdgeNgbr[d]), EdgeVelocity[d](RDomain[d])) * dot(EdgeLength[d](RDomain[d]), EdgeLength[d](RDomain[d])) ) / RightLimiterRatio(RDomain[d]), 1.0 ); //------------------------------------------------------------- // if ( d == 0 ) { // } else if ( d == 1) { // RightLimiterRatio -= 1.0; // tecout << "RightLimiterRatio[1] = " << endl; // tecout << RightLimiterRatio << endl; // RightLimiterRatio += 1.0; // } //------------------------------------------------------------- } // end function calcRightLimiterRatio //====================================================================== // Function -- QRelations::calcLeftLimiterRatio //====================================================================== template void QRelations::calcLeftLimiterRatio ( const ScalarField& LeftLimiterRatio, const VectorField& EdgeLength, const VectorField& EdgeVelocity) { ENTER("QRelations::calcLeftLimiterRatio"); int d = getEdgeDirection(LeftLimiterRatio); EdgeLength[d].update(); EdgeVelocity[d].update(); LeftLimiterRatio = 1.0; LeftLimiterRatio(LDomain[d]) = dot(EdgeLength[d](LeftEdgeNgbr[d]), EdgeLength[d](LDomain[d])) * dot(EdgeVelocity[d](LDomain[d]), EdgeVelocity[d](LDomain[d])); LeftLimiterRatio(LDomain[d]) = where(LeftLimiterRatio(LDomain[d]) > numeric_limits::epsilon(), (dot(EdgeVelocity[d](LeftEdgeNgbr[d]), EdgeVelocity[d](LDomain[d])) * dot(EdgeLength[d](LDomain[d]), EdgeLength[d](LDomain[d])) ) / LeftLimiterRatio(LDomain[d]), 1.0 ); //------------------------------------------------------------- // if ( d == 0 ) { // } else if ( d == 1) { // LeftLimiterRatio -= 1.0; // tecout << "LeftLimiterRatio[1] = " << endl; // tecout << LeftLimiterRatio << endl; // LeftLimiterRatio += 1.0; // } //------------------------------------------------------------- } // end function calcLeftLimiterRatio //====================================================================== // Function -- QRelations::calcEdgePsiLimiter //====================================================================== template void QRelations::calcEdgePsiLimiter ( const ScalarField& EdgePsiLimiter, const ScalarField& RightLimiterRatio, const ScalarField& LeftLimiterRatio, const VectorField& EdgeLength, const VectorField& EdgeVelocity, const ScalarField& Dt) { ENTER("QRelations::calcEdgePsiLimiter"); int d = getEdgeDirection(EdgePsiLimiter); //------------------------------------------------------------------------ // Typically the EdgePsiLimiter is limited between 0 and 1, // For this algorithm, 0 means do not have any artificial viscosity // along the edge. // // (In Randy Christensen's paper, EdgePsiLimiter is // PsiLimiter = 1.0 - EdgePsiLimiter, so that when he calculates the // Q, there is a factor of ( 1.0 - PsiLimiter) in the expression. This // means his PsiLimiter has a different meaning than the one used here. // Don M ) //------------------------------------------------------------------------ RightLimiterRatio[d].update(); LeftLimiterRatio[d].update(); EdgeLength[d].update(); EdgeVelocity[d].update(); EdgePsiLimiter = 1.0 - max( 0.0, min( min( 2.0 * RightLimiterRatio[d], 2.0 * LeftLimiterRatio[d]), min( 0.5 * (RightLimiterRatio[d] + LeftLimiterRatio[d]), 1.0 ) ) ); //------------------------------------------------------------------------ // The where statement turns off the limiter when: // 1. The limiter is non zero because of round off // 2. The edge is degenerate (the vertex points coincide) // 3. The change in the velocity along the edge is too small for // anything to happen during the time step. //------------------------------------------------------------------------ EdgePsiLimiter = where( (EdgePsiLimiter > numeric_limits::epsilon() && dot(EdgeLength[d],EdgeLength[d]) > numeric_limits::epsilon() && dot(EdgeVelocity[d],EdgeVelocity[d]) * Dt * Dt > numeric_limits::epsilon() * dot(EdgeLength[d],EdgeLength[d]) ), EdgePsiLimiter, 0.0 ); //--------------------------------------------------------------------------------------------------------- if ( d == 0 ) { // // tecout << "eps = " << eps <::epsilon() = " << numeric_limits::epsilon() << endl; // tecout << " Dt = " << Dt << endl; // tecout << "EdgePsiLimiter[0] = " << endl; // tecout << EdgePsiLimiter << endl; // tecout << "EdgeVelocity[0] = " << endl; // tecout << EdgeVelocity[0] << endl; } else if ( d == 1) { // // tecout << "RightLimiterRatio[1] = " << endl; // // tecout << RightLimiterRatio[1] << endl; // // tecout << "LeftLimiterRatio[1] = " << endl; // // tecout << LeftLimiterRatio[1] << endl; // tecout << "EdgePsiLimiter[1] = " << endl; // tecout << EdgePsiLimiter << endl; // tecout << "EdgeVelocity[1] = " << endl; // tecout << EdgeVelocity[1] << endl; } //--------------------------------------------------------------------------------------------------------- } // end function calcEdgePsiLimiter //====================================================================== // Function -- QRelations::calcCellQ //====================================================================== template void QRelations::calcCellQ ( const ScalarField& CellQ, const ScalarField& EdgeQTmpMax, const ScalarField& SpokeQSwitch ) { ENTER("QRelations::calcCellQ"); EdgeQTmpMax.update(); SpokeQSwitch.update(); CellQ = 0.0; for ( int d = 0; d < Dim; ++d ) { for ( int edg = 0; edg < nEdgesPerDimension; ++edg ) { CellQ(CoarseCell) = max( CellQ(CoarseCell), EdgeQTmpMax[d](CellEdge[d][edg]) * SpokeQSwitch[d](Spoke[d][edg]) ); } } //---------------------------------------- // tecout << " in calcCellQ: CellQ = " << endl; // tecout << CellQ << endl; //---------------------------------------- } // end function calcCellQ //====================================================================== // Function -- QRelations::calcSubForceQ //====================================================================== template void QRelations::calcSubForceQ ( const VectorField& SubForceQ, const ScalarField& EdgeQTmpMax, const VectorField& EdgeVelocity, const ScalarField& SpokeDVolDt, const ScalarField& SpokeQSwitch ) { ENTER("QRelations::calcSubForceQ"); SubForceQ = 0.0; for ( int d = 0; d < Dim; ++d ) { Loc offset(0); offset[d] = 1; for ( int edg = 0; edg < nEdgesPerDimension; ++edg ) { SubForceQ(Spoke[d][edg] - offset) -=(EdgeVelocity[d](CellEdge[d][edg]) * SpokeDVolDt[d] (Spoke[d][edg]) * EdgeQTmpMax[d] (CellEdge[d][edg]) * SpokeQSwitch[d](Spoke[d][edg]) ) / (dot(EdgeVelocity[d](CellEdge[d][edg]),EdgeVelocity[d](CellEdge[d][edg]))+eps); SubForceQ(Spoke[d][edg]) +=(EdgeVelocity[d](CellEdge[d][edg]) * SpokeDVolDt[d] (Spoke[d][edg]) * EdgeQTmpMax[d] (CellEdge[d][edg]) * SpokeQSwitch[d](Spoke[d][edg]) ) / (dot(EdgeVelocity[d](CellEdge[d][edg]),EdgeVelocity[d](CellEdge[d][edg]))+eps); } } //-------------------------------------------- // tecout << " in calcSubForceQ: SubForceQ = " << endl; // tecout << SubForceQ << endl; //-------------------------------------------- } // end function calcSubForceQ //====================================================================== // Function -- QRelations::calcSubPressureQMod //====================================================================== template void QRelations::calcSubPressureQMod ( const ScalarField& SubPressureQMod, const ScalarField& EdgeQPressure, const ScalarField& SpokeQSwitch ) { ENTER("QRelations::calcSubPressureQMod"); SubPressureQMod = 0.0; for ( int d = 0; d < Dim; ++d ) { Loc offset(0); offset[d] = 1; for ( int edg = 0; edg < nEdgesPerDimension; ++edg ) { SubPressureQMod(Spoke[d][edg] - offset) += EdgeQPressure[d](CellEdge[d][edg]) * SpokeQSwitch[d](Spoke[d][edg]); SubPressureQMod(Spoke[d][edg]) += EdgeQPressure[d](CellEdge[d][edg]) * SpokeQSwitch[d](Spoke[d][edg]); } } } // end function calcSubPressureQMod } // end namespace conejo #endif // end shroud __conejo_QRelations_t_hh