jcaiuwyo / cantera

Automatically exported from code.google.com/p/cantera
0 stars 0 forks source link

Newton / time-stepping algorithm does not return the time-step size to its initial value after grid refinement #155

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What is the expected output? What do you see instead?

When solving 1-D problems in time-stepping mode, the Newton / time-stepping 
algorithm has an adjustable time-step size (or stride) which can increase or 
decrease depending on the "ease" of obtaining solutions. Often the time-step 
size has grown to large values when the steady-state solution has been reached. 
This can be followed by grid refinement and a re-start of the solution 
algorithm.

There is, however, a problem with the size of the time-step upon resumption of 
the calculation. Currently, the step size is kept at the value that is used in 
the last time-step, rather than being re-set to the initial value defined in 
the simulation. When time-stepping resumes, the algorithm often spends the 
first few (ten or so) calculations progressively reducing the time-step size 
till a new, smaller value can be found which lies within the transient domain 
of convergence. This can be a costly procedure requiring numerous Jacobian 
calculations.

This behaviour is often fixed in other software (e.g. Twopnt) by re-setting the 
time-step size back to the initial user-defined value after grid refinement. I 
think that a similar fix should be implemented here. However, this adjustment 
to the solution algorithm is a cosmetic one, so I leave it up to the developers 
to make the decision.

What version of the product are you using? On what operating system?

All versions.

Please provide any additional information below.

Adding the line "dt = m_tstep;" in the procedure "Sim1D::solve"  in the if 
statement around line 332 would do the trick. The affected lines would look 
something like this:

        if (refine_grid) {
            new_points = refine(loglevel);
            dt = m_tstep;                                 // <= reset time step to initial value
            if (new_points < 0) {
                writelog("Maximum number of grid points reached.");
                new_points = 0;
            }
        } else {
            if (loglevel > 0) {
                writelog("grid refinement disabled.\n");
            }
            new_points = 0;
        }

Original issue reported on code.google.com by watso...@gmail.com on 10 Apr 2013 at 6:17

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r2222.

Original comment by yarmond on 12 Apr 2013 at 11:06