diff --git a/src/solvers/linear/krylov/CMakeLists.txt b/src/solvers/linear/krylov/CMakeLists.txt index a0e43b2e700a3ad91c0c1a3bfb136ab15731da4c..0bbe87701d7e2e21b7476ec0d52d7834d3653f5d 100644 --- a/src/solvers/linear/krylov/CMakeLists.txt +++ b/src/solvers/linear/krylov/CMakeLists.txt @@ -2,11 +2,13 @@ SET( headers tnlCGSolver.h tnlCGSolver_impl.h tnlBICGStabSolver.h tnlBICGStabSolver_impl.h - tnlGMRESSolver.h - tnlGMRESSolver_impl.h ) + tnlGMRESSolver.h + tnlGMRESSolver_impl.h + tnlTFQMRSolver.h + tnlTFQMRSolver_impl.h ) SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/solvers/linear/krylov ) -set( common_SOURCES ${CURRENT_DIR}/tnlGMRESSolver_impl.cpp ) +set( common_SOURCES ${CURRENT_DIR}/tnlGMRESSolver_impl.cpp ) set( tnl_solvers_linear_krylov_SOURCES ${common_SOURCES} PARENT_SCOPE ) @@ -15,6 +17,6 @@ if( BUILD_CUDA) set( tnl_solvers_linear_krylov_CUDA__SOURCES ${common_SOURCES} PARENT_SCOPE ) -endif() - +endif() + INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/solvers/linear/krylov ) diff --git a/src/solvers/tnlBuildConfigTags.h b/src/solvers/tnlBuildConfigTags.h index f19daad01de69c449bf1c10cfe1102e6f8a53f64..1ee3d8a7c21371fff4aeb34b44bcd0ca1d1f3634 100644 --- a/src/solvers/tnlBuildConfigTags.h +++ b/src/solvers/tnlBuildConfigTags.h @@ -92,6 +92,7 @@ class tnlSemiImplicitSORSolverTag{}; class tnlSemiImplicitCGSolverTag{}; class tnlSemiImplicitBICGStabSolverTag{}; class tnlSemiImplicitGMRESSolverTag{}; +class tnlSemiImplicitTFQMRSolverTag{}; template< typename MeshConfig, typename SemiImplicitSolver > struct tnlMeshConfigSemiImplicitSolver{ enum { enabled = true }; }; diff --git a/src/solvers/tnlSolverConfig_impl.h b/src/solvers/tnlSolverConfig_impl.h index 728de597cdac2464886583e69e9c03b86ac1ad04..323cfefbe1f429ce7139640239675af094379763 100644 --- a/src/solvers/tnlSolverConfig_impl.h +++ b/src/solvers/tnlSolverConfig_impl.h @@ -114,6 +114,8 @@ bool tnlSolverConfig< MeshConfig, ProblemConfig >::configSetup( tnlConfigDescrip config.addEntryEnum( "bicgstab" ); if( tnlMeshConfigSemiImplicitSolver< MeshConfig, tnlSemiImplicitGMRESSolverTag >::enabled ) config.addEntryEnum( "gmres" ); + if( tnlMeshConfigSemiImplicitSolver< MeshConfig, tnlSemiImplicitTFQMRSolverTag >::enabled ) + config.addEntryEnum( "tfqmr" ); if( tnlMeshConfigSemiImplicitSolver< MeshConfig, tnlSemiImplicitSORSolverTag >::enabled ) config.addEntryEnum( "sor" ); } @@ -143,6 +145,8 @@ bool tnlSolverConfig< MeshConfig, ProblemConfig >::configSetup( tnlConfigDescrip tnlBICGStabSolver< MatrixType >::configSetup( config ); if( tnlMeshConfigSemiImplicitSolver< MeshConfig, tnlSemiImplicitGMRESSolverTag >::enabled ) tnlGMRESSolver< MatrixType >::configSetup( config ); + if( tnlMeshConfigSemiImplicitSolver< MeshConfig, tnlSemiImplicitTFQMRSolverTag >::enabled ) + tnlTFQMRSolver< MatrixType >::configSetup( config ); if( tnlMeshConfigSemiImplicitSolver< MeshConfig, tnlSemiImplicitSORSolverTag >::enabled ) tnlSORSolver< MatrixType >::configSetup( config ); } diff --git a/src/solvers/tnlSolverStarter_impl.h b/src/solvers/tnlSolverStarter_impl.h index 7a2728e1aa3aba5ad730cf275c41cd9ecb0cf532..e7ac161313e347a22f749ee33cc0771deaf64ab8 100644 --- a/src/solvers/tnlSolverStarter_impl.h +++ b/src/solvers/tnlSolverStarter_impl.h @@ -27,6 +27,7 @@ #include <solvers/linear/krylov/tnlCGSolver.h> #include <solvers/linear/krylov/tnlBICGStabSolver.h> #include <solvers/linear/krylov/tnlGMRESSolver.h> +#include <solvers/linear/krylov/tnlTFQMRSolver.h> #include <solvers/pde/tnlExplicitTimeStepper.h> #include <solvers/pde/tnlSemiImplicitTimeStepper.h> #include <solvers/pde/tnlPDESolver.h> @@ -187,9 +188,10 @@ class tnlSolverStarterTimeDiscretisationSetter< Problem, tnlSemiImplicitTimeDisc if( discreteSolver != "sor" && discreteSolver != "cg" && discreteSolver != "bicgstab" && - discreteSolver != "gmres" ) + discreteSolver != "gmres" && + discreteSolver != "tfqmr" ) { - cerr << "Unknown explicit discrete solver " << discreteSolver << ". It can be only: sor, cg, bicgstab or gmres." << endl; + cerr << "Unknown explicit discrete solver " << discreteSolver << ". It can be only: sor, cg, bicgstab, gmres or tfqmr." << endl; return false; } @@ -201,6 +203,8 @@ class tnlSolverStarterTimeDiscretisationSetter< Problem, tnlSemiImplicitTimeDisc return tnlSolverStarterSemiImplicitSolverSetter< Problem, tnlSemiImplicitBICGStabSolverTag, MeshConfig >::run( problem, parameters ); if( discreteSolver == "gmres" ) return tnlSolverStarterSemiImplicitSolverSetter< Problem, tnlSemiImplicitGMRESSolverTag, MeshConfig >::run( problem, parameters ); + if( discreteSolver == "tfqmr" ) + return tnlSolverStarterSemiImplicitSolverSetter< Problem, tnlSemiImplicitTFQMRSolverTag, MeshConfig >::run( problem, parameters ); return false; } }; @@ -356,6 +360,23 @@ class tnlSolverStarterSemiImplicitSolverSetter< Problem, tnlSemiImplicitGMRESSol } }; +template< typename Problem, + typename MeshConfig > +class tnlSolverStarterSemiImplicitSolverSetter< Problem, tnlSemiImplicitTFQMRSolverTag, MeshConfig, true > +{ + public: + static bool run( Problem& problem, + const tnlParameterContainer& parameters ) + { + typedef typename Problem::MatrixType MatrixType; + typedef tnlTFQMRSolver< MatrixType > LinearSystemSolver; + typedef tnlSemiImplicitTimeStepper< Problem, LinearSystemSolver > TimeStepper; + return tnlSolverStarterSemiImplicitTimeStepperSetter< Problem, + TimeStepper, + MeshConfig >::run( problem, parameters ); + } +}; + /**** * Setting the explicit time stepper */