Loading examples/navier-stokes/navier-stokes.cfg.desc +2 −6 Original line number Diff line number Diff line Loading @@ -7,10 +7,7 @@ group IO group Problem { integer dimensions(2) [Number of the problem dimensions. Can be only 2 for now.]; string problem-name(!) [Problem to solve. It can be riser, cavity,...]; integer x-size(!) [Number of grid cells along x-axis.]; integer y-size(!) [Number of grid cells along y-axis.]; real max-inflow-velocity(1.0) []; real max-outflow-velocity(0.8) []; real start-up(0.0) [Start-up time of the riser.]; Loading @@ -24,8 +21,7 @@ group Problem group Geometry { real width(!) [Width of the domain in meters (x-axis).]; real height(!) [Height of the domain in meters (y-axis).]; string mesh( "mesh.tnl" ) [The mesh file.]; real riser-gas-inflow-width[0.2] [Width of the gas inflow on the bottom of the riser.]; },[Parameters describing the geometry of the problem.]; Loading examples/navier-stokes/navierStokesSetter.h +18 −2 Original line number Diff line number Diff line Loading @@ -21,16 +21,32 @@ #include <config/tnlParameterContainer.h> #include "navierStokesSolver.h" template< typename SolverStarter > template< typename MeshType, typename SolverStarter > class navierStokesSetter { public: template< typename RealType, typename DeviceType, typename IndexType > bool run( const tnlParameterContainer& parameters ) const; static bool run( const tnlParameterContainer& parameters ); }; template< typename MeshReal, typename Device, typename MeshIndex, typename SolverStarter > class navierStokesSetter< tnlGrid< 2, MeshReal, Device, MeshIndex >, SolverStarter > { public: typedef tnlGrid< 2, MeshReal, Device, MeshIndex > MeshType; template< typename RealType, typename DeviceType, typename IndexType > static bool run( const tnlParameterContainer& parameters ); }; #include "navierStokesSetter_impl.h" Loading examples/navier-stokes/navierStokesSetter_impl.h +18 −20 Original line number Diff line number Diff line Loading @@ -23,31 +23,29 @@ #include <schemes/euler/fvm/tnlLaxFridrichs.h> #include <schemes/gradient/tnlCentralFDMGradient.h> template< typename SolverStarter > template< typename MeshType, typename SolverStarter > template< typename RealType, typename DeviceType, typename IndexType > bool navierStokesSetter< SolverStarter > :: run( const tnlParameterContainer& parameters ) const bool navierStokesSetter< MeshType, SolverStarter > :: run( const tnlParameterContainer& parameters ) { int dimensions = parameters. GetParameter< int >( "dimensions" ); if( dimensions != 2 ) { cerr << "The problem is not defined for " << dimensions << "dimensions." << endl; cerr << "The solver is not implemented for the mesh " << MeshType::getType() << "." << endl; return false; } template< typename MeshReal, typename Device, typename MeshIndex, typename SolverStarter > template< typename RealType, typename DeviceType, typename IndexType > bool navierStokesSetter< tnlGrid< 2, MeshReal, Device, MeshIndex >, SolverStarter >::run( const tnlParameterContainer& parameters ) { SolverStarter solverStarter; const tnlString& schemeName = parameters. GetParameter< tnlString >( "scheme" ); if( dimensions == 2 ) { //typedef tnlGrid< 2, RealType, DeviceType, IndexType, tnlLinearGridGeometry > MeshType; typedef tnlGrid< 2, RealType, DeviceType, IndexType > MeshType; if( schemeName == "lax-fridrichs" ) return solverStarter. run< navierStokesSolver< MeshType, tnlLaxFridrichs< MeshType, tnlCentralFDMGradient< MeshType > > > > ( parameters ); } } }; #endif /* NAVIERSTOKESSETTER_IMPL_H_ */ examples/navier-stokes/navierStokesSolver_impl.h +9 −5 Original line number Diff line number Diff line Loading @@ -130,7 +130,13 @@ bool navierStokesSolver< Mesh, EulerScheme >::init( const tnlParameterContainer& /**** * Set-up the geometry */ tnlTuple< 2, RealType > proportions; const tnlString& meshFile = parameters.GetParameter< tnlString >( "mesh" ); if( ! this->mesh.load( meshFile ) ) { cerr << "I am not able to load the mesh from the file " << meshFile << "." << endl; return false; } /*tnlTuple< 2, RealType > proportions; proportions. x() = parameters. GetParameter< double >( "width" ); proportions. y() = parameters. GetParameter< double >( "height" ); if( proportions. x() <= 0 ) Loading @@ -146,13 +152,11 @@ bool navierStokesSolver< Mesh, EulerScheme >::init( const tnlParameterContainer& this -> mesh. setOrigin( tnlTuple< 2, RealType >( 0, 0 ) ); this -> mesh. setProportions( proportions ); /**** * Set-up the space discretization */ if( ! this->initMesh( this->mesh, parameters ) ) return false; mesh.refresh(); mesh.save( tnlString( "mesh.tnl" ) ); mesh.save( tnlString( "mesh.tnl" ) );*/ nsSolver.setMesh( this->mesh ); /**** Loading examples/navier-stokes/share/examples/cavity +6 −4 Original line number Diff line number Diff line Loading @@ -18,12 +18,16 @@ do mkdir mu-${mu} cd mu-${mu} tnl-grid-setup --dimensions 2 \ --proportions-x 1 \ --proportions-y 1 \ --size-x 51 \ --size-y 51 navier-stokes --problem-name cavity \ --max-inflow-velocity ${max_inflow_velocity} \ --max-outflow-velocity ${max_outflow_velocity} \ --start-up 1 \ --width 1 \ --height 1 \ --mu ${mu} \ --R 287.4 \ --T 400.0 \ Loading @@ -32,8 +36,6 @@ do --final-time 10.0 \ --snapshot-period 0.04 \ --scheme lax-fridrichs \ --x-size 51 \ --y-size 51 \ --discrete-solver merson \ --initial-tau 2.0e-6 \ --merson-adaptivity 1.0e-4 \ Loading Loading
examples/navier-stokes/navier-stokes.cfg.desc +2 −6 Original line number Diff line number Diff line Loading @@ -7,10 +7,7 @@ group IO group Problem { integer dimensions(2) [Number of the problem dimensions. Can be only 2 for now.]; string problem-name(!) [Problem to solve. It can be riser, cavity,...]; integer x-size(!) [Number of grid cells along x-axis.]; integer y-size(!) [Number of grid cells along y-axis.]; real max-inflow-velocity(1.0) []; real max-outflow-velocity(0.8) []; real start-up(0.0) [Start-up time of the riser.]; Loading @@ -24,8 +21,7 @@ group Problem group Geometry { real width(!) [Width of the domain in meters (x-axis).]; real height(!) [Height of the domain in meters (y-axis).]; string mesh( "mesh.tnl" ) [The mesh file.]; real riser-gas-inflow-width[0.2] [Width of the gas inflow on the bottom of the riser.]; },[Parameters describing the geometry of the problem.]; Loading
examples/navier-stokes/navierStokesSetter.h +18 −2 Original line number Diff line number Diff line Loading @@ -21,16 +21,32 @@ #include <config/tnlParameterContainer.h> #include "navierStokesSolver.h" template< typename SolverStarter > template< typename MeshType, typename SolverStarter > class navierStokesSetter { public: template< typename RealType, typename DeviceType, typename IndexType > bool run( const tnlParameterContainer& parameters ) const; static bool run( const tnlParameterContainer& parameters ); }; template< typename MeshReal, typename Device, typename MeshIndex, typename SolverStarter > class navierStokesSetter< tnlGrid< 2, MeshReal, Device, MeshIndex >, SolverStarter > { public: typedef tnlGrid< 2, MeshReal, Device, MeshIndex > MeshType; template< typename RealType, typename DeviceType, typename IndexType > static bool run( const tnlParameterContainer& parameters ); }; #include "navierStokesSetter_impl.h" Loading
examples/navier-stokes/navierStokesSetter_impl.h +18 −20 Original line number Diff line number Diff line Loading @@ -23,31 +23,29 @@ #include <schemes/euler/fvm/tnlLaxFridrichs.h> #include <schemes/gradient/tnlCentralFDMGradient.h> template< typename SolverStarter > template< typename MeshType, typename SolverStarter > template< typename RealType, typename DeviceType, typename IndexType > bool navierStokesSetter< SolverStarter > :: run( const tnlParameterContainer& parameters ) const bool navierStokesSetter< MeshType, SolverStarter > :: run( const tnlParameterContainer& parameters ) { int dimensions = parameters. GetParameter< int >( "dimensions" ); if( dimensions != 2 ) { cerr << "The problem is not defined for " << dimensions << "dimensions." << endl; cerr << "The solver is not implemented for the mesh " << MeshType::getType() << "." << endl; return false; } template< typename MeshReal, typename Device, typename MeshIndex, typename SolverStarter > template< typename RealType, typename DeviceType, typename IndexType > bool navierStokesSetter< tnlGrid< 2, MeshReal, Device, MeshIndex >, SolverStarter >::run( const tnlParameterContainer& parameters ) { SolverStarter solverStarter; const tnlString& schemeName = parameters. GetParameter< tnlString >( "scheme" ); if( dimensions == 2 ) { //typedef tnlGrid< 2, RealType, DeviceType, IndexType, tnlLinearGridGeometry > MeshType; typedef tnlGrid< 2, RealType, DeviceType, IndexType > MeshType; if( schemeName == "lax-fridrichs" ) return solverStarter. run< navierStokesSolver< MeshType, tnlLaxFridrichs< MeshType, tnlCentralFDMGradient< MeshType > > > > ( parameters ); } } }; #endif /* NAVIERSTOKESSETTER_IMPL_H_ */
examples/navier-stokes/navierStokesSolver_impl.h +9 −5 Original line number Diff line number Diff line Loading @@ -130,7 +130,13 @@ bool navierStokesSolver< Mesh, EulerScheme >::init( const tnlParameterContainer& /**** * Set-up the geometry */ tnlTuple< 2, RealType > proportions; const tnlString& meshFile = parameters.GetParameter< tnlString >( "mesh" ); if( ! this->mesh.load( meshFile ) ) { cerr << "I am not able to load the mesh from the file " << meshFile << "." << endl; return false; } /*tnlTuple< 2, RealType > proportions; proportions. x() = parameters. GetParameter< double >( "width" ); proportions. y() = parameters. GetParameter< double >( "height" ); if( proportions. x() <= 0 ) Loading @@ -146,13 +152,11 @@ bool navierStokesSolver< Mesh, EulerScheme >::init( const tnlParameterContainer& this -> mesh. setOrigin( tnlTuple< 2, RealType >( 0, 0 ) ); this -> mesh. setProportions( proportions ); /**** * Set-up the space discretization */ if( ! this->initMesh( this->mesh, parameters ) ) return false; mesh.refresh(); mesh.save( tnlString( "mesh.tnl" ) ); mesh.save( tnlString( "mesh.tnl" ) );*/ nsSolver.setMesh( this->mesh ); /**** Loading
examples/navier-stokes/share/examples/cavity +6 −4 Original line number Diff line number Diff line Loading @@ -18,12 +18,16 @@ do mkdir mu-${mu} cd mu-${mu} tnl-grid-setup --dimensions 2 \ --proportions-x 1 \ --proportions-y 1 \ --size-x 51 \ --size-y 51 navier-stokes --problem-name cavity \ --max-inflow-velocity ${max_inflow_velocity} \ --max-outflow-velocity ${max_outflow_velocity} \ --start-up 1 \ --width 1 \ --height 1 \ --mu ${mu} \ --R 287.4 \ --T 400.0 \ Loading @@ -32,8 +36,6 @@ do --final-time 10.0 \ --snapshot-period 0.04 \ --scheme lax-fridrichs \ --x-size 51 \ --y-size 51 \ --discrete-solver merson \ --initial-tau 2.0e-6 \ --merson-adaptivity 1.0e-4 \ Loading