[Carpet] getting dt for the finest grid
Yosef Zlochower
yosef at astro.rit.edu
Tue Aug 28 14:08:13 CEST 2007
Hi,
What is the best procedure for obtaining the timestep for the finest grid
currently used in a Carpet driven simulation?
Would something like the code below work for arbitrary numbers
of processors, or would some processors find different values of dt
because they do not own a segment of the finest grid? Can ResetDt be
scheduled in the same timebin as FindDt (I am thinking about the case where
a new refinement level may be added, or perhaps taken away)? Would
the correct value of dt be used in MainCode as scheduled?
Is there a much cleaner way to do this?
schedule.ccl:
schedule ResetDT AT EVOL BEFORE FindDt
{
LANG: C
OPTIONS: GLOBAL
} "set dt to some big value"
schedule FindDt AT EVOL BEFORE MainCode
{
LANG: C
OPTIONS: GLOBAL LOOP-LOCAL
} "find dt"
schedule MainCode AT EVOL AFTER FindDT
{
LANG: C
OPTIONS: GLOBAL
} "use the smallest value of dt"
source.c:
static CCTK_REAL smallest_dt
void ResetDT(CCTK_ARGUMENTS)
{
smallest_dt = BIG_NUMBER;
}
void FindDt(CCTK_ARGUMENTS)
{
DECLARE_CCTK_ARGUMENTS
if (fabs(smallest_dt)> fabs(CCTK_DELTA_TIME))
{
smallest_dt = CCTK_DELTA_TIME;
}
}
void MainCode(CCTK_ARGUMENTS)
{
...
fdot = INTERPOLATE_SOME_VALUE_FROM_GFS;
/* f is a cactus grid array */
f = f_p + smallest_dt * fdot;
}
Thanks
Yosef
More information about the developers
mailing list