Loading examples/inviscid-flow-sw/UpwindMomentumBase.h +12 −12 Original line number Diff line number Diff line Loading @@ -77,35 +77,35 @@ class UpwindMomentumBase else if ( machNumber <= 1.0 ) return density * speedOfSound * speedOfSound / ( 2 * this->gamma ) * ( ( machNumber - 1.0 ) * machNumber + ( - machNumber + 1.0 ); else return density * velocity * velocity * pressure; return density * velocity * velocity + pressure; } const RealType& positiveOtherMomentumFlux( const RealType& density, const RealType& velocity, const RealType& pressure ) const RealType& positiveOtherMomentumFlux( const RealType& density, const RealType& velocity_main, const RealType& velocity_other, const RealType& pressure ) { const RealType& speedOfSound = std::sqrt( this->gamma * pressure / density ); const RealType& machNumber = velocity / speedOfSound; const RealType& machNumber = velocity_main / speedOfSound; if ( machNumber <= -1.0 ) return 0; else if ( machNumber <= 0.0 ) return density * speedOfSound / ( 2 * this->gamma ) * ( machNumber + 1.0 ); return density * speedOfSound * speedOfSound / ( 2 * this->gamma ) * ( machNumber + 1.0 ) * velocity_other / speedOfSound; else if ( machNumber <= 1.0 ) return density * speedOfSound / ( 2 * this->gamma ) * ( ( 2.0 * this->gamma - 1.0 ) * machNumber + 1.0 ); return density * speedOfSound * speedOfSound / ( 2 * this->gamma ) * ( ( 2.0 * this->gamma - 1.0 ) * machNumber + 1.0 ) * velocity_other / speedOfSound; else return density * velocity; return density * velocity_main * velocity_other; } const RealType& negativeOtherMomentumFlux( const RealType& density, const RealType& velocity, const RealType& pressure ) const RealType& negativeOtherMomentumFlux( const RealType& density, const RealType& velocity_main, const RealType& velocity_other, const RealType& pressure ) { const RealType& speedOfSound = std::sqrt( this->gamma * pressure / density ); const RealType& machNumber = velocity / speedOfSound; const RealType& machNumber = velocity_main / speedOfSound; if ( machNumber <= -1.0 ) return density * velocity; return density * velocity_main * velocity_other; else if ( machNumber <= 0.0 ) return density * speedOfSound / ( 2 * this->gamma ) * ( ( 2.0 * this->gamma - 1.0 ) * machNumber - 1.0 ); return density * speedOfSound * speedOfSound / ( 2 * this->gamma ) * ( ( 2.0 * this->gamma - 1.0 ) * machNumber + 1.0 ) * velocity_other / speedOfSound; else if ( machNumber <= 1.0 ) return density * speedOfSound / ( 2 * this->gamma ) * ( machNumber - 1.0 ); return density * speedOfSound * speedOfSound / ( 2 * this->gamma ) * ( machNumber + 1.0 ) * velocity_other / speedOfSound; else return density * velocity; return 0; } protected: Loading Loading
examples/inviscid-flow-sw/UpwindMomentumBase.h +12 −12 Original line number Diff line number Diff line Loading @@ -77,35 +77,35 @@ class UpwindMomentumBase else if ( machNumber <= 1.0 ) return density * speedOfSound * speedOfSound / ( 2 * this->gamma ) * ( ( machNumber - 1.0 ) * machNumber + ( - machNumber + 1.0 ); else return density * velocity * velocity * pressure; return density * velocity * velocity + pressure; } const RealType& positiveOtherMomentumFlux( const RealType& density, const RealType& velocity, const RealType& pressure ) const RealType& positiveOtherMomentumFlux( const RealType& density, const RealType& velocity_main, const RealType& velocity_other, const RealType& pressure ) { const RealType& speedOfSound = std::sqrt( this->gamma * pressure / density ); const RealType& machNumber = velocity / speedOfSound; const RealType& machNumber = velocity_main / speedOfSound; if ( machNumber <= -1.0 ) return 0; else if ( machNumber <= 0.0 ) return density * speedOfSound / ( 2 * this->gamma ) * ( machNumber + 1.0 ); return density * speedOfSound * speedOfSound / ( 2 * this->gamma ) * ( machNumber + 1.0 ) * velocity_other / speedOfSound; else if ( machNumber <= 1.0 ) return density * speedOfSound / ( 2 * this->gamma ) * ( ( 2.0 * this->gamma - 1.0 ) * machNumber + 1.0 ); return density * speedOfSound * speedOfSound / ( 2 * this->gamma ) * ( ( 2.0 * this->gamma - 1.0 ) * machNumber + 1.0 ) * velocity_other / speedOfSound; else return density * velocity; return density * velocity_main * velocity_other; } const RealType& negativeOtherMomentumFlux( const RealType& density, const RealType& velocity, const RealType& pressure ) const RealType& negativeOtherMomentumFlux( const RealType& density, const RealType& velocity_main, const RealType& velocity_other, const RealType& pressure ) { const RealType& speedOfSound = std::sqrt( this->gamma * pressure / density ); const RealType& machNumber = velocity / speedOfSound; const RealType& machNumber = velocity_main / speedOfSound; if ( machNumber <= -1.0 ) return density * velocity; return density * velocity_main * velocity_other; else if ( machNumber <= 0.0 ) return density * speedOfSound / ( 2 * this->gamma ) * ( ( 2.0 * this->gamma - 1.0 ) * machNumber - 1.0 ); return density * speedOfSound * speedOfSound / ( 2 * this->gamma ) * ( ( 2.0 * this->gamma - 1.0 ) * machNumber + 1.0 ) * velocity_other / speedOfSound; else if ( machNumber <= 1.0 ) return density * speedOfSound / ( 2 * this->gamma ) * ( machNumber - 1.0 ); return density * speedOfSound * speedOfSound / ( 2 * this->gamma ) * ( machNumber + 1.0 ) * velocity_other / speedOfSound; else return density * velocity; return 0; } protected: Loading