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

Fixing the heat equation EOC test.

parent dd951870
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -80,10 +80,7 @@ class heatEquationSolver
   
   protected:

   /*tnlSharedVector< RealType, DeviceType, IndexType > numericalSolution,
                                                      exactSolution,
                                                      analyticLaplace,
                                                      numericalLaplace;*/
   tnlSharedVector< RealType, DeviceType, IndexType > solution;

   tnlExplicitUpdater< Mesh, DofVectorType, DifferentialOperator, BoundaryCondition, RightHandSide  > explicitUpdater;

+4 −4
Original line number Diff line number Diff line
@@ -90,7 +90,7 @@ bindDofs( const MeshType& mesh,
          DofVectorType& dofVector )
{
   const IndexType dofs = mesh.getNumberOfCells();
   this->numericalSolution.bind( dofVector.getData(), dofs );
   this->solution.bind( dofVector.getData(), dofs );
}

template< typename Mesh,
@@ -111,7 +111,7 @@ bool heatEquationSolver< Mesh,Diffusion,BoundaryCondition,RightHandSide >
                        const MeshType& mesh )
{
   const tnlString& initialConditionFile = parameters.GetParameter< tnlString >( "initial-condition" );
   if( ! this->numericalSolution.load( initialConditionFile ) )
   if( ! this->solution.load( initialConditionFile ) )
   {
      cerr << "I am not able to load the initial condition from the file " << initialConditionFile << "." << endl;
      return false;
@@ -135,7 +135,7 @@ makeSnapshot( const RealType& time,

   tnlString fileName;
   FileNameBaseNumberEnding( "u-", step, 5, ".tnl", fileName );
   if( ! this->numericalSolution.save( fileName ) )
   if( ! this->solution.save( fileName ) )
      return false;
   return true;
}
@@ -161,8 +161,8 @@ void heatEquationSolver< Mesh,Diffusion,BoundaryCondition,RightHandSide >
   explicitUpdater.template update< Mesh::Dimensions >( time,
                                                        tau,
                                                        mesh,
                                                        this->differentialOperator,
                                                        this->boundaryCondition,
                                                        this->operator,
                                                        this->rightHandSide,
                                                        _u,
                                                        _fu );
+4 −4
Original line number Diff line number Diff line
@@ -34,10 +34,10 @@ class tnlHeatEquationEocRhs
         return true;
      };

      template< typename Real,
                typename Vertex >
      Real getValue( const Real& time,
                     const Vertex& vertex )
      template< typename Vertex,
                typename Real >
      Real getValue( const Vertex& vertex,
                     const Real& time )
      {
         return testFunction.getTimeDerivative( vertex, time ) - exactOperator.getValue( testFunction, vertex, time );
      };
+9 −38
Original line number Diff line number Diff line
@@ -27,39 +27,6 @@ class tnlExplicitUpdaterTraversalUserData
{
   public:

      template< typename DifferentialOperator,
                typename RightHandSide >
      class tnlInteriorUpdater
      {
         public:

         tnlInteriorUpdater( DifferentialOperator& differentialOperator,
                             RightHandSide& rightHandSide )
         : differentialOperator( differentialOperator ),
           rightHandSide( rightHandSide )
         {
         }

         template< typename Mesh,
                   typename Index,
                   typename Coordinates,
                   typename DofVector >
         void explicitUpdate( const Real& time,
                              const Real& tau,
                              const Mesh& mesh,
                              const Index index,
                              const Coordinates& coordinates,
                              DofVector& u,
                              DofVector& fu )
         {
            ;
         }

         DifferentialOperator& differentialOperator;

         RightHandSide& rightHandSide;
      };

      const Real &time, &tau;

      DifferentialOperator& differentialOperator;
@@ -143,7 +110,7 @@ class tnlExplicitUpdater
      {
         public:

            template< int EntityDimension >
            template< int EntityDimensions >
            void processEntity( const MeshType& mesh,
                                TraversalUserData& userData,
                                const IndexType index )
@@ -154,8 +121,8 @@ class tnlExplicitUpdater
                                                     index,
                                                     userData.u,
                                                     userData.fu );
               userData.fu += rightHandSide.getValue( mesh.getEntityCenter< EntityDimensions >( index ),
                                                      time );
               userData.fu[ index ] += userData.rightHandSide.getValue( mesh.getEntityCenter< EntityDimensions >( index ),
                                                                        userData.time );
            }

      };
@@ -203,6 +170,10 @@ class tnlExplicitUpdater< tnlGrid< Dimensions, Real, Device, Index >,
      {
         public:

            /****
             * TODO: This must be specialized for entities with different dimensions
             * otherwise 'coordinates' would not make sense without knowing the orientation.
             */
            template< int EntityDimension >
            void processEntity( const MeshType& mesh,
                                TraversalUserData& userData,
@@ -238,8 +209,8 @@ class tnlExplicitUpdater< tnlGrid< Dimensions, Real, Device, Index >,
                                                             userData.u,
                                                             userData.fu );

               userData.fu += rightHandSide.getValue( mesh.getEntityCenter< EntityDimensions >( coordinates ),
                                                      time );
               userData.fu[ index ] += userData.rightHandSide.getValue( mesh.getCellCenter( coordinates ),
                                                                        userData.time );
            }

      };