@@ -286,33 +286,6 @@ ERF::ERF_shared ()
286286 // No valid BoxArray and DistributionMapping have been defined.
287287 // But the arrays for them have been resized.
288288
289- istep.resize (nlevs_max, 0 );
290- nsubsteps.resize (nlevs_max, 1 );
291- // This is the default
292- for (int lev = 1 ; lev <= max_level; ++lev) {
293- nsubsteps[lev] = MaxRefRatio (lev-1 );
294- }
295-
296- if (max_level > 0 ) {
297- ParmParse pp (" erf" );
298- int count = pp.countval (" dt_ref_ratio" );
299- if (count > 0 ) {
300- Vector<int > nsub;
301- nsub.resize (nlevs_max, 0 );
302- if (count == 1 ) {
303- pp.queryarr (" dt_ref_ratio" , nsub, 0 , 1 );
304- for (int lev = 1 ; lev <= max_level; ++lev) {
305- nsubsteps[lev] = nsub[0 ];
306- }
307- } else {
308- pp.queryarr (" dt_ref_ratio" , nsub, 0 , max_level);
309- for (int lev = 1 ; lev <= max_level; ++lev) {
310- nsubsteps[lev] = nsub[lev-1 ];
311- }
312- }
313- }
314- }
315-
316289 t_new.resize (nlevs_max, 0.0 );
317290 t_old.resize (nlevs_max, -1 .e100 );
318291 dt.resize (nlevs_max, std::min (1 .e100 ,dt_max_initial));
@@ -2120,10 +2093,39 @@ ERF::ReadParameters ()
21202093 pp.query (" fixed_dt" , fixed_dt[0 ]);
21212094 pp.query (" fixed_fast_dt" , fixed_fast_dt[0 ]);
21222095
2096+ int nlevs_max = max_level + 1 ;
2097+ istep.resize (nlevs_max, 0 );
2098+ nsubsteps.resize (nlevs_max, 1 );
2099+ // This is the default
2100+ for (int lev = 1 ; lev <= max_level; ++lev) {
2101+ nsubsteps[lev] = MaxRefRatio (lev-1 );
2102+ }
2103+
2104+ if (max_level > 0 ) {
2105+ ParmParse pp (" erf" );
2106+ int count = pp.countval (" dt_ref_ratio" );
2107+ if (count > 0 ) {
2108+ Vector<int > nsub;
2109+ nsub.resize (nlevs_max, 0 );
2110+ if (count == 1 ) {
2111+ pp.queryarr (" dt_ref_ratio" , nsub, 0 , 1 );
2112+ for (int lev = 1 ; lev <= max_level; ++lev) {
2113+ nsubsteps[lev] = nsub[0 ];
2114+ }
2115+ } else {
2116+ pp.queryarr (" dt_ref_ratio" , nsub, 0 , max_level);
2117+ for (int lev = 1 ; lev <= max_level; ++lev) {
2118+ nsubsteps[lev] = nsub[lev-1 ];
2119+ }
2120+ }
2121+ }
2122+ }
2123+
2124+ // Make sure we do this after we have defined nsubsteps above
21232125 for (int lev = 1 ; lev <= max_level; lev++)
21242126 {
2125- fixed_dt[lev] = fixed_dt[lev-1 ] / static_cast <Real>(MaxRefRatio ( lev- 1 ) );
2126- fixed_fast_dt[lev] = fixed_fast_dt[lev-1 ] / static_cast <Real>(MaxRefRatio ( lev- 1 ) );
2127+ fixed_dt[lev] = fixed_dt[lev-1 ] / static_cast <Real>(nsubsteps[ lev] );
2128+ fixed_fast_dt[lev] = fixed_fast_dt[lev-1 ] / static_cast <Real>(nsubsteps[ lev] );
21272129 }
21282130
21292131 pp.query (" fixed_mri_dt_ratio" , fixed_mri_dt_ratio);
0 commit comments