Loading examples/inviscid-flow/CompressibleConservativeVariables.h +7 −10 Original line number Diff line number Diff line Loading @@ -46,9 +46,6 @@ class CompressibleConservativeVariables this->momentum->setMesh( meshPointer ); //this->pressure.setMesh( meshPointer ); this->energy->setMesh( meshPointer ); this->dofs = this->density->getDofs() + this->momentum->getDofs() + this->energy->getDofs(); } template< typename Vector > Loading @@ -58,18 +55,20 @@ class CompressibleConservativeVariables { IndexType currentOffset( offset ); this->density->bind( meshPointer, data, currentOffset ); currentOffset += this->density->getDofs(); currentOffset += this->density->getDofs( meshPointer ); for( IndexType i = 0; i < Dimensions; i++ ) { ( *this->momentum )[ i ]->bind( meshPointer, data, currentOffset ); currentOffset += ( *this->momentum )[ i ]->getDofs(); currentOffset += ( *this->momentum )[ i ]->getDofs( meshPointer ); } this->energy->bind( meshPointer, data, currentOffset ); } void IndexType getDofs() const IndexType getDofs( const MeshPointer& meshPointer ) const { return this->dofs; return this->density->getDofs( meshPointer ) + this->momentum->getDofs( meshPointer ) + this->energy->getDofs( meshPointer ); } MeshFunctionPointer& getDensity() Loading Loading @@ -139,8 +138,6 @@ class CompressibleConservativeVariables protected: IndexType dofs; MeshFunctionPointer density; MomentumFieldPointer momentum; //MeshFunctionPointer pressure; Loading examples/inviscid-flow/PhysicalVariablesGetter.h +12 −9 Original line number Diff line number Diff line Loading @@ -27,18 +27,21 @@ class PhysicalVariablesGetter typedef typename MeshType::RealType RealType; typedef typename MeshType::DeviceType DeviceType; typedef typename MeshType::IndexType IndexType; static const int Dimensions = MeshType::getMeshDimensions(); typedef Functions::MeshFunction< MeshType > MeshFunctionType; typedef SharedPointer< MeshFunctionType > MeshFunctionPointer; typedef CompressibleConservativeVariables< MeshType > ConservativeVariablesType; typedef SharedPointer< ConservativeVariablesType > ConservativeVariablesPointer; typedef Functions::VectorField< MeshType > VelocityFieldType; typedef Functions::VectorField< Dimensions, MeshFunctionType > VelocityFieldType; typedef SharedPointer< VelocityFieldType > VelocityFieldPointer; static const int Dimensions = MeshType::getMeshDimensions(); class VelocityGetter : public Functions::Domain< Dimensions, Functions::MeshDomain > { public: typedef typename MeshType::RealType RealType; VelocityGetter( MeshFunctionPointer density, MeshFunctionPointer momentum ) Loading @@ -46,26 +49,26 @@ class PhysicalVariablesGetter template< typename EntityType > __cuda_callable__ const RealType& operator()( const EntityType& meshEntity, RealType operator()( const EntityType& meshEntity, const RealType& time = 0.0 ) const { return momentum.template getData< DeviceType >( meshEntity ) / density.template getData< DeviceType >( meshEntity ); return momentum.template getData< DeviceType >()( meshEntity ) / density.template getData< DeviceType >()( meshEntity ); } protected: const MeshFunctionPointer density, momentum; }; void getVelocity( const ConservativeVariablesType& conservativeVariables, void getVelocity( const ConservativeVariablesPointer& conservativeVariables, VelocityFieldPointer& velocity ) { Functions::MeshFunctionEvaluator< MeshFunctionType, VelocityGetter > evaluator; for( int i = 0; i < Dimensions; i++ ) { SharedPointer< VelocityGetter, DeviceType > velocityGetter( conservativeVariables.getDensity(), conservativeVariables.getMomentum()[ i ] ); evaluator.evaluate( velocity[ i ], velocityGetter ); SharedPointer< VelocityGetter, DeviceType > velocityGetter( conservativeVariables->getDensity(), ( *conservativeVariables->getMomentum() )[ i ] ); evaluator.evaluate( ( *velocity )[ i ], velocityGetter ); } } Loading examples/inviscid-flow/eulerProblem.h +4 −3 Original line number Diff line number Diff line Loading @@ -130,9 +130,10 @@ class eulerProblem: VelocityFieldPointer velocity; MeshFunctionPointer pressure, energy; RealType gamma; //definition Containers::Vector< RealType, DeviceType, IndexType > _uRho; /*Containers::Vector< RealType, DeviceType, IndexType > _uRho; Containers::Vector< RealType, DeviceType, IndexType > _uRhoVelocityX; Containers::Vector< RealType, DeviceType, IndexType > _uRhoVelocityY; Containers::Vector< RealType, DeviceType, IndexType > _uEnergy; Loading @@ -150,8 +151,8 @@ class eulerProblem: Containers::Vector< RealType, DeviceType, IndexType > pressure; Containers::Vector< RealType, DeviceType, IndexType > velocity; Containers::Vector< RealType, DeviceType, IndexType > velocityX; Containers::Vector< RealType, DeviceType, IndexType > velocityY; double gamma; Containers::Vector< RealType, DeviceType, IndexType > velocityY;*/ }; } // namespace TNL Loading examples/inviscid-flow/eulerProblem_impl.h +8 −5 Original line number Diff line number Diff line Loading @@ -100,7 +100,7 @@ getDofs( const MeshPointer& mesh ) const * Return number of DOFs (degrees of freedom) i.e. number * of unknowns to be resolved by the main solver. */ return this->conservativeVariables->getDofs(); return this->conservativeVariables->getDofs( mesh ); } template< typename Mesh, Loading @@ -112,7 +112,7 @@ eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >:: bindDofs( const MeshPointer& mesh, DofVectorPointer& dofVector ) { this->conservativeVariables.bind( mesh, dofVector ); this->conservativeVariables->bind( mesh, dofVector ); } template< typename Mesh, Loading Loading @@ -182,8 +182,8 @@ makeSnapshot( const RealType& time, this->bindDofs( mesh, dofs ); PhysicalVariablesGetter< MeshType > physicalVariablesGetter; physicalVariablesGetter.getVelocity( this->conservativeVariables, this->velocity ); physicalVariablesGetter.getPressure( this->conservativeVariables, this->pressure ); physicalVariablesGetter.getEnergy( this->conservativeVariables, this->energy ); //physicalVariablesGetter.getPressure( this->conservativeVariables, this->pressure ); //physicalVariablesGetter.getEnergy( this->conservativeVariables, this->energy ); FileName fileName; fileName.setExtension( "tnl" ); Loading Loading @@ -220,7 +220,7 @@ getExplicitRHS( const RealType& time, DofVectorPointer& _fu, MeshDependentDataPointer& meshDependentData ) { typedef typename MeshType::Cell Cell; /*typedef typename MeshType::Cell Cell; int count = mesh->template getEntitiesCount< Cell >()/4; //bind _u this->_uRho.bind( *_u,0,count); Loading Loading @@ -307,6 +307,7 @@ getExplicitRHS( const RealType& time, this->rightHandSidePointer, uEnergy, fuEnergy ); */ /* BoundaryConditionsSetter< MeshFunctionType, BoundaryCondition > boundaryConditionsSetter; Loading Loading @@ -364,6 +365,7 @@ postIterate( const RealType& time, DofVectorPointer& dofs, MeshDependentDataPointer& meshDependentData ) { /* typedef typename MeshType::Cell Cell; int count = mesh->template getEntitiesCount< Cell >()/4; //bind _u Loading Loading @@ -411,6 +413,7 @@ postIterate( const RealType& time, euler2DPressure.setRho(uRho); // OperatorFunction< euler2DPressure, MeshFunction, void, time > OFPressure; // pressure = OFPressure; */ return true; } Loading src/TNL/Functions/MeshFunction.h +1 −1 Original line number Diff line number Diff line Loading @@ -92,7 +92,7 @@ class MeshFunction : const MeshPointer& getMeshPointer() const; __cuda_callable__ IndexType getDofs() const; __cuda_callable__ IndexType getDofs( const MeshPointer& meshPointer ) const; __cuda_callable__ const VectorType& getData() const; Loading Loading
examples/inviscid-flow/CompressibleConservativeVariables.h +7 −10 Original line number Diff line number Diff line Loading @@ -46,9 +46,6 @@ class CompressibleConservativeVariables this->momentum->setMesh( meshPointer ); //this->pressure.setMesh( meshPointer ); this->energy->setMesh( meshPointer ); this->dofs = this->density->getDofs() + this->momentum->getDofs() + this->energy->getDofs(); } template< typename Vector > Loading @@ -58,18 +55,20 @@ class CompressibleConservativeVariables { IndexType currentOffset( offset ); this->density->bind( meshPointer, data, currentOffset ); currentOffset += this->density->getDofs(); currentOffset += this->density->getDofs( meshPointer ); for( IndexType i = 0; i < Dimensions; i++ ) { ( *this->momentum )[ i ]->bind( meshPointer, data, currentOffset ); currentOffset += ( *this->momentum )[ i ]->getDofs(); currentOffset += ( *this->momentum )[ i ]->getDofs( meshPointer ); } this->energy->bind( meshPointer, data, currentOffset ); } void IndexType getDofs() const IndexType getDofs( const MeshPointer& meshPointer ) const { return this->dofs; return this->density->getDofs( meshPointer ) + this->momentum->getDofs( meshPointer ) + this->energy->getDofs( meshPointer ); } MeshFunctionPointer& getDensity() Loading Loading @@ -139,8 +138,6 @@ class CompressibleConservativeVariables protected: IndexType dofs; MeshFunctionPointer density; MomentumFieldPointer momentum; //MeshFunctionPointer pressure; Loading
examples/inviscid-flow/PhysicalVariablesGetter.h +12 −9 Original line number Diff line number Diff line Loading @@ -27,18 +27,21 @@ class PhysicalVariablesGetter typedef typename MeshType::RealType RealType; typedef typename MeshType::DeviceType DeviceType; typedef typename MeshType::IndexType IndexType; static const int Dimensions = MeshType::getMeshDimensions(); typedef Functions::MeshFunction< MeshType > MeshFunctionType; typedef SharedPointer< MeshFunctionType > MeshFunctionPointer; typedef CompressibleConservativeVariables< MeshType > ConservativeVariablesType; typedef SharedPointer< ConservativeVariablesType > ConservativeVariablesPointer; typedef Functions::VectorField< MeshType > VelocityFieldType; typedef Functions::VectorField< Dimensions, MeshFunctionType > VelocityFieldType; typedef SharedPointer< VelocityFieldType > VelocityFieldPointer; static const int Dimensions = MeshType::getMeshDimensions(); class VelocityGetter : public Functions::Domain< Dimensions, Functions::MeshDomain > { public: typedef typename MeshType::RealType RealType; VelocityGetter( MeshFunctionPointer density, MeshFunctionPointer momentum ) Loading @@ -46,26 +49,26 @@ class PhysicalVariablesGetter template< typename EntityType > __cuda_callable__ const RealType& operator()( const EntityType& meshEntity, RealType operator()( const EntityType& meshEntity, const RealType& time = 0.0 ) const { return momentum.template getData< DeviceType >( meshEntity ) / density.template getData< DeviceType >( meshEntity ); return momentum.template getData< DeviceType >()( meshEntity ) / density.template getData< DeviceType >()( meshEntity ); } protected: const MeshFunctionPointer density, momentum; }; void getVelocity( const ConservativeVariablesType& conservativeVariables, void getVelocity( const ConservativeVariablesPointer& conservativeVariables, VelocityFieldPointer& velocity ) { Functions::MeshFunctionEvaluator< MeshFunctionType, VelocityGetter > evaluator; for( int i = 0; i < Dimensions; i++ ) { SharedPointer< VelocityGetter, DeviceType > velocityGetter( conservativeVariables.getDensity(), conservativeVariables.getMomentum()[ i ] ); evaluator.evaluate( velocity[ i ], velocityGetter ); SharedPointer< VelocityGetter, DeviceType > velocityGetter( conservativeVariables->getDensity(), ( *conservativeVariables->getMomentum() )[ i ] ); evaluator.evaluate( ( *velocity )[ i ], velocityGetter ); } } Loading
examples/inviscid-flow/eulerProblem.h +4 −3 Original line number Diff line number Diff line Loading @@ -130,9 +130,10 @@ class eulerProblem: VelocityFieldPointer velocity; MeshFunctionPointer pressure, energy; RealType gamma; //definition Containers::Vector< RealType, DeviceType, IndexType > _uRho; /*Containers::Vector< RealType, DeviceType, IndexType > _uRho; Containers::Vector< RealType, DeviceType, IndexType > _uRhoVelocityX; Containers::Vector< RealType, DeviceType, IndexType > _uRhoVelocityY; Containers::Vector< RealType, DeviceType, IndexType > _uEnergy; Loading @@ -150,8 +151,8 @@ class eulerProblem: Containers::Vector< RealType, DeviceType, IndexType > pressure; Containers::Vector< RealType, DeviceType, IndexType > velocity; Containers::Vector< RealType, DeviceType, IndexType > velocityX; Containers::Vector< RealType, DeviceType, IndexType > velocityY; double gamma; Containers::Vector< RealType, DeviceType, IndexType > velocityY;*/ }; } // namespace TNL Loading
examples/inviscid-flow/eulerProblem_impl.h +8 −5 Original line number Diff line number Diff line Loading @@ -100,7 +100,7 @@ getDofs( const MeshPointer& mesh ) const * Return number of DOFs (degrees of freedom) i.e. number * of unknowns to be resolved by the main solver. */ return this->conservativeVariables->getDofs(); return this->conservativeVariables->getDofs( mesh ); } template< typename Mesh, Loading @@ -112,7 +112,7 @@ eulerProblem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >:: bindDofs( const MeshPointer& mesh, DofVectorPointer& dofVector ) { this->conservativeVariables.bind( mesh, dofVector ); this->conservativeVariables->bind( mesh, dofVector ); } template< typename Mesh, Loading Loading @@ -182,8 +182,8 @@ makeSnapshot( const RealType& time, this->bindDofs( mesh, dofs ); PhysicalVariablesGetter< MeshType > physicalVariablesGetter; physicalVariablesGetter.getVelocity( this->conservativeVariables, this->velocity ); physicalVariablesGetter.getPressure( this->conservativeVariables, this->pressure ); physicalVariablesGetter.getEnergy( this->conservativeVariables, this->energy ); //physicalVariablesGetter.getPressure( this->conservativeVariables, this->pressure ); //physicalVariablesGetter.getEnergy( this->conservativeVariables, this->energy ); FileName fileName; fileName.setExtension( "tnl" ); Loading Loading @@ -220,7 +220,7 @@ getExplicitRHS( const RealType& time, DofVectorPointer& _fu, MeshDependentDataPointer& meshDependentData ) { typedef typename MeshType::Cell Cell; /*typedef typename MeshType::Cell Cell; int count = mesh->template getEntitiesCount< Cell >()/4; //bind _u this->_uRho.bind( *_u,0,count); Loading Loading @@ -307,6 +307,7 @@ getExplicitRHS( const RealType& time, this->rightHandSidePointer, uEnergy, fuEnergy ); */ /* BoundaryConditionsSetter< MeshFunctionType, BoundaryCondition > boundaryConditionsSetter; Loading Loading @@ -364,6 +365,7 @@ postIterate( const RealType& time, DofVectorPointer& dofs, MeshDependentDataPointer& meshDependentData ) { /* typedef typename MeshType::Cell Cell; int count = mesh->template getEntitiesCount< Cell >()/4; //bind _u Loading Loading @@ -411,6 +413,7 @@ postIterate( const RealType& time, euler2DPressure.setRho(uRho); // OperatorFunction< euler2DPressure, MeshFunction, void, time > OFPressure; // pressure = OFPressure; */ return true; } Loading
src/TNL/Functions/MeshFunction.h +1 −1 Original line number Diff line number Diff line Loading @@ -92,7 +92,7 @@ class MeshFunction : const MeshPointer& getMeshPointer() const; __cuda_callable__ IndexType getDofs() const; __cuda_callable__ IndexType getDofs( const MeshPointer& meshPointer ) const; __cuda_callable__ const VectorType& getData() const; Loading