Loading examples/inviscid-flow/CompressibleConservativeVariables.h +14 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,20 @@ class CompressibleConservativeVariables this->energy.setMesh( meshPointer ); } template< typename Vector > void bind( const MeshPointer& meshPointer, const Vector& data ) { this->density.bind( meshPointer, 0 ); IndexType offset( this->density.getDofs() ); for( IndexType i = 0; i < Dimensions; i++ ) { this->momentum[ i ].bind( meshPointer, offset ); offset += this->momentum[ i ].getDofs(); } this->energy.bind( meshPointer, offset ); } MeshFunctionPointer& getDensity() { return this->density; Loading examples/inviscid-flow/RiemannProblemInitialCondition.h +2 −1 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ #include <TNL/Containers/StaticVector.h> #include <TNL/Operators/Analytic/Sign.h> #include <TNL/Functions/MeshFunctionEvaluator.h> #include <TNL/Operators/Analytic/Sign.h> #include "CompressibleConservativeVariables.h" namespace TNL { Loading Loading @@ -158,7 +159,7 @@ class RiemannProblemInitialCondition initialCondition.getFunction().setAnisotropy( discontinuityPlacement ); initialCondition.getFunction().setMultiplicator( -1.0 ); Functions::MeshFunctionEvaluator< Functions::MeshFunction, InitialConditionType > evaluator; Functions::MeshFunctionEvaluator< MeshFunctionType, InitialConditionType > evaluator; /**** * Density Loading examples/inviscid-flow/euler.h +5 −2 Original line number Diff line number Diff line Loading @@ -9,6 +9,8 @@ #include "eulerRhs.h" #include "eulerBuildConfigTag.h" #include "RiemannProblemInitialCondition.h" using namespace TNL; typedef eulerBuildConfigTag BuildConfig; Loading @@ -33,7 +35,8 @@ template< typename ConfigTag >class eulerConfig config.addEntryEnum< String >( "dirichlet" ); config.addEntryEnum< String >( "neumann" ); config.addEntry< double >( "boundary-conditions-constant", "This sets a value in case of the constant boundary conditions." ); config.addEntry< double >( "left-density", "This sets a value of left density." ); RiemannProblemInitialCondition< Meshes::Grid< 3 > >::configSetup( config ); /*config.addEntry< double >( "left-density", "This sets a value of left density." ); config.addEntry< double >( "left-velocityX", "This sets a value of left_x velocity." ); config.addEntry< double >( "left-velocityY", "This sets a value of left_y velocity." ); config.addEntry< double >( "left-pressure", "This sets a value of left pressure." ); Loading @@ -42,7 +45,7 @@ template< typename ConfigTag >class eulerConfig config.addEntry< double >( "right-velocityX", "This sets a value of right_x velocity." ); config.addEntry< double >( "right-velocityY", "This sets a value of right_y velocity." ); config.addEntry< double >( "right-pressure", "This sets a value of right pressure." ); config.addEntry< double >( "gamma", "This sets a value of gamma constant.", 1.0 ); config.addEntry< double >( "gamma", "This sets a value of gamma constant.", 1.0 );*/ /**** * Add definition of your solver command line arguments. Loading examples/inviscid-flow/eulerProblem_impl.h +18 −4 Original line number Diff line number Diff line Loading @@ -7,6 +7,9 @@ #include <TNL/Solvers/PDE/BackwardTimeDiscretisation.h> #include <TNL/Functions/Analytic/VectorNorm.h> #include "RiemannProblemInitialCondition.h" #include "CompressibleConservativeVariables.h" #include "LaxFridrichsContinuity.h" #include "LaxFridrichsEnergy.h" #include "LaxFridrichsMomentumX.h" Loading Loading @@ -82,7 +85,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 4*mesh->template getEntitiesCount< typename MeshType::Cell >(); return ( 2 + Dimensions ) * mesh->template getEntitiesCount< typename MeshType::Cell >(); } template< typename Mesh, Loading @@ -107,7 +110,18 @@ setInitialCondition( const Config::ParameterContainer& parameters, DofVectorPointer& dofs, MeshDependentDataPointer& meshDependentData ) { typedef typename MeshType::Cell Cell; CompressibleConservativeVariables< MeshType > conservativeVariables; conservativeVariables.bind( dofs ); const String& initialConditionType = parameters.getParameter< String >( "initial-condition" ); if( initialConditionType == "riemann-problem" ) { RiemannProblemInitialCondition< MeshType > initialCondition; if( ! initialCondition.setup( parameters ) ) return false; initialCondition.setInitialCondtion( conservativeVariables ); } return true; /*typedef typename MeshType::Cell Cell; double gamma = parameters.getParameter< double >( "gamma" ); double rhoL = parameters.getParameter< double >( "left-density" ); double velLX = parameters.getParameter< double >( "left-velocityX" ); Loading Loading @@ -155,8 +169,8 @@ setInitialCondition( const Config::ParameterContainer& parameters, this->velocityY[j*size+i] = velRY; this->pressure[j*size+i] = preR; }; this->gamma = gamma; return true; this->gamma = gamma;*/ //return true; } template< typename Mesh, Loading src/TNL/Functions/MeshFunction.h +2 −1 Original line number Diff line number Diff line Loading @@ -84,7 +84,6 @@ class MeshFunction : const SharedPointer< Vector >& dataPtr, const IndexType& offset = 0 ); void setMesh( const MeshPointer& meshPointer ); template< typename Device = Devices::Host > Loading @@ -93,6 +92,8 @@ class MeshFunction : const MeshPointer& getMeshPointer() const; __cuda_callable__ IndexType getDofs() const; __cuda_callable__ const VectorType& getData() const; __cuda_callable__ VectorType& getData(); Loading Loading
examples/inviscid-flow/CompressibleConservativeVariables.h +14 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,20 @@ class CompressibleConservativeVariables this->energy.setMesh( meshPointer ); } template< typename Vector > void bind( const MeshPointer& meshPointer, const Vector& data ) { this->density.bind( meshPointer, 0 ); IndexType offset( this->density.getDofs() ); for( IndexType i = 0; i < Dimensions; i++ ) { this->momentum[ i ].bind( meshPointer, offset ); offset += this->momentum[ i ].getDofs(); } this->energy.bind( meshPointer, offset ); } MeshFunctionPointer& getDensity() { return this->density; Loading
examples/inviscid-flow/RiemannProblemInitialCondition.h +2 −1 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ #include <TNL/Containers/StaticVector.h> #include <TNL/Operators/Analytic/Sign.h> #include <TNL/Functions/MeshFunctionEvaluator.h> #include <TNL/Operators/Analytic/Sign.h> #include "CompressibleConservativeVariables.h" namespace TNL { Loading Loading @@ -158,7 +159,7 @@ class RiemannProblemInitialCondition initialCondition.getFunction().setAnisotropy( discontinuityPlacement ); initialCondition.getFunction().setMultiplicator( -1.0 ); Functions::MeshFunctionEvaluator< Functions::MeshFunction, InitialConditionType > evaluator; Functions::MeshFunctionEvaluator< MeshFunctionType, InitialConditionType > evaluator; /**** * Density Loading
examples/inviscid-flow/euler.h +5 −2 Original line number Diff line number Diff line Loading @@ -9,6 +9,8 @@ #include "eulerRhs.h" #include "eulerBuildConfigTag.h" #include "RiemannProblemInitialCondition.h" using namespace TNL; typedef eulerBuildConfigTag BuildConfig; Loading @@ -33,7 +35,8 @@ template< typename ConfigTag >class eulerConfig config.addEntryEnum< String >( "dirichlet" ); config.addEntryEnum< String >( "neumann" ); config.addEntry< double >( "boundary-conditions-constant", "This sets a value in case of the constant boundary conditions." ); config.addEntry< double >( "left-density", "This sets a value of left density." ); RiemannProblemInitialCondition< Meshes::Grid< 3 > >::configSetup( config ); /*config.addEntry< double >( "left-density", "This sets a value of left density." ); config.addEntry< double >( "left-velocityX", "This sets a value of left_x velocity." ); config.addEntry< double >( "left-velocityY", "This sets a value of left_y velocity." ); config.addEntry< double >( "left-pressure", "This sets a value of left pressure." ); Loading @@ -42,7 +45,7 @@ template< typename ConfigTag >class eulerConfig config.addEntry< double >( "right-velocityX", "This sets a value of right_x velocity." ); config.addEntry< double >( "right-velocityY", "This sets a value of right_y velocity." ); config.addEntry< double >( "right-pressure", "This sets a value of right pressure." ); config.addEntry< double >( "gamma", "This sets a value of gamma constant.", 1.0 ); config.addEntry< double >( "gamma", "This sets a value of gamma constant.", 1.0 );*/ /**** * Add definition of your solver command line arguments. Loading
examples/inviscid-flow/eulerProblem_impl.h +18 −4 Original line number Diff line number Diff line Loading @@ -7,6 +7,9 @@ #include <TNL/Solvers/PDE/BackwardTimeDiscretisation.h> #include <TNL/Functions/Analytic/VectorNorm.h> #include "RiemannProblemInitialCondition.h" #include "CompressibleConservativeVariables.h" #include "LaxFridrichsContinuity.h" #include "LaxFridrichsEnergy.h" #include "LaxFridrichsMomentumX.h" Loading Loading @@ -82,7 +85,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 4*mesh->template getEntitiesCount< typename MeshType::Cell >(); return ( 2 + Dimensions ) * mesh->template getEntitiesCount< typename MeshType::Cell >(); } template< typename Mesh, Loading @@ -107,7 +110,18 @@ setInitialCondition( const Config::ParameterContainer& parameters, DofVectorPointer& dofs, MeshDependentDataPointer& meshDependentData ) { typedef typename MeshType::Cell Cell; CompressibleConservativeVariables< MeshType > conservativeVariables; conservativeVariables.bind( dofs ); const String& initialConditionType = parameters.getParameter< String >( "initial-condition" ); if( initialConditionType == "riemann-problem" ) { RiemannProblemInitialCondition< MeshType > initialCondition; if( ! initialCondition.setup( parameters ) ) return false; initialCondition.setInitialCondtion( conservativeVariables ); } return true; /*typedef typename MeshType::Cell Cell; double gamma = parameters.getParameter< double >( "gamma" ); double rhoL = parameters.getParameter< double >( "left-density" ); double velLX = parameters.getParameter< double >( "left-velocityX" ); Loading Loading @@ -155,8 +169,8 @@ setInitialCondition( const Config::ParameterContainer& parameters, this->velocityY[j*size+i] = velRY; this->pressure[j*size+i] = preR; }; this->gamma = gamma; return true; this->gamma = gamma;*/ //return true; } template< typename Mesh, Loading
src/TNL/Functions/MeshFunction.h +2 −1 Original line number Diff line number Diff line Loading @@ -84,7 +84,6 @@ class MeshFunction : const SharedPointer< Vector >& dataPtr, const IndexType& offset = 0 ); void setMesh( const MeshPointer& meshPointer ); template< typename Device = Devices::Host > Loading @@ -93,6 +92,8 @@ class MeshFunction : const MeshPointer& getMeshPointer() const; __cuda_callable__ IndexType getDofs() const; __cuda_callable__ const VectorType& getData() const; __cuda_callable__ VectorType& getData(); Loading