Loading examples/navier-stokes/navierStokesSolver.h +1 −2 Original line number Diff line number Diff line Loading @@ -103,8 +103,7 @@ class navierStokesSolver tnlLinearDiffusion< MeshType >, navierStokesBoundaryConditions< MeshType > > nsSolver; tnlLinearDiffusion< MeshType > u1Viscosity, u2Viscosity; tnlLinearDiffusion< MeshType > u1Viscosity, u2Viscosity, eViscosity; tnlCentralFDMGradient< MeshType > pressureGradient; navierStokesBoundaryConditions< MeshType > boundaryConditions; Loading examples/navier-stokes/navierStokesSolver_impl.h +6 −2 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ bool navierStokesSolver< Mesh, EulerScheme > :: init( const tnlParameterContaine * Set-up model coefficients */ this->p_0 = parameters. GetParameter< double >( "p0" ); this->T = parameters. GetParameter< double >( "T"); nsSolver.setT( parameters. GetParameter< double >( "T") ); nsSolver.setHeatCapacityRatio( parameters. GetParameter< double >( "gamma" ) ); nsSolver.setMu( parameters. GetParameter< double >( "mu") ); nsSolver.setR( parameters. GetParameter< double >( "R") ); Loading Loading @@ -167,9 +167,11 @@ bool navierStokesSolver< Mesh, EulerScheme > :: init( const tnlParameterContaine this->u1Viscosity. setFunction( this -> nsSolver.getU1() ); this->u2Viscosity. bindMesh( this -> mesh ); this->u2Viscosity. setFunction( this -> nsSolver.getU2() ); this->eViscosity. bindMesh( this -> mesh ); nsSolver.setAdvectionScheme( this->eulerScheme ); nsSolver.setDiffusionScheme( this->u1Viscosity, this->u2Viscosity ); this->u2Viscosity, this->eViscosity ); return true; } Loading @@ -181,11 +183,13 @@ bool navierStokesSolver< Mesh, EulerScheme > :: setInitialCondition( const tnlPa dofs_rho. bind( & dofVector. getData()[ 0 ], dofs ); dofs_rho_u1. bind( & dofVector. getData()[ dofs ], dofs ); dofs_rho_u2. bind( & dofVector. getData()[ 2 * dofs ], dofs ); dofs_e. bind( & dofVector. getData()[ 3 * dofs ], dofs ); dofs_rho. setValue( p_0 / ( this->nsSolver.getR() * this->nsSolver.getT() ) ); dofs_rho_u1. setValue( 0.0 ); dofs_rho_u2. setValue( 0.0 ); dofs_e. setValue( p_0 / ( this->nsSolver.getHeatCapacityRatio() - 1.0 ) ); const IndexType& xSize = mesh. getDimensions(). x(); const IndexType& ySize = mesh. getDimensions(). y(); Loading src/implementation/solvers/cfd/navier-stokes/tnlNavierStokesSolver_impl.h +15 −9 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ tnlNavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::t : advection( 0 ), u1Viscosity( 0 ), u2Viscosity( 0 ), eViscosity( 0 ), mu( 0.0 ), gravity( 0.0 ), R( 0.0 ), Loading Loading @@ -61,10 +62,12 @@ template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions > void tnlNavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::setDiffusionScheme( DiffusionSchemeType& u1Viscosity, DiffusionSchemeType& u2Viscosity ) DiffusionSchemeType& u2Viscosity, DiffusionSchemeType& eViscosity ) { this->u1Viscosity = &u1Viscosity; this->u2Viscosity = &u2Viscosity; this->eViscosity = &eViscosity; } template< typename AdvectionScheme, Loading Loading @@ -249,18 +252,18 @@ template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions > typename tnlNavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::VectorType& tnlNavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getEnergy() tnlNavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getTemperature() { return this->e; return this->temperature; } template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions > const typename tnlNavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::VectorType& tnlNavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getEnergy() const tnlNavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getTemperature() const { return this->e; return this->temperature; } template< typename AdvectionScheme, Loading Loading @@ -312,9 +315,9 @@ void tnlNavierStokesSolver< AdvectionScheme, this->rho[ c ] = dofs_rho[ c ]; this->u1[ c ] = dofs_rho_u1[ c ] / dofs_rho[ c ]; this->u2[ c ] = dofs_rho_u2[ c ] / dofs_rho[ c ]; //this->p[ c ] = dofs_rho[ c ] * this -> R * this -> T; this->p[ c ] = ( this->gamma - 1.0 ) * ( dofs_e[ c ] - 0.5 * this->rho[ c ] * ( this->u1[ c ] * this->u1[ c ] + this->u2[ c ] * this->u2[ c ] ) ); this->p[ c ] = dofs_rho[ c ] * this -> R * this -> T; //this->p[ c ] = ( this->gamma - 1.0 ) * // ( dofs_e[ c ] - 0.5 * this->rho[ c ] * ( this->u1[ c ] * this->u1[ c ] + this->u2[ c ] * this->u2[ c ] ) ); this->temperature[ c ] = this->p[ c ] / ( this->rho[ c ] * this->R ); } } Loading Loading @@ -349,6 +352,8 @@ void tnlNavierStokesSolver< AdvectionScheme, this->advection->setRhoU1( dofs_rho_u1 ); this->advection->setRhoU2( dofs_rho_u2 ); this->advection->setE( dofs_e ); this->advection->setP( this->p ); this->eViscosity->setFunction( dofs_e ); rho_t.bind( & fu. getData()[ 0 ], dofs ); rho_u1_t.bind( & fu. getData()[ dofs ], dofs ); Loading Loading @@ -448,7 +453,8 @@ void tnlNavierStokesSolver< AdvectionScheme, */ rho_u1_t[ c ] += this->mu * u1Viscosity->getDiffusion( c ); rho_u2_t[ c ] += this->mu * u2Viscosity->getDiffusion( c ); e_t[ c ] += eViscosity->getDiffusion( c ); e_t[ c ] = 0.0; } /*rhsDofVector = fu; Loading src/solvers/cfd/navier-stokes/tnlNavierStokesSolver.h +5 −4 Original line number Diff line number Diff line Loading @@ -45,7 +45,8 @@ class tnlNavierStokesSolver void setAdvectionScheme( AdvectionSchemeType& advection ); void setDiffusionScheme( DiffusionSchemeType& u1Viscosity, DiffusionSchemeType& u2Viscosity ); DiffusionSchemeType& u2Viscosity, DiffusionSchemeType& eViscosity); void setBoundaryConditions( BoundaryConditionsType& boundaryConditions ); Loading Loading @@ -87,9 +88,9 @@ class tnlNavierStokesSolver const VectorType& getPressure() const; VectorType& getEnergy(); VectorType& getTemperature(); const VectorType& getEnergy() const; const VectorType& getTemperature() const; IndexType getDofs() const; Loading Loading @@ -127,7 +128,7 @@ class tnlNavierStokesSolver AdvectionSchemeType* advection; DiffusionSchemeType *u1Viscosity, *u2Viscosity; DiffusionSchemeType *u1Viscosity, *u2Viscosity, *eViscosity; BoundaryConditionsType* boundaryConditions; Loading Loading
examples/navier-stokes/navierStokesSolver.h +1 −2 Original line number Diff line number Diff line Loading @@ -103,8 +103,7 @@ class navierStokesSolver tnlLinearDiffusion< MeshType >, navierStokesBoundaryConditions< MeshType > > nsSolver; tnlLinearDiffusion< MeshType > u1Viscosity, u2Viscosity; tnlLinearDiffusion< MeshType > u1Viscosity, u2Viscosity, eViscosity; tnlCentralFDMGradient< MeshType > pressureGradient; navierStokesBoundaryConditions< MeshType > boundaryConditions; Loading
examples/navier-stokes/navierStokesSolver_impl.h +6 −2 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ bool navierStokesSolver< Mesh, EulerScheme > :: init( const tnlParameterContaine * Set-up model coefficients */ this->p_0 = parameters. GetParameter< double >( "p0" ); this->T = parameters. GetParameter< double >( "T"); nsSolver.setT( parameters. GetParameter< double >( "T") ); nsSolver.setHeatCapacityRatio( parameters. GetParameter< double >( "gamma" ) ); nsSolver.setMu( parameters. GetParameter< double >( "mu") ); nsSolver.setR( parameters. GetParameter< double >( "R") ); Loading Loading @@ -167,9 +167,11 @@ bool navierStokesSolver< Mesh, EulerScheme > :: init( const tnlParameterContaine this->u1Viscosity. setFunction( this -> nsSolver.getU1() ); this->u2Viscosity. bindMesh( this -> mesh ); this->u2Viscosity. setFunction( this -> nsSolver.getU2() ); this->eViscosity. bindMesh( this -> mesh ); nsSolver.setAdvectionScheme( this->eulerScheme ); nsSolver.setDiffusionScheme( this->u1Viscosity, this->u2Viscosity ); this->u2Viscosity, this->eViscosity ); return true; } Loading @@ -181,11 +183,13 @@ bool navierStokesSolver< Mesh, EulerScheme > :: setInitialCondition( const tnlPa dofs_rho. bind( & dofVector. getData()[ 0 ], dofs ); dofs_rho_u1. bind( & dofVector. getData()[ dofs ], dofs ); dofs_rho_u2. bind( & dofVector. getData()[ 2 * dofs ], dofs ); dofs_e. bind( & dofVector. getData()[ 3 * dofs ], dofs ); dofs_rho. setValue( p_0 / ( this->nsSolver.getR() * this->nsSolver.getT() ) ); dofs_rho_u1. setValue( 0.0 ); dofs_rho_u2. setValue( 0.0 ); dofs_e. setValue( p_0 / ( this->nsSolver.getHeatCapacityRatio() - 1.0 ) ); const IndexType& xSize = mesh. getDimensions(). x(); const IndexType& ySize = mesh. getDimensions(). y(); Loading
src/implementation/solvers/cfd/navier-stokes/tnlNavierStokesSolver_impl.h +15 −9 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ tnlNavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::t : advection( 0 ), u1Viscosity( 0 ), u2Viscosity( 0 ), eViscosity( 0 ), mu( 0.0 ), gravity( 0.0 ), R( 0.0 ), Loading Loading @@ -61,10 +62,12 @@ template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions > void tnlNavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::setDiffusionScheme( DiffusionSchemeType& u1Viscosity, DiffusionSchemeType& u2Viscosity ) DiffusionSchemeType& u2Viscosity, DiffusionSchemeType& eViscosity ) { this->u1Viscosity = &u1Viscosity; this->u2Viscosity = &u2Viscosity; this->eViscosity = &eViscosity; } template< typename AdvectionScheme, Loading Loading @@ -249,18 +252,18 @@ template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions > typename tnlNavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::VectorType& tnlNavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getEnergy() tnlNavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getTemperature() { return this->e; return this->temperature; } template< typename AdvectionScheme, typename DiffusionScheme, typename BoundaryConditions > const typename tnlNavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::VectorType& tnlNavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getEnergy() const tnlNavierStokesSolver< AdvectionScheme, DiffusionScheme, BoundaryConditions >::getTemperature() const { return this->e; return this->temperature; } template< typename AdvectionScheme, Loading Loading @@ -312,9 +315,9 @@ void tnlNavierStokesSolver< AdvectionScheme, this->rho[ c ] = dofs_rho[ c ]; this->u1[ c ] = dofs_rho_u1[ c ] / dofs_rho[ c ]; this->u2[ c ] = dofs_rho_u2[ c ] / dofs_rho[ c ]; //this->p[ c ] = dofs_rho[ c ] * this -> R * this -> T; this->p[ c ] = ( this->gamma - 1.0 ) * ( dofs_e[ c ] - 0.5 * this->rho[ c ] * ( this->u1[ c ] * this->u1[ c ] + this->u2[ c ] * this->u2[ c ] ) ); this->p[ c ] = dofs_rho[ c ] * this -> R * this -> T; //this->p[ c ] = ( this->gamma - 1.0 ) * // ( dofs_e[ c ] - 0.5 * this->rho[ c ] * ( this->u1[ c ] * this->u1[ c ] + this->u2[ c ] * this->u2[ c ] ) ); this->temperature[ c ] = this->p[ c ] / ( this->rho[ c ] * this->R ); } } Loading Loading @@ -349,6 +352,8 @@ void tnlNavierStokesSolver< AdvectionScheme, this->advection->setRhoU1( dofs_rho_u1 ); this->advection->setRhoU2( dofs_rho_u2 ); this->advection->setE( dofs_e ); this->advection->setP( this->p ); this->eViscosity->setFunction( dofs_e ); rho_t.bind( & fu. getData()[ 0 ], dofs ); rho_u1_t.bind( & fu. getData()[ dofs ], dofs ); Loading Loading @@ -448,7 +453,8 @@ void tnlNavierStokesSolver< AdvectionScheme, */ rho_u1_t[ c ] += this->mu * u1Viscosity->getDiffusion( c ); rho_u2_t[ c ] += this->mu * u2Viscosity->getDiffusion( c ); e_t[ c ] += eViscosity->getDiffusion( c ); e_t[ c ] = 0.0; } /*rhsDofVector = fu; Loading
src/solvers/cfd/navier-stokes/tnlNavierStokesSolver.h +5 −4 Original line number Diff line number Diff line Loading @@ -45,7 +45,8 @@ class tnlNavierStokesSolver void setAdvectionScheme( AdvectionSchemeType& advection ); void setDiffusionScheme( DiffusionSchemeType& u1Viscosity, DiffusionSchemeType& u2Viscosity ); DiffusionSchemeType& u2Viscosity, DiffusionSchemeType& eViscosity); void setBoundaryConditions( BoundaryConditionsType& boundaryConditions ); Loading Loading @@ -87,9 +88,9 @@ class tnlNavierStokesSolver const VectorType& getPressure() const; VectorType& getEnergy(); VectorType& getTemperature(); const VectorType& getEnergy() const; const VectorType& getTemperature() const; IndexType getDofs() const; Loading Loading @@ -127,7 +128,7 @@ class tnlNavierStokesSolver AdvectionSchemeType* advection; DiffusionSchemeType *u1Viscosity, *u2Viscosity; DiffusionSchemeType *u1Viscosity, *u2Viscosity, *eViscosity; BoundaryConditionsType* boundaryConditions; Loading