Commit 6b078884 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Fixing Neumann boundary conditions.

parent 75827a02
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ class tnlExactNonlinearDiffusion< 1, Nonlinearity, InnerOperator >
         const RealType u_xx = innerOperator.template getPartialDerivative< Function, 2, 0, 0 >( function, v, time );
         const RealType g = nonlinearity( function, v, time ); 
         const RealType g_x = nonlinearity.template getPartialDerivative< Function, 1, 0, 0 >( function, v, time );
         return u_xx - u_x * g_x / g;          
         return u_xx + u_x * g_x / g;          
      }
   
      protected:
@@ -131,7 +131,7 @@ class tnlExactNonlinearDiffusion< 2, Nonlinearity, InnerOperator >
         const RealType g_x = nonlinearity.template getPartialDerivative< Function, 1, 0, 0 >( function, v, time );
         const RealType g_y = nonlinearity.template getPartialDerivative< Function, 0, 1, 0 >( function, v, time );

         return  u_xx + u_yy - ( g_x * u_x + g_y * u_y ) / g; 
         return  u_xx + u_yy + ( g_x * u_x + g_y * u_y ) / g; 
      }

      protected:
@@ -193,7 +193,7 @@ class tnlExactNonlinearDiffusion< 3, Nonlinearity, InnerOperator >
         const RealType g_y = nonlinearity.template getPartialDerivative< Function, 0, 1, 0 >( function, v, time );
         const RealType g_z = nonlinearity.template getPartialDerivative< Function, 0, 0, 1 >( function, v, time );

         return  u_xx + u_yy + u_zz - ( g_x * u_x + g_y * u_y + g_z * u_z ) / g; 
         return  u_xx + u_yy + u_zz + ( g_x * u_x + g_y * u_y + g_z * u_z ) / g; 
      }
      
      protected:
+23 −3
Original line number Diff line number Diff line
@@ -49,7 +49,11 @@ template< typename MeshReal,
          typename Index >
class tnlNeumannBoundaryConditions< tnlGrid< 1, MeshReal, Device, MeshIndex >, Function, Real, Index >
   : public tnlNeumannBoundaryConditionsBase< Function >,
     public tnlDomain< 1, MeshBoundaryDomain >
     public tnlOperator< tnlGrid< 1, MeshReal, Device, MeshIndex >,
                         MeshBoundaryDomain,
                         1, 1,
                         Real,
                         Index >
{
   public:

@@ -62,6 +66,8 @@ class tnlNeumannBoundaryConditions< tnlGrid< 1, MeshReal, Device, MeshIndex >, F
   typedef tnlVector< RealType, DeviceType, IndexType> DofVectorType;
   typedef tnlStaticVector< 1, RealType > VertexType;
   typedef typename MeshType::CoordinatesType CoordinatesType;
   typedef tnlNeumannBoundaryConditions< MeshType, Function, Real, Index > ThisType;
   typedef tnlNeumannBoundaryConditionsBase< Function > BaseType;

   template< typename EntityType,
             typename MeshFunction >
@@ -101,7 +107,12 @@ template< typename MeshReal,
          typename Index >
class tnlNeumannBoundaryConditions< tnlGrid< 2, MeshReal, Device, MeshIndex >, Function, Real, Index >
   : public tnlNeumannBoundaryConditionsBase< Function >,
     public tnlDomain< 2, MeshBoundaryDomain >
     public tnlOperator< tnlGrid< 2, MeshReal, Device, MeshIndex >,
                         MeshBoundaryDomain,
                         2, 2,
                         Real,
                         Index >

{
   public:

@@ -114,6 +125,9 @@ class tnlNeumannBoundaryConditions< tnlGrid< 2, MeshReal, Device, MeshIndex >, F
   typedef tnlVector< RealType, DeviceType, IndexType> DofVectorType;
   typedef tnlStaticVector< 2, RealType > VertexType;
   typedef typename MeshType::CoordinatesType CoordinatesType;
   typedef tnlNeumannBoundaryConditions< MeshType, Function, Real, Index > ThisType;
   typedef tnlNeumannBoundaryConditionsBase< Function > BaseType;
   

   template< typename EntityType,
             typename MeshFunction >
@@ -152,7 +166,11 @@ template< typename MeshReal,
          typename Index >
class tnlNeumannBoundaryConditions< tnlGrid< 3, MeshReal, Device, MeshIndex >, Function, Real, Index >
   : public tnlNeumannBoundaryConditionsBase< Function >,
     public tnlDomain< 3, MeshBoundaryDomain >
     public tnlOperator< tnlGrid< 3, MeshReal, Device, MeshIndex >,
                         MeshBoundaryDomain,
                         3, 3,
                         Real,
                         Index >
{
   public:

@@ -165,6 +183,8 @@ class tnlNeumannBoundaryConditions< tnlGrid< 3, MeshReal, Device, MeshIndex >, F
   typedef tnlVector< RealType, DeviceType, IndexType> DofVectorType;
   typedef tnlStaticVector< 3, RealType > VertexType;
   typedef typename MeshType::CoordinatesType CoordinatesType;
   typedef tnlNeumannBoundaryConditions< MeshType, Function, Real, Index > ThisType;
   typedef tnlNeumannBoundaryConditionsBase< Function > BaseType;   

   template< typename EntityType,
             typename MeshFunction >
+2 −2
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ class tnlOneSidedMeanCurvatureTest
      typedef typename ApproximateOperator::RealType RealType;
      typedef typename ApproximateOperator::IndexType IndexType;   
      
      const IndexType coarseMeshSize[ 3 ] = { 1024, 256, 64 };
      const IndexType coarseMeshSize[ 3 ] = { 128, 256, 64 };
      
      const RealType  eoc[ 3 ] =       { 2.0,  2.0,  2.0 };
      const RealType  tolerance[ 3 ] = { 0.05, 0.05, 0.05 };
@@ -128,7 +128,7 @@ bool setMesh()
int main( int argc, char* argv[] )
{
   const bool verbose( true );
   const bool write( false );
   const bool write( true );
   
   if( ! setMesh< tnlHost, write, verbose  >() )
      return EXIT_FAILURE;