diff --git a/examples/inviscid-flow-sw/UpwindMomentumBase.h b/examples/inviscid-flow-sw/UpwindMomentumBase.h index 8bbc9015a978b1d33543d42e08375f1f518940c1..dd33e3a9783bbb95b9a2530582f63f8730295f37 100644 --- a/examples/inviscid-flow-sw/UpwindMomentumBase.h +++ b/examples/inviscid-flow-sw/UpwindMomentumBase.h @@ -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: