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

Merge branch 'master' into diffusion

Conflicts:
	src/implementation/solvers/pde/tnlSemiImplicitTimeStepper_impl.h
parents 73ac70ad 481bbf8e
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -76,12 +76,18 @@ class heatEquationSolver
   void bindAuxiliaryDofs( const MeshType& mesh,
                           DofVectorType& auxiliaryDofs );

   bool preIterate( const RealType& time,
                    const RealType& tau,
                    const MeshType& mesh,
                    DofVectorType& u );

   void getExplicitRHS( const RealType& time,
                        const RealType& tau,
                        const MeshType& mesh,
                        DofVectorType& _u,
                        DofVectorType& _fu );


   void assemblyLinearSystem( const RealType& time,
                              const RealType& tau,
                              const MeshType& mesh,
@@ -89,6 +95,12 @@ class heatEquationSolver
                              MatrixType& matrix,
                              DofVectorType& rightHandSide );

   bool postIterate( const RealType& time,
                     const RealType& tau,
                     const MeshType& mesh,
                     DofVectorType& u );


   tnlSolverMonitor< RealType, IndexType >* getSolverMonitor();
   
   protected:
+30 −0
Original line number Diff line number Diff line
@@ -183,6 +183,21 @@ makeSnapshot( const RealType& time,
   return true;
}

template< typename Mesh,
          typename DifferentialOperator,
          typename BoundaryCondition,
          typename RightHandSide >
bool
heatEquationSolver< Mesh, DifferentialOperator, BoundaryCondition, RightHandSide >::
preIterate( const RealType& time,
            const RealType& tau,
            const MeshType& mesh,
            DofVectorType& u )
{
   return true;
}


template< typename Mesh,
          typename DifferentialOperator,
          typename BoundaryCondition,
@@ -245,6 +260,21 @@ assemblyLinearSystem( const RealType& time,
   //abort();
}

template< typename Mesh,
          typename DifferentialOperator,
          typename BoundaryCondition,
          typename RightHandSide >
bool
heatEquationSolver< Mesh, DifferentialOperator, BoundaryCondition, RightHandSide >::
postIterate( const RealType& time,
             const RealType& tau,
             const MeshType& mesh,
             DofVectorType& u )
{
   return true;
}


template< typename Mesh,
          typename DifferentialOperator,
          typename BoundaryCondition,
+1 −1
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ setBoundaryConditions( const RealType& time,
                       DofVectorType& fu )
{
   fu[ index ] = 0;
   u[ index ] = function.getValue( mesh.getCellCenter( coordinates ), time );;
   u[ index ] = function.getValue( mesh.getCellCenter( coordinates ), time );
}

template< typename MeshReal,
+18 −0
Original line number Diff line number Diff line
@@ -112,7 +112,25 @@ void tnlExplicitTimeStepper< Problem, OdeSolver >::getExplicitRHS( const RealTyp
                                                                   DofVectorType& _u,
                                                                   DofVectorType& _fu )
{
   if( ! this->problem->preIterate( time,
                                    tau,
                                    *( this->mesh),
                                    _u ) )
   {
      cerr << endl << "Preiteration failed." << endl;
      return;
      //return false; // TODO: throw exception
   }
   this->problem->getExplicitRHS( time, tau, *( this->mesh ), _u, _fu );
   if( ! this->problem->postIterate( time,
                                     tau,
                                     *( this->mesh ),
                                     _u ) )
   {
      cerr << endl << "Postiteration failed." << endl;
      return;
      //return false; // TODO: throw exception
   }
}

#endif /* TNLEXPLICITTIMESTEPPER_IMPL_H_ */
+16 −9
Original line number Diff line number Diff line
@@ -139,6 +139,14 @@ solve( const RealType& time,
   {
      RealType currentTau = Min( this->timeStep, stopTime - t );

      if( ! this->problem->preIterate( t,
                                       currentTau,
                                       mesh,
                                       dofVector ) )
      {
         cerr << endl << "Preiteration failed." << endl;
         return false;
      }
      if( verbose )
         cout << "                                                                  Assembling the linear system ... \r" << flush;
      this->problem->assemblyLinearSystem( t,
@@ -147,8 +155,6 @@ solve( const RealType& time,
                                           dofVector,
                                           this->matrix,
                                           this->rightHandSide );
      cout << "u = " << dofVector << endl;
      cout << "b = " << this->rightHandSide << endl;
      if( verbose )
         cout << "                                                                  Solving the linear system for time " << t << "             \r" << flush;
      if( ! this->linearSystemSolver->solve( this->rightHandSide, dofVector ) )
@@ -156,13 +162,14 @@ solve( const RealType& time,
         cerr << "The linear system solver did not converge." << endl;
         return false;
      }
      DofVectorType aux;
      aux.setLike( dofVector );
      this->matrix.vectorProduct( dofVector, aux );
      cout << "tau = " << currentTau << endl;
      cout << "u = " << dofVector << endl;
      cout << "Ax = " << aux << endl;
      cout << "b = " << this->rightHandSide << endl;
      if( ! this->problem->postIterate( t,
                                        currentTau,
                                        mesh,
                                        dofVector ) )
      {
         cerr << endl << "Postiteration failed." << endl;
         return false;
      }
      t += currentTau;
   }
   return true;