Commit d18aba48 authored by Tomas Sobotik's avatar Tomas Sobotik
Browse files

Added general versions of godunov and upwind schemes

parent b3a54541
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -31,7 +31,9 @@ class hamiltonJacobiProblemConfig
         config.addEntry       < tnlString > ( "scheme", "This defines scheme used for discretization.", "godunov" );
         config.addEntryEnum( "godunov" );
         config.addEntryEnum( "upwind" );
         config.addEntry        < double > ( "epsilon", "This defines epsilon for smoothening oh sign().", 0.0 );
         config.addEntryEnum( "godunov2" );
         config.addEntryEnum( "upwind2" );
         config.addEntry        < double > ( "epsilon", "This defines epsilon for smoothening of sign().", 0.0 );
         config.addEntry        < double > ( "-value", "Constant value of RHS.", 0.0 );
      }
};
+2 −0
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@
#include <operators/godunov-eikonal/godunovEikonal.h>
#include <operators/upwind/upwind.h>
#include <operators/godunov/godunov.h>
#include <functions/tnlSDFSign.h>
#include <functions/tnlSDFGridValue.h>

template< typename RealType,
		  typename DeviceType,
+22 −3
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@ bool hamiltonJacobiProblemSetter< RealType, DeviceType, IndexType, MeshType, Con
		}
		else
		{
		      typedef tnlConstantFunction< Dimensions, RealType > RightHandSide;
		      typedef tnlStaticVector < Dimensions, RealType > Vertex;
		      typedef tnlNeumannReflectionBoundaryConditions< MeshType,  RealType, IndexType > BoundaryConditions;

@@ -47,15 +46,35 @@ bool hamiltonJacobiProblemSetter< RealType, DeviceType, IndexType, MeshType, Con
			if( schemeName == "upwind" )
			{
		        typedef upwindEikonalScheme< MeshType, RealType, IndexType > Operator;
		        typedef tnlConstantFunction< Dimensions, RealType > RightHandSide;
		        typedef hamiltonJacobiProblemSolver< MeshType, Operator, BoundaryConditions, RightHandSide > Solver;
		        return solverStarter.template run< Solver >( parameters );
			}
			else if ( schemeName == "godunov")
			{
				typedef godunovEikonalScheme< MeshType, RealType, IndexType > Operator;
				typedef tnlConstantFunction< Dimensions, RealType > RightHandSide;
				typedef hamiltonJacobiProblemSolver< MeshType, Operator, BoundaryConditions, RightHandSide > Solver;
				return solverStarter.template run< Solver >( parameters );
			}
			else if( schemeName == "upwind2" )
			{
		        typedef tnlSDFSign< MeshType, Dimensions, RealType, tnlSDFGridValue<MeshType, Dimensions, RealType>, 1 > Sign;
		        typedef tnlSDFSign< MeshType, Dimensions, RealType, tnlSDFGridValue<MeshType, Dimensions, RealType>, 1 > RightHandSide;
		        typedef upwindScheme< MeshType, RealType, IndexType, Sign > Operator;
		        typedef hamiltonJacobiProblemSolver< MeshType, Operator, BoundaryConditions, RightHandSide > Solver;
		        return solverStarter.template run< Solver >( parameters );
			}
			else if ( schemeName == "godunov2")
			{
		        typedef tnlSDFSign< MeshType, Dimensions, RealType, tnlSDFGridValue<MeshType, Dimensions, RealType>, 1 > Sign;
		        typedef tnlSDFSign< MeshType, Dimensions, RealType, tnlSDFGridValue<MeshType, Dimensions, RealType>, 1 > RightHandSide;
				typedef godunovScheme< MeshType, RealType, IndexType, Sign > Operator;
				typedef hamiltonJacobiProblemSolver< MeshType, Operator, BoundaryConditions, RightHandSide > Solver;
				return solverStarter.template run< Solver >( parameters );
			}


			else
			   cerr << "Unknown scheme '" << schemeName << "'." << endl;

+2 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@

#include <core/mfilename.h>
#include <matrices/tnlMatrixSetter.h>
#include <exception>

template< typename Mesh,
		  typename HamiltonJacobi,
@@ -121,6 +122,7 @@ bindDofs( const MeshType& mesh,
   this->solution.bind( dofVector.getData(), dofs );
}


template< typename Mesh,
          typename HamiltonJacobi,
          typename BoundaryCondition,
+3 −1
Original line number Diff line number Diff line
@@ -10,7 +10,9 @@ SET( headers tnlFunctionDiscretizer.h
	     tnlSDFSinWaveFunctionSDF.h
	     tnlSDFParaboloid.h 
	     tnlSDFParaboloidSDF.h
	     tnlSDFSchemeTest.h )
	     tnlSDFSchemeTest.h
	     tnlSDFSign.h
	     tnlSDFGridValue.h )
                    
SET( libtnlfunctionsincludedir ${TNL_INCLUDE_DIR}/functions )
SET( libtnlfunctionsinclude_HEADERS ${headers} )
Loading