Loading examples/navier-stokes/Makefile +1 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ CXX_FLAGS = -std=gnu++0x -I$(TNL_INCLUDE_DIR) -O3 $(OMP_FLAGS) -DTEMPLATE_EXPLIC LD_FLAGS = -L$(TNL_INSTALL_DIR) -ltnl-0.1 -lgomp #LD_FLAGS = -L$(TNL_INSTALL_DIR) -ltnl-dbg-0.1 -lgomp SOURCES = main.cpp HEADERS = navierStokesSetter.h \ Loading examples/navier-stokes/navierStokesSolver_impl.h +21 −21 Original line number Diff line number Diff line Loading @@ -177,13 +177,13 @@ bool navierStokesSolver< Mesh, EulerScheme > :: init( const tnlParameterContaine template< typename Mesh, typename EulerScheme > bool navierStokesSolver< Mesh, EulerScheme > :: setInitialCondition( const tnlParameterContainer& parameters ) { tnlSharedVector< RealType, DeviceType, IndexType > rho, rho_u1, rho_u2; tnlSharedVector< RealType, DeviceType, IndexType > dofs_rho, rho_u1, rho_u2; const IndexType& dofs = mesh. getDofs(); rho. bind( & dofVector. getData()[ 0 ], dofs ); dofs_rho. bind( & dofVector. getData()[ 0 ], dofs ); rho_u1. bind( & dofVector. getData()[ dofs ], dofs ); rho_u2. bind( & dofVector. getData()[ 2 * dofs ], dofs ); rho. setValue( p_0 / ( this -> R * this -> T ) ); dofs_rho. setValue( p_0 / ( this -> R * this -> T ) ); rho_u1. setValue( 0.0 ); rho_u2. setValue( 0.0 ); Loading @@ -199,7 +199,7 @@ bool navierStokesSolver< Mesh, EulerScheme > :: setInitialCondition( const tnlPa const RealType x = i * hx; const RealType y = j * hy; rho. setElement( c, p_0 / ( this -> R * this -> T ) ); dofs_rho. setElement( c, p_0 / ( this -> R * this -> T ) ); rho_u1. setElement( c, 0.0 ); rho_u2. setElement( c, 0.0 ); Loading Loading @@ -273,7 +273,7 @@ bool navierStokesSolver< Mesh, EulerScheme > :: makeSnapshot( const RealType& t, template< typename Mesh, typename EulerScheme > template< typename Vector > void navierStokesSolver< Mesh, EulerScheme > :: updatePhysicalQuantities( const Vector& rho, void navierStokesSolver< Mesh, EulerScheme > :: updatePhysicalQuantities( const Vector& dofs_rho, const Vector& rho_u1, const Vector& rho_u2 ) { Loading @@ -289,9 +289,10 @@ void navierStokesSolver< Mesh, EulerScheme > :: updatePhysicalQuantities( const for( IndexType i = 0; i < xSize; i ++ ) { IndexType c = mesh. getElementIndex( i, j ); u1[ c ] = rho_u1[ c ] / rho[ c ]; u2[ c ] = rho_u2[ c ] / rho[ c ]; p[ c ] = rho[ c ] * this -> R * this -> T; this->rho[ c ] = dofs_rho[ c ]; this->u1[ c ] = rho_u1[ c ] / this->rho[ c ]; this->u2[ c ] = rho_u2[ c ] / this->rho[ c ]; this->p[ c ] = this->rho[ c ] * this -> R * this -> T; } } } Loading @@ -310,7 +311,7 @@ void navierStokesSolver< Mesh, EulerScheme > :: GetExplicitRHS( const RealType& rho_u1. bind( & u. getData()[ dofs ], dofs ); rho_u2. bind( & u. getData()[ 2 * dofs ], dofs ); eulerScheme. setRho( rho ); eulerScheme. setRho( dofs_rho ); eulerScheme. setRhoU1( rho_u1 ); eulerScheme. setRhoU2( rho_u2 ); Loading Loading @@ -361,7 +362,6 @@ void navierStokesSolver< Mesh, EulerScheme > :: GetExplicitRHS( const RealType& } const RealType c = sqrt( this -> R * this -> T ); #ifdef HAVE_OPENMP #pragma omp parallel for #endif Loading Loading @@ -394,9 +394,9 @@ void navierStokesSolver< Mesh, EulerScheme > :: GetExplicitRHS( const RealType& } } //rhsDofVector = fu; //makeSnapshot( 0.0, 1 ); //getchar(); /*rhsDofVector = fu; makeSnapshot( 0.0, 1 ); getchar();*/ } Loading src/core/arrays/tnlSharedArray.h +3 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,9 @@ class tnlSharedArray : public tnlObject Element* data; }; template< typename Element, typename Device, typename Index > ostream& operator << ( ostream& str, const tnlSharedArray< Element, Device, Index >& v ); #include <implementation/core/arrays/tnlSharedArray_impl.h> #endif /* TNLSHAREDARRAY_H_ */ src/implementation/core/arrays/tnlArray_impl.h +7 −3 Original line number Diff line number Diff line Loading @@ -390,9 +390,13 @@ tnlArray< Element, Device, Index > :: ~tnlArray() template< typename Element, typename Device, typename Index > ostream& operator << ( ostream& str, const tnlArray< Element, Device, Index >& v ) { str << "[ " << v.getElement( 0 ); str << "[ "; if( v.getSize() > 0 ) { str << v.getElement( 0 ); for( Index i = 1; i < v.getSize(); i++ ) str << ", " << v. getElement( i ); } str << " ]"; } Loading src/implementation/core/arrays/tnlSharedArray_impl.h +13 −0 Original line number Diff line number Diff line Loading @@ -314,6 +314,19 @@ bool tnlSharedArray< Element, Device, Index > :: save( const tnlString& fileName return tnlObject :: save( fileName ); }; template< typename Element, typename Device, typename Index > ostream& operator << ( ostream& str, const tnlSharedArray< Element, Device, Index >& v ) { str << "[ "; if( v.getSize() > 0 ) { str << v.getElement( 0 ); for( Index i = 1; i < v.getSize(); i++ ) str << ", " << v. getElement( i ); } str << " ]"; } //}; // namespace implementation Loading Loading
examples/navier-stokes/Makefile +1 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ CXX_FLAGS = -std=gnu++0x -I$(TNL_INCLUDE_DIR) -O3 $(OMP_FLAGS) -DTEMPLATE_EXPLIC LD_FLAGS = -L$(TNL_INSTALL_DIR) -ltnl-0.1 -lgomp #LD_FLAGS = -L$(TNL_INSTALL_DIR) -ltnl-dbg-0.1 -lgomp SOURCES = main.cpp HEADERS = navierStokesSetter.h \ Loading
examples/navier-stokes/navierStokesSolver_impl.h +21 −21 Original line number Diff line number Diff line Loading @@ -177,13 +177,13 @@ bool navierStokesSolver< Mesh, EulerScheme > :: init( const tnlParameterContaine template< typename Mesh, typename EulerScheme > bool navierStokesSolver< Mesh, EulerScheme > :: setInitialCondition( const tnlParameterContainer& parameters ) { tnlSharedVector< RealType, DeviceType, IndexType > rho, rho_u1, rho_u2; tnlSharedVector< RealType, DeviceType, IndexType > dofs_rho, rho_u1, rho_u2; const IndexType& dofs = mesh. getDofs(); rho. bind( & dofVector. getData()[ 0 ], dofs ); dofs_rho. bind( & dofVector. getData()[ 0 ], dofs ); rho_u1. bind( & dofVector. getData()[ dofs ], dofs ); rho_u2. bind( & dofVector. getData()[ 2 * dofs ], dofs ); rho. setValue( p_0 / ( this -> R * this -> T ) ); dofs_rho. setValue( p_0 / ( this -> R * this -> T ) ); rho_u1. setValue( 0.0 ); rho_u2. setValue( 0.0 ); Loading @@ -199,7 +199,7 @@ bool navierStokesSolver< Mesh, EulerScheme > :: setInitialCondition( const tnlPa const RealType x = i * hx; const RealType y = j * hy; rho. setElement( c, p_0 / ( this -> R * this -> T ) ); dofs_rho. setElement( c, p_0 / ( this -> R * this -> T ) ); rho_u1. setElement( c, 0.0 ); rho_u2. setElement( c, 0.0 ); Loading Loading @@ -273,7 +273,7 @@ bool navierStokesSolver< Mesh, EulerScheme > :: makeSnapshot( const RealType& t, template< typename Mesh, typename EulerScheme > template< typename Vector > void navierStokesSolver< Mesh, EulerScheme > :: updatePhysicalQuantities( const Vector& rho, void navierStokesSolver< Mesh, EulerScheme > :: updatePhysicalQuantities( const Vector& dofs_rho, const Vector& rho_u1, const Vector& rho_u2 ) { Loading @@ -289,9 +289,10 @@ void navierStokesSolver< Mesh, EulerScheme > :: updatePhysicalQuantities( const for( IndexType i = 0; i < xSize; i ++ ) { IndexType c = mesh. getElementIndex( i, j ); u1[ c ] = rho_u1[ c ] / rho[ c ]; u2[ c ] = rho_u2[ c ] / rho[ c ]; p[ c ] = rho[ c ] * this -> R * this -> T; this->rho[ c ] = dofs_rho[ c ]; this->u1[ c ] = rho_u1[ c ] / this->rho[ c ]; this->u2[ c ] = rho_u2[ c ] / this->rho[ c ]; this->p[ c ] = this->rho[ c ] * this -> R * this -> T; } } } Loading @@ -310,7 +311,7 @@ void navierStokesSolver< Mesh, EulerScheme > :: GetExplicitRHS( const RealType& rho_u1. bind( & u. getData()[ dofs ], dofs ); rho_u2. bind( & u. getData()[ 2 * dofs ], dofs ); eulerScheme. setRho( rho ); eulerScheme. setRho( dofs_rho ); eulerScheme. setRhoU1( rho_u1 ); eulerScheme. setRhoU2( rho_u2 ); Loading Loading @@ -361,7 +362,6 @@ void navierStokesSolver< Mesh, EulerScheme > :: GetExplicitRHS( const RealType& } const RealType c = sqrt( this -> R * this -> T ); #ifdef HAVE_OPENMP #pragma omp parallel for #endif Loading Loading @@ -394,9 +394,9 @@ void navierStokesSolver< Mesh, EulerScheme > :: GetExplicitRHS( const RealType& } } //rhsDofVector = fu; //makeSnapshot( 0.0, 1 ); //getchar(); /*rhsDofVector = fu; makeSnapshot( 0.0, 1 ); getchar();*/ } Loading
src/core/arrays/tnlSharedArray.h +3 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,9 @@ class tnlSharedArray : public tnlObject Element* data; }; template< typename Element, typename Device, typename Index > ostream& operator << ( ostream& str, const tnlSharedArray< Element, Device, Index >& v ); #include <implementation/core/arrays/tnlSharedArray_impl.h> #endif /* TNLSHAREDARRAY_H_ */
src/implementation/core/arrays/tnlArray_impl.h +7 −3 Original line number Diff line number Diff line Loading @@ -390,9 +390,13 @@ tnlArray< Element, Device, Index > :: ~tnlArray() template< typename Element, typename Device, typename Index > ostream& operator << ( ostream& str, const tnlArray< Element, Device, Index >& v ) { str << "[ " << v.getElement( 0 ); str << "[ "; if( v.getSize() > 0 ) { str << v.getElement( 0 ); for( Index i = 1; i < v.getSize(); i++ ) str << ", " << v. getElement( i ); } str << " ]"; } Loading
src/implementation/core/arrays/tnlSharedArray_impl.h +13 −0 Original line number Diff line number Diff line Loading @@ -314,6 +314,19 @@ bool tnlSharedArray< Element, Device, Index > :: save( const tnlString& fileName return tnlObject :: save( fileName ); }; template< typename Element, typename Device, typename Index > ostream& operator << ( ostream& str, const tnlSharedArray< Element, Device, Index >& v ) { str << "[ "; if( v.getSize() > 0 ) { str << v.getElement( 0 ); for( Index i = 1; i < v.getSize(); i++ ) str << ", " << v. getElement( i ); } str << " ]"; } //}; // namespace implementation Loading