Dear Bruno,

On Thu, Sep 15, 2016 at 11:15 PM, Bruno Turcksin <bruno.turck...@gmail.com>
wrote:
>
> I would need to see your code to understand why this happens. That
> part of the library is pretty simple, we just check that the error is
> less than coarsen_tol and if it is, delta_t_guess is multiplied by
> coarsen_param.
>

Please refer the attachment for the code snippet and some sample output of
the program.

Implicit methods are more complicated and more expensive than explicit
> methods but if your problem is stiff, you may need to use a time step
> so small that it's worth using an implicit method. Also, generally,
> the Newton solver should converge pretty quickly because you start
> with a good initial guess.
>

I agree completely on this. Will implement the implicit methods as well.

Thanks,
Vaibhav

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Following lines are my implementation of the driver for the embedded explicit 
method. 
It is pretty much same as the implementation in step 52 tutorial program. 

=================================================================================================

template<int dim>
unsigned int
SolverBase<dim>::embedded_explicit_method(const 
TimeStepping::runge_kutta_method method,
                                                        double  dt,
                                                        const double    
final_time,
                                                        typename 
DataOutBase::OutputFormat out_format)
{
        // Instantiate time stepper (Switch based on params.in)
        const double coarsen_param = 1.2;
        const double refine_param = 0.8;
        const double min_delta = 1e-10;
        const double max_delta = 1e-1;
        const double refine_tol = 1e-4;
        const double coarsen_tol = 1e-8;
        double time = this->params->time.t;

        TimeStepping::EmbeddedExplicitRungeKutta<Vector<double> >
        embedded_explicit_runge_kutta(method,
        coarsen_param,
        refine_param,
        min_delta,
        max_delta,
        refine_tol,
        coarsen_tol);

        assemble_global_tangent();
        PreconditionIdentity identity;
        inverse_mass_matrix.initialize(mass_matrix,identity);

        unsigned int nt = 0;
        while(time<final_time)
        {
                if(time+dt > final_time)
                        dt = final_time - time;
                time = embedded_explicit_runge_kutta.evolve_one_time_step(
                
std_cxx11::bind(&SolverBase::evaluate_rhs,this,std_cxx11::_1,std_cxx11::_2),
                time, dt, Ucurrent);
                std::cout<<"Time Step: "<<nt+1<<std::endl<<"Time: 
"<<time<<std::endl;
                std::cout<<"Error at time step: 
"<<embedded_explicit_runge_kutta.get_status().error_norm<<std::endl;
                                dt = 
embedded_explicit_runge_kutta.get_status().delta_t_guess;
                                
                if(nt+1 % this->params->output.outTime == 0)
                        write_output(out_format);

                ++nt;
        }

        return nt;
}

============================================================================================



Here is some sample output for the Heun-Euler method and an initial time step 
of 1e-4:
============================================================================================
Time Step: 1
Time: 0.0001
Error at time step: 0
Time Step: 2
Time: 0.0002
Error at time step: 0
Time Step: 3
Time: 0.0003
Error at time step: 0
Time Step: 4
Time: 0.0004
Error at time step: 0
Time Step: 5
Time: 0.0005
Error at time step: 0
==============================================================================================

Reply via email to