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

Debuging the explicit heat-equation solver.

parent ef8c7f8c
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -43,6 +43,8 @@ class heatEquationSolver
   typedef typename DifferentialOperator::IndexType IndexType;
   typedef Mesh MeshType;
   typedef tnlVector< RealType, DeviceType, IndexType> DofVectorType;
   typedef tnlCSRMatrix< RealType, DeviceType, IndexType > MatrixType;
   typedef typename MatrixType::RowLengthsVector RowLengthsVectorType;

   static tnlString getTypeStatic();

@@ -54,7 +56,8 @@ class heatEquationSolver
   bool setup( const tnlParameterContainer& parameters );

   bool setInitialCondition( const tnlParameterContainer& parameters,
                             const MeshType& mesh );
                             const MeshType& mesh,
                             DofVectorType& dofs );

   bool setupLinearSystem( const MeshType& mesh,
                           MatrixType& matrix );
+15 −8
Original line number Diff line number Diff line
@@ -126,14 +126,16 @@ bindAuxiliaryDofs( const MeshType& mesh,
template< typename Mesh, typename DifferentialOperator, typename BoundaryCondition, typename RightHandSide >
bool heatEquationSolver< Mesh, DifferentialOperator, BoundaryCondition, RightHandSide >
:: setInitialCondition( const tnlParameterContainer& parameters,
                        const MeshType& mesh )
                        const MeshType& mesh,
                        DofVectorType& dofs )
{
   /*const tnlString& initialConditionFile = parameters.GetParameter< tnlString >( "initial-condition" );
   this->bindDofs( mesh, dofs );
   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;
}

@@ -204,6 +206,9 @@ getExplicitRHS( const RealType& time,
                                                        this->rightHandSide,
                                                        _u,
                                                        _fu );
   //_u.save( "u.tnl" );
   //_fu.save( "fu.tnl" );
   //getchar();
}

template< typename Mesh,
@@ -219,15 +224,17 @@ assemblyLinearSystem( const RealType& time,
                      MatrixType& matrix,
                      DofVectorType& b )
{
   tnlLinearSystemAssembler< Mesh, DofVectorType, DifferentialOperator, BoundaryCondition, RightHandSide > systemAssembler;
   systemAssembler.template assembly< Mesh::Dimensions >( time,
   tnlLinearSystemAssembler< Mesh, DofVectorType, DifferentialOperator, BoundaryCondition, RightHandSide, MatrixType > systemAssembler;
   /*systemAssembler.template assembly< Mesh::Dimensions >( time,
                                                          tau,
                                                          mesh,
                                                          differentialOperator,
                                                          boundaryConditions,
                                                          rightHandSide,
                                                          this->differentialOperator,
                                                          this->boundaryCondition,
                                                          this->rightHandSide,
                                                          u,
                                                          matrix,
                                                          b );
    */
}

template< typename Mesh,
+1 −2
Original line number Diff line number Diff line
@@ -32,8 +32,7 @@ class heatEquationConfig
   public:
      static void configSetup( tnlConfigDescription& config )
      {
         config.addDelimiter( "Heat equation settings:" );
         config.addDelimiter( "Tests setting::" );
         //config.addDelimiter( "Heat equation settings:" );
      }
};

+11 −8
Original line number Diff line number Diff line
@@ -5,17 +5,17 @@ dimensions="1D 2D 3D"
sizes1D="16 32 64 128 256 512"
sizes2D="16 32 64 128 256 512"
sizes3D="16 32 64 128"
testFunctions="exp-bump"
testFunctions="sin-wave"
snapshotPeriod=0.1
finalTime=1
timeDependence="linear"
finalTime=1.5
timeDependence="cosine"
solverName="tnl-heat-equation-eoc-test"

setupTestFunction()
{
   testFunction=$1
   if test x${testFunction} = "xexp-bump";
   then
#   if test x${testFunction} = "xexp-bump";
#   then
      origin=-1.0
      proportions=2.0
      amplitude=1.0
@@ -32,7 +32,7 @@ setupTestFunction()
      phaseY=0.0
      phaseZ=0.0
      sigma=0.5
   fi
#   fi
}

setupGrid()
@@ -54,7 +54,7 @@ setupGrid()
setInitialCondition()
{
   testFunction=$1
   tnl-init --function ${testFunction} \
   tnl-init --test-function ${testFunction} \
            --output-file exact-u.tnl \
            --amplitude ${amplitude} \
            --wave-length ${waveLength} \
@@ -82,7 +82,9 @@ solve()
   ${solverName} --mesh mesh.tnl \
                 --initial-condition exact-u-00000.tnl \
                 --time-discretisation ${timeDiscretisation} \
                 --tau 0.001 \
                 --discrete-solver ${discreteSolver} \
                 --merson-adaptivity 1.0e-5 \
                 --test-function ${testFunction}\
                 --amplitude ${amplitude} \
                 --wave-length ${waveLength} \
@@ -110,7 +112,8 @@ computeError()
            --input-files exact-u-*.tnl u-*.tnl \
            --mode halves \
            --snapshot-period ${snapshotPeriod} \
            --output-file errors.txt 
            --output-file errors.txt \
            --write-difference yes
}

runTest()
+2 −1
Original line number Diff line number Diff line
@@ -39,7 +39,8 @@ class tnlHeatEquationEocRhs
      Real getValue( const Vertex& vertex,
                     const Real& time )
      {
         return testFunction.getTimeDerivative( vertex, time ) - exactOperator.getValue( testFunction, vertex, time );
         return testFunction.getTimeDerivative( vertex, time )
                - exactOperator.getValue( testFunction, vertex, time );
      };

   protected:
Loading