Skip to content
Snippets Groups Projects
Commit 8a5890dd authored by Tomáš Oberhuber's avatar Tomáš Oberhuber Committed by Vladimír Klement
Browse files

Creating incompressible Navier-Stokes solver in examples.

parent 836b227c
No related branches found
No related tags found
No related merge requests found
set( tnl_incompressible_navier_stokes_SOURCES
tnl-incompressible-navier-stokes.cpp
)
IF( BUILD_CUDA )
CUDA_ADD_EXECUTABLE(tnl-incompressible-navier-stokes${debugExt} tnl-incompressible-navier-stokes.cu)
ELSE( BUILD_CUDA )
ADD_EXECUTABLE(tnl-incompressible-navier-stokes${debugExt} tnl-incompressible-navier-stokes.cpp)
ENDIF( BUILD_CUDA )
target_link_libraries (tnl-incompressible-navier-stokes${debugExt} tnl${debugExt}-${tnlVersion} )
INSTALL( TARGETS tnl-incompressible-navier-stokes${debugExt}
RUNTIME DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE )
INSTALL( FILES tnl-run-incompressible-navier-stokes
DESTINATION share/tnl-${tnlVersion}/examples/incompressible-navier-stokes )
/***************************************************************************
tnl-incompressible-navier-stokes.cpp - description
-------------------
begin : Jan 28, 2015
copyright : (C) 2015 by Tomas Oberhuber
email : tomas.oberhuber@fjfi.cvut.cz
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "tnl-incompressible-navier-stokes.h"
/***************************************************************************
tnl-incompressible-navier-stokes.cu - description
-------------------
begin : Jan 28, 2015
copyright : (C) 2015 by Tomas Oberhuber
email : tomas.oberhuber@fjfi.cvut.cz
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "tnl-incompressible-navier-stokes.h"
\ No newline at end of file
/***************************************************************************
tnl-incompressible-navier-stokes.h - description
-------------------
begin : Jan 28, 2015
copyright : (C) 2015 by oberhuber
email : tomas.oberhuber@fjfi.cvut.cz
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef TNL_INCOMPRESSIBLE_NAVIER_STOKES_H_
#define TNL_INCOMPRESSIBLE_NAVIER_STOKES_H_
#include <solvers/tnlSolver.h>
#include <solvers/tnlFastBuildConfig.h>
#include <solvers/tnlConfigTags.h>
#include <operators/diffusion/tnlLinearDiffusion.h>
#include <operators/tnlAnalyticDirichletBoundaryConditions.h>
#include <operators/tnlDirichletBoundaryConditions.h>
#include <operators/tnlAnalyticNeumannBoundaryConditions.h>
#include <operators/tnlNeumannBoundaryConditions.h>
#include <functions/tnlConstantFunction.h>
#include <problems/tnlHeatEquationProblem.h>
//typedef tnlDefaultConfigTag BuildConfig;
typedef tnlFastBuildConfig BuildConfig;
template< typename ConfigTag >
class tnlIncompressibleNavierStokesConfig
{
public:
static void configSetup( tnlConfigDescription& config )
{
config.addDelimiter( "Incompressible Navier-Stokes solver settings:" );
/*config.addEntry< tnlString >( "boundary-conditions-type", "Choose the boundary conditions type.", "dirichlet");
config.addEntryEnum< tnlString >( "dirichlet" );
config.addEntryEnum< tnlString >( "neumann" );
config.addEntry< tnlString >( "boundary-conditions-file", "File with the values of the boundary conditions.", "boundary.tnl" );
config.addEntry< double >( "boundary-conditions-constant", "This sets a value in case of the constant boundary conditions." );
config.addEntry< double >( "right-hand-side-constant", "This sets a constant value for the right-hand side.", 0.0 );
config.addEntry< tnlString >( "initial-condition", "File with the initial condition.", "initial.tnl");*/
};
};
template< typename Real,
typename Device,
typename Index,
typename MeshType,
typename ConfigTag,
typename SolverStarter >
class tnlIncompressibleNavierStokesSetter
{
public:
typedef Real RealType;
typedef Device DeviceType;
typedef Index IndexType;
typedef tnlStaticVector< MeshType::Dimensions, Real > Vertex;
static bool run( const tnlParameterContainer& parameters )
{
enum { Dimensions = MeshType::Dimensions };
typedef tnlLinearDiffusion< MeshType, Real, Index > ApproximateOperator;
typedef tnlConstantFunction< Dimensions, Real > RightHandSide;
typedef tnlStaticVector < MeshType::Dimensions, Real > Vertex;
/*tnlString boundaryConditionsType = parameters.getParameter< tnlString >( "boundary-conditions-type" );
if( parameters.checkParameter( "boundary-conditions-constant" ) )
{
typedef tnlConstantFunction< Dimensions, Real > ConstantFunction;
if( boundaryConditionsType == "dirichlet" )
{
typedef tnlAnalyticDirichletBoundaryConditions< MeshType, ConstantFunction, Real, Index > BoundaryConditions;
typedef tnlHeatEquationProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Solver;
SolverStarter solverStarter;
return solverStarter.template run< Solver >( parameters );
}
typedef tnlAnalyticNeumannBoundaryConditions< MeshType, ConstantFunction, Real, Index > BoundaryConditions;
typedef tnlHeatEquationProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Solver;
SolverStarter solverStarter;
return solverStarter.template run< Solver >( parameters );
}
typedef tnlVector< Real, Device, Index > VectorType;
if( boundaryConditionsType == "dirichlet" )
{
typedef tnlDirichletBoundaryConditions< MeshType, VectorType, Real, Index > BoundaryConditions;
typedef tnlHeatEquationProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Solver;
SolverStarter solverStarter;
return solverStarter.template run< Solver >( parameters );
}
typedef tnlNeumannBoundaryConditions< MeshType, VectorType, Real, Index > BoundaryConditions;
typedef tnlHeatEquationProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Solver;
SolverStarter solverStarter;
return solverStarter.template run< Solver >( parameters );*/
};
};
int main( int argc, char* argv[] )
{
tnlSolver< tnlIncompressibleNavierStokesSetter, tnlIncompressibleNavierStokesConfig, BuildConfig > solver;
if( ! solver. run( argc, argv ) )
return EXIT_FAILURE;
return EXIT_SUCCESS;
}
#endif /* TNL_INCOMPRESSIBLE_NAVIER_STOKES_H_ */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment