Пример #1
0
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")
	}
}
Пример #2
0
// 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
}
Пример #3
0
// 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()
	}
}
Пример #4
0
// 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()
	}
}