func solverCheckErr(err float64) { // Note: err == 0 occurs when input is NaN (or time step massively too small). if err == 0 { util.DashExit() log.Fatalf("solver: cannot adapt dt") } }
// returns a GPU buffer for temporarily adding a quantity to and saving it func addBuf() *buffered { if _addBuf == nil { util.DashExit() log.Println("allocating GPU buffer for output") _addBuf = newBuffered(cuda.NewSynced(3, mesh), "buffer", nil) } return _addBuf }
// Run the simulation for a number of steps. func Steps(n int) { log.Println("run for", n, "steps") checkInited() defer util.DashExit() for i := 0; i < n; i++ { step() } }
// Run the simulation for a number of seconds. func Run(seconds float64) { log.Println("run for", seconds, "s") checkInited() stop := Time + seconds defer util.DashExit() for Time < stop { step() } }