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

Fixing the heat equation solver.

parent 11194cd8
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -6,8 +6,6 @@ set( tnl_heat_equation_SOURCES
     tnl-heat-equation-eoc.cpp
     heatEquationSolver_impl.h
     heatEquationSolver.h
     heatEquationScheme_impl.h
     heatEquationScheme.h     
     tnlHeatEquationEocRhs.h )
               
ADD_EXECUTABLE(tnl-heat-equation${debugExt} tnl-heat-equation.cpp)
+0 −59
Original line number Diff line number Diff line
/***************************************************************************
                          heatEquationScheme.h  -  description
                             -------------------
    begin                : Aug 05, 2014
    copyright            : (C) 2014 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.                                   *
 *                                                                         *
 ***************************************************************************/


#ifndef HEATEQUATIONSCHEME_H_
#define HEATEQUATIONSCHEME_H_

template< typename Mesh,
          typename DifferentialOperator,
          typename RightHandSide >
class heatEquationScheme
{
   public:

      typedef Mesh MeshType;
      typedef typename MeshType::CoordinatesType CoordinatesType;
      typedef typename MeshType::VertexType VertexType;
      typedef typename MeshType::DeviceType DeviceType;
      typedef typename DifferentialOperator::RealType RealType;
      typedef typename DifferentialOperator::IndexType IndexType;


      template< typename Vector >
      #ifdef HAVE_CUDA
         __device__ __host__
      #endif
         void explicitUpdate( const RealType& time,
                              const RealType& tau,
                              const MeshType& mesh,
                              const IndexType cellIndex,
                              const CoordinatesType& coordinates,
                              Vector& u,
                              Vector& fu );

   protected:

      DifferentialOperator differentialOperator;

      RightHandSide rightHandSide;

};

#include "heatEquationScheme_impl.h"

#endif /* HEATEQUATIONSCHEME_H_ */
+0 −43
Original line number Diff line number Diff line
/***************************************************************************
                          heatEquationScheme_impl.h  -  description
                             -------------------
    begin                : Aug 05, 2014
    copyright            : (C) 2014 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.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef HEATEQUATIONSCHEME_IMPL_H_
#define HEATEQUATIONSCHEME_IMPL_H_

template< typename Mesh,
          typename DifferentialOperator,
          typename RightHandSide >
   template< typename Vector >
#ifdef HAVE_CUDA
   __device__ __host__
#endif
void
heatEquationScheme< Mesh, DifferentialOperator, RightHandSide >::
explicitUpdate( const RealType& time,
                const RealType& tau,
                const MeshType& mesh,
                const IndexType cellIndex,
                const CoordinatesType& coordinates,
                Vector& u,
                Vector& fu )
{
   this->differentialOperator.explicitUpdate( time, tau, mesh, cellIndex, coordinates, u, fu );
   VertexType vertex = mesh.getCellCenter( coordinates );
   fu[ cellIndex ] += this->rightHandSide.getValue( time, vertex );
}

#endif /* HEATEQUATIONSCHEME_IMPL_H_ */
+0 −2
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@
#include <core/vectors/tnlSharedVector.h>
#include <solvers/pde/tnlExplicitUpdater.h>
#include "heatEquationSolver.h"
#include "heatEquationScheme.h"


template< typename Mesh,
@@ -42,7 +41,6 @@ class heatEquationSolver
   typedef typename DifferentialOperator::IndexType IndexType;
   typedef Mesh MeshType;
   typedef tnlVector< RealType, DeviceType, IndexType> DofVectorType;
   typedef heatEquationScheme< Mesh, DifferentialOperator, RightHandSide > Scheme;

   static tnlString getTypeStatic();

+2 −2
Original line number Diff line number Diff line
@@ -109,12 +109,12 @@ bool heatEquationSolver< Mesh,Diffusion,BoundaryCondition,RightHandSide >
:: setInitialCondition( const tnlParameterContainer& parameters,
                        const MeshType& mesh )
{
   const tnlString& initialConditionFile = parameters.GetParameter< tnlString >( "initial-condition" );
   /*const tnlString& initialConditionFile = parameters.GetParameter< tnlString >( "initial-condition" );
   if( ! this->solution.load( initialConditionFile ) )
   {
      cerr << "I am not able to load the initial condition from the file " << initialConditionFile << "." << endl;
      return false;
   }
   }*/
   return true;
}