Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In RK56: remove unnecessary torque evaluation #341

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions engine/rk56.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package engine

import (
"math"

"github.com/mumax/3/cuda"
"github.com/mumax/3/data"
"github.com/mumax/3/util"
"math"
)

type RK56 struct {
Expand Down Expand Up @@ -34,7 +35,6 @@ func (rk *RK56) Step() {
defer cuda.Recycle(k6)
defer cuda.Recycle(k7)
defer cuda.Recycle(k8)
//k2 will be recyled as k9

h := float32(Dt_si * GammaLL) // internal time step = Dt * gammaLL

Expand Down Expand Up @@ -88,7 +88,7 @@ func (rk *RK56) Step() {
//madd6(m, m0, k1, k3, k4, k5, k6, 1, (31./384.)*h, (1125./2816.)*h, (9./32.)*h, (125./768.)*h, (5./66.)*h)
cuda.Madd7(m, m0, k1, k3, k4, k5, k7, k8, 1, (7./1408.)*h, (1125./2816.)*h, (9./32.)*h, (125./768.)*h, (5./66.)*h, (5./66.)*h)
M.normalize()
torqueFn(k2) // re-use k2
// No need for torqueFn(k9) as k9 wouldn't be used (except in setMaxTorque, which is irrelevant)

// error estimate
Err := cuda.Buffer(3, size)
Expand All @@ -102,7 +102,7 @@ func (rk *RK56) Step() {
if err < MaxErr || Dt_si <= MinDt || FixDt != 0 { // mindt check to avoid infinite loop
// step OK
setLastErr(err)
setMaxTorque(k2)
setMaxTorque(k8)
NSteps++
Time = t0 + Dt_si
adaptDt(math.Pow(MaxErr/err, 1./6.))
Expand Down