Loading examples/heat-equation/heatEquationSolver_impl.h +1 −0 Original line number Diff line number Diff line Loading @@ -96,6 +96,7 @@ getAuxiliaryDofs( const Mesh& mesh ) const /**** * Set-up DOFs and supporting grid functions which will not appear in the discrete solver */ return 0; } template< typename Mesh, Loading examples/heat-equation/tnl-run-heat-equation-eoc-test +1 −1 Original line number Diff line number Diff line Loading @@ -82,7 +82,7 @@ solve() ${solverName} --mesh mesh.tnl \ --initial-condition exact-u-00000.tnl \ --time-discretisation ${timeDiscretisation} \ --tau 0.001 \ --time-step 0.001 \ --discrete-solver ${discreteSolver} \ --merson-adaptivity 1.0e-5 \ --test-function ${testFunction}\ Loading src/implementation/solvers/ode/tnlEulerSolver_impl.h +20 −18 Original line number Diff line number Diff line Loading @@ -22,9 +22,9 @@ template< typename Problem > tnlEulerSolver< Problem > :: tnlEulerSolver() : k1( "tnlEulerSolver:k1" ), cflCondition( 1.0 ) cflCondition( 0.0 ) { this->setName( "EulerSolver" ); //this->setName( "EulerSolver" ); }; template< typename Problem > Loading @@ -40,7 +40,7 @@ void tnlEulerSolver< Problem > :: configSetup( tnlConfigDescription& config, const tnlString& prefix ) { tnlExplicitSolver< Problem >::configSetup( config, prefix ); config.addEntry< double >( prefix + "euler-cfl", "Coefficient C in the Courant–Friedrichs–Lewy condition.", 1.0 ); config.addEntry< double >( prefix + "euler-cfl", "Coefficient C in the Courant–Friedrichs–Lewy condition.", 0.0 ); }; template< typename Problem > Loading Loading @@ -83,11 +83,10 @@ bool tnlEulerSolver< Problem > :: solve( DofVectorType& u ) */ RealType& time = this->time; RealType currentTau = this->tau; RealType& residue = this -> residue; IndexType& iteration = this -> iteration; if( time + currentTau > this -> getStopTime() ) currentTau = this -> getStopTime() - time; if( currentTau == 0.0 ) return true; iteration = 0; this->resetIterations(); this->setResidue( this->getConvergenceResidue() + 1.0 ); this -> refreshSolverMonitor(); Loading @@ -99,9 +98,9 @@ bool tnlEulerSolver< Problem > :: solve( DofVectorType& u ) /**** * Compute the RHS */ this -> problem -> GetExplicitRHS( time, currentTau, u, k1 ); this->problem->getExplicitRHS( time, currentTau, u, k1 ); RealType lastResidue = residue; RealType lastResidue = this->getResidue(); RealType maxResidue( 0.0 ); if( this -> cflCondition != 0.0 ) { Loading @@ -112,15 +111,19 @@ bool tnlEulerSolver< Problem > :: solve( DofVectorType& u ) continue; } } computeNewTimeLevel( u, currentTau, residue ); RealType newResidue( 0.0 ); computeNewTimeLevel( u, currentTau, newResidue ); this->setResidue( newResidue ); /**** * When time is close to stopTime the new residue * may be inaccurate significantly. */ if( currentTau + time == this -> stopTime ) residue = lastResidue; if( currentTau + time == this -> stopTime ) this->setResidue( lastResidue ); time += currentTau; iteration ++; if( ! this->nextIteration() ) return false; /**** * Compute the new time step. Loading @@ -135,12 +138,11 @@ bool tnlEulerSolver< Problem > :: solve( DofVectorType& u ) * Check stop conditions. */ if( time >= this->getStopTime() || ( this -> getMaxResidue() != 0.0 && residue < this -> getMaxResidue() ) ) ( this -> getConvergenceResidue() != 0.0 && this->getResidue() < this -> getConvergenceResidue() ) ) { this -> refreshSolverMonitor(); return true; } if( iteration == this -> getMaxIterationsNumber() ) return false; if( this -> cflCondition != 0.0 ) currentTau /= 0.95; Loading src/implementation/solvers/pde/tnlPDESolver_impl.h +4 −4 Original line number Diff line number Diff line Loading @@ -45,8 +45,8 @@ configSetup( tnlConfigDescription& config, config.addEntry< tnlString >( prefix + "initial-condition", "File name with the initial condition.", "init.tnl" ); config.addRequiredEntry< double >( prefix + "final-time", "Stop time of the time dependent problem." ); config.addRequiredEntry< double >( prefix + "snapshot-period", "Time period for writing the problem status."); config.addEntry< double >( "tau", "The time step for the time discretisation.", 1.0 ); config.addEntry< double >( "tau-order", "The time step is set to tau*pow( space-step, tau-order).", 0.0 ); config.addEntry< double >( "time-step", "The time step for the time discretisation.", 1.0 ); config.addEntry< double >( "time-step-order", "The time step is set to time-step*pow( space-step, time-step-order).", 0.0 ); } template< typename Problem, Loading Loading @@ -225,9 +225,9 @@ bool tnlPDESolver< Problem, TimeStepper >:: setTimeStepOrder( const RealType& timeStepOrder ) { if( timeStepOrder <= 0 ) if( timeStepOrder < 0 ) { cerr << "The time step order for tnlPDESolver must be positive value." << endl; cerr << "The time step order for tnlPDESolver must be zero or positive value." << endl; return false; } this->timeStepOrder = timeStepOrder; Loading src/implementation/solvers/ode/tnlMersonSolver_impl.h +2 −2 File changed.Contains only whitespace changes. Show changes Loading
examples/heat-equation/heatEquationSolver_impl.h +1 −0 Original line number Diff line number Diff line Loading @@ -96,6 +96,7 @@ getAuxiliaryDofs( const Mesh& mesh ) const /**** * Set-up DOFs and supporting grid functions which will not appear in the discrete solver */ return 0; } template< typename Mesh, Loading
examples/heat-equation/tnl-run-heat-equation-eoc-test +1 −1 Original line number Diff line number Diff line Loading @@ -82,7 +82,7 @@ solve() ${solverName} --mesh mesh.tnl \ --initial-condition exact-u-00000.tnl \ --time-discretisation ${timeDiscretisation} \ --tau 0.001 \ --time-step 0.001 \ --discrete-solver ${discreteSolver} \ --merson-adaptivity 1.0e-5 \ --test-function ${testFunction}\ Loading
src/implementation/solvers/ode/tnlEulerSolver_impl.h +20 −18 Original line number Diff line number Diff line Loading @@ -22,9 +22,9 @@ template< typename Problem > tnlEulerSolver< Problem > :: tnlEulerSolver() : k1( "tnlEulerSolver:k1" ), cflCondition( 1.0 ) cflCondition( 0.0 ) { this->setName( "EulerSolver" ); //this->setName( "EulerSolver" ); }; template< typename Problem > Loading @@ -40,7 +40,7 @@ void tnlEulerSolver< Problem > :: configSetup( tnlConfigDescription& config, const tnlString& prefix ) { tnlExplicitSolver< Problem >::configSetup( config, prefix ); config.addEntry< double >( prefix + "euler-cfl", "Coefficient C in the Courant–Friedrichs–Lewy condition.", 1.0 ); config.addEntry< double >( prefix + "euler-cfl", "Coefficient C in the Courant–Friedrichs–Lewy condition.", 0.0 ); }; template< typename Problem > Loading Loading @@ -83,11 +83,10 @@ bool tnlEulerSolver< Problem > :: solve( DofVectorType& u ) */ RealType& time = this->time; RealType currentTau = this->tau; RealType& residue = this -> residue; IndexType& iteration = this -> iteration; if( time + currentTau > this -> getStopTime() ) currentTau = this -> getStopTime() - time; if( currentTau == 0.0 ) return true; iteration = 0; this->resetIterations(); this->setResidue( this->getConvergenceResidue() + 1.0 ); this -> refreshSolverMonitor(); Loading @@ -99,9 +98,9 @@ bool tnlEulerSolver< Problem > :: solve( DofVectorType& u ) /**** * Compute the RHS */ this -> problem -> GetExplicitRHS( time, currentTau, u, k1 ); this->problem->getExplicitRHS( time, currentTau, u, k1 ); RealType lastResidue = residue; RealType lastResidue = this->getResidue(); RealType maxResidue( 0.0 ); if( this -> cflCondition != 0.0 ) { Loading @@ -112,15 +111,19 @@ bool tnlEulerSolver< Problem > :: solve( DofVectorType& u ) continue; } } computeNewTimeLevel( u, currentTau, residue ); RealType newResidue( 0.0 ); computeNewTimeLevel( u, currentTau, newResidue ); this->setResidue( newResidue ); /**** * When time is close to stopTime the new residue * may be inaccurate significantly. */ if( currentTau + time == this -> stopTime ) residue = lastResidue; if( currentTau + time == this -> stopTime ) this->setResidue( lastResidue ); time += currentTau; iteration ++; if( ! this->nextIteration() ) return false; /**** * Compute the new time step. Loading @@ -135,12 +138,11 @@ bool tnlEulerSolver< Problem > :: solve( DofVectorType& u ) * Check stop conditions. */ if( time >= this->getStopTime() || ( this -> getMaxResidue() != 0.0 && residue < this -> getMaxResidue() ) ) ( this -> getConvergenceResidue() != 0.0 && this->getResidue() < this -> getConvergenceResidue() ) ) { this -> refreshSolverMonitor(); return true; } if( iteration == this -> getMaxIterationsNumber() ) return false; if( this -> cflCondition != 0.0 ) currentTau /= 0.95; Loading
src/implementation/solvers/pde/tnlPDESolver_impl.h +4 −4 Original line number Diff line number Diff line Loading @@ -45,8 +45,8 @@ configSetup( tnlConfigDescription& config, config.addEntry< tnlString >( prefix + "initial-condition", "File name with the initial condition.", "init.tnl" ); config.addRequiredEntry< double >( prefix + "final-time", "Stop time of the time dependent problem." ); config.addRequiredEntry< double >( prefix + "snapshot-period", "Time period for writing the problem status."); config.addEntry< double >( "tau", "The time step for the time discretisation.", 1.0 ); config.addEntry< double >( "tau-order", "The time step is set to tau*pow( space-step, tau-order).", 0.0 ); config.addEntry< double >( "time-step", "The time step for the time discretisation.", 1.0 ); config.addEntry< double >( "time-step-order", "The time step is set to time-step*pow( space-step, time-step-order).", 0.0 ); } template< typename Problem, Loading Loading @@ -225,9 +225,9 @@ bool tnlPDESolver< Problem, TimeStepper >:: setTimeStepOrder( const RealType& timeStepOrder ) { if( timeStepOrder <= 0 ) if( timeStepOrder < 0 ) { cerr << "The time step order for tnlPDESolver must be positive value." << endl; cerr << "The time step order for tnlPDESolver must be zero or positive value." << endl; return false; } this->timeStepOrder = timeStepOrder; Loading
src/implementation/solvers/ode/tnlMersonSolver_impl.h +2 −2 File changed.Contains only whitespace changes. Show changes