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

Implementing the semi-implicit solver for the heat equation.

parent 15f0a73c
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -125,8 +125,8 @@ bindAuxiliaryDofs( const MeshType& mesh,


template< typename Mesh, typename DifferentialOperator, typename BoundaryCondition, typename RightHandSide >
bool heatEquationSolver< Mesh, DifferentialOperator, BoundaryCondition, RightHandSide >
:: setInitialCondition( const tnlParameterContainer& parameters,
bool heatEquationSolver< Mesh, DifferentialOperator, BoundaryCondition, RightHandSide >::
setInitialCondition( const tnlParameterContainer& parameters,
                        const MeshType& mesh,
                        DofVectorType& dofs )
{
@@ -149,13 +149,19 @@ heatEquationSolver< Mesh, DifferentialOperator, BoundaryCondition, RightHandSide
setupLinearSystem( const MeshType& mesh,
                   MatrixType& matrix )
{
   const IndexType dofs = this->getDofs( mesh );
   RowLengthsVectorType rowLengths;
   if( ! rowLengths.setSize( dofs ) )
      return false;
   tnlMatrixSetter< MeshType, DifferentialOperator, BoundaryCondition, RowLengthsVectorType > matrixSetter;
   matrixSetter.template getRowLengths< Mesh::Dimensions >( mesh,
                                                            differentialOperator,
                                                            boundaryCondition,
                                                            rowLengths );
   matrix.setRowLengths( rowLengths );
   matrix.setDimensions( dofs, dofs );
   if( ! matrix.setRowLengths( rowLengths ) )
      return false;
   return true;
}

template< typename Mesh,
@@ -226,7 +232,7 @@ assemblyLinearSystem( const RealType& time,
                      DofVectorType& b )
{
   tnlLinearSystemAssembler< Mesh, DofVectorType, DifferentialOperator, BoundaryCondition, RightHandSide, MatrixType > systemAssembler;
   /*systemAssembler.template assembly< Mesh::Dimensions >( time,
   systemAssembler.template assembly< Mesh::Dimensions >( time,
                                                          tau,
                                                          mesh,
                                                          this->differentialOperator,
@@ -235,7 +241,8 @@ assemblyLinearSystem( const RealType& time,
                                                          u,
                                                          matrix,
                                                          b );
    */
   //matrix.print( cout );
   //abort();
}

template< typename Mesh,
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ class tnlHeatEquationEocRhs
      template< typename Vertex,
                typename Real >
      Real getValue( const Vertex& vertex,
                     const Real& time )
                     const Real& time ) const
      {
         return testFunction.getTimeDerivative( vertex, time )
                - exactOperator.getValue( testFunction, vertex, time );
+2 −1
Original line number Diff line number Diff line
@@ -89,7 +89,8 @@ class tnlParameterContainer
      for( i = 0; i < size; i ++ )
         if( parameters[ i ] -> name == name )
            return ( ( tnlParameter< T >* ) parameters[ i ] ) -> value;
      cerr << "Unknown parameter " << name << endl;
      cerr << "The program attempts to get unknown parameter " << name << endl;
      cerr << "Aborting the program." << endl;
      abort();
   }
   
+3 −0
Original line number Diff line number Diff line
@@ -77,11 +77,14 @@ bool tnlCSRMatrix< Real, Device, Index >::setRowLengths( const RowLengthsVector&
    * necessary length of the vectors this->values
    * and this->columnIndexes.
    */
   tnlAssert( this->getRows() > 0, );
   tnlAssert( this->getColumns() > 0, );
   tnlSharedVector< IndexType, DeviceType, IndexType > rowPtrs;
   rowPtrs.bind( this->rowPointers.getData(), this->getRows() );
   rowPtrs = rowLengths;
   this->rowPointers.setElement( this->rows, 0 );
   this->rowPointers.computeExclusivePrefixSum();
   this->maxRowLength = rowLengths.max();

   /****
    * Allocate values and column indexes
+3 −0
Original line number Diff line number Diff line
@@ -219,6 +219,8 @@ template< typename Real,
          typename Index >
bool tnlChunkedEllpackMatrix< Real, Device, Index >::setRowLengths( const RowLengthsVector& rowLengths )
{
   tnlAssert( this->getRows() > 0, );
   tnlAssert( this->getColumns() > 0, );

   IndexType elementsToAllocation( 0 );

@@ -252,6 +254,7 @@ bool tnlChunkedEllpackMatrix< Real, Device, Index >::setRowLengths( const RowLen
      this->numberOfSlices = hostMatrix.numberOfSlices;
      elementsToAllocation = hostMatrix.values.getSize();
   }
   this->maxRowLength = rowLengths.max();
   return tnlSparseMatrix< Real, Device, Index >::allocateMatrixElements( elementsToAllocation );
}

Loading