MCPcopy Create free account
hub / github.com/AMReX-Astro/Castro / computeInitialDt

Method computeInitialDt

Source/driver/Castro.cpp:1946–1992  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1944}
1945
1946void
1947Castro::computeInitialDt (int finest_level,
1948 int /*subcycle*/,
1949 Vector<int>& n_cycle,
1950 const Vector<IntVect>& /*ref_ratio*/,
1951 Vector<Real>& dt_level,
1952 Real stop_time)
1953{
1954 BL_PROFILE("Castro::computeInitialDt()");
1955
1956 //
1957 // Grids have been constructed, compute dt for all levels.
1958 //
1959 if (level > 0) {
1960 return;
1961 }
1962
1963 int i;
1964
1965 Real dt_0 = 1.0e+100;
1966 int n_factor = 1;
1967 // TODO/DEBUG: This will need to change for optimal subcycling.
1968 for (i = 0; i <= finest_level; i++)
1969 {
1970 dt_level[i] = getLevel(i).initialTimeStep();
1971 n_factor *= n_cycle[i];
1972 dt_0 = std::min(dt_0,n_factor*dt_level[i]);
1973 }
1974
1975 //
1976 // Limit dt's by the value of stop_time.
1977 //
1978 const Real eps = 0.001*dt_0;
1979 Real cur_time = state[State_Type].curTime();
1980 if (stop_time >= 0.0) {
1981 if ((cur_time + dt_0) > (stop_time - eps)) {
1982 dt_0 = stop_time - cur_time;
1983 }
1984 }
1985
1986 n_factor = 1;
1987 for (i = 0; i <= finest_level; i++)
1988 {
1989 n_factor *= n_cycle[i];
1990 dt_level[i] = dt_0/n_factor;
1991 }
1992}
1993
1994void
1995Castro::post_timestep (int iteration_local)

Callers

nothing calls this directly

Calls 1

initialTimeStepMethod · 0.80

Tested by

no test coverage detected