func (u *MMEFUpdater) Update() {

	// Account for msat0T0 multiplier in both relaxation tensor and magnetization vector
	u.Qmm.Multiplier()[0] = u.msat0T0.Multiplier()[0]
	u.Qmm.Multiplier()[0] *= u.msat0T0.Multiplier()[0]

	// Account for mu0
	u.Qmm.Multiplier()[0] *= Mu0
	// Account for multiplier in R that should always be equal to the gyromagnetic ratio. Moreover the R is reduced to [1/s] units
	u.Qmm.Multiplier()[0] *= u.R.Multiplier()[0]

	gpu.Dot(u.Qmm.Array(),
		u.m.Array(),
		u.R.Array())

	// Finally, do Qmm = Qmm * msat0T0(r)^2 to account spatial properties of msat0T0 that are hidden in the definitions of the relaxation constants and magnertization vector
	if !u.msat0T0.Array().IsNil() {
		gpu.Mul(u.Qmm.Array(),
			u.Qmm.Array(),
			u.msat0T0.Array())
		gpu.Mul(u.Qmm.Array(),
			u.Qmm.Array(),
			u.msat0T0.Array())
	}
}
Esempio n. 2
0
// Calculate the magnetic field plan.B
func (plan *MaxwellPlan) UpdateB() {

	msat0T0 := GetEngine().Quant("Msat0T0")
	m := GetEngine().Quant("m")

	plan.M.CopyFromDevice(m.Array())

	if !msat0T0.Array().IsNil() {
		gpu.Mul(&plan.M.Comp[X], &plan.M.Comp[X], msat0T0.Array())
		gpu.Mul(&plan.M.Comp[Y], &plan.M.Comp[Y], msat0T0.Array())
		gpu.Mul(&plan.M.Comp[Z], &plan.M.Comp[Z], msat0T0.Array())
	}

	mMul := msat0T0.Multiplier()[0] * Mu0

	plan.ForwardFFT(plan.M)

	// Point-wise kernel multiplication
	gpu.TensSYMMVecMul(&plan.fftBuf.Comp[X], &plan.fftBuf.Comp[Y], &plan.fftBuf.Comp[Z],
		&plan.fftBuf.Comp[X], &plan.fftBuf.Comp[Y], &plan.fftBuf.Comp[Z],
		plan.fftKern[X][X], plan.fftKern[Y][Y], plan.fftKern[Z][Z],
		plan.fftKern[Y][Z], plan.fftKern[X][Z], plan.fftKern[X][Y],
		mMul,
		plan.fftKernSize[X], plan.fftKernSize[Y], plan.fftKernSize[Z],
		plan.fftBuf.Stream)

	plan.InverseFFT(plan.B.Array())

}
Esempio n. 3
0
func (u *CeDrudeUpdater) Update() {
	Ce := u.Ce
	T := u.T
	γ := u.γ
	n := u.n

	stream := Ce.Array().Stream

	Ce.Multiplier()[0] = (n.Multiplier()[0] / Na) * γ.Multiplier()[0]

	Ce.Array().CopyFromDevice(T.Array())

	if !n.Array().IsNil() {
		gpu.Mul(Ce.Array(), n.Array(), Ce.Array())
	}

	if !γ.Array().IsNil() {
		gpu.Mul(Ce.Array(), γ.Array(), Ce.Array())
	}

	stream.Sync()
}
Esempio n. 4
0
func (u *EnergyUpdater) Update() {

	gpu.DotMask(u.w.Array(), u.m.Array(), u.H.Array(), u.m.Multiplier(), u.H.Multiplier())

	if !u.msat.Array().IsNil() {
		gpu.Mul(u.w.Array(), u.w.Array(), u.msat.Array())
	}

	u.SumReduceUpdater.Update()

	u.energy.Multiplier()[0] *= u.msat.Multiplier()[0]
	u.energy.Multiplier()[0] *= u.weight

	u.energy.SetUpToDate(true)
	u.w.SetUpToDate(true)
}
Esempio n. 5
0
func (u *FFTUpdater) Update() {

	window := u.win
	qin := u.in.Array()
	qout := u.out.Array()
	q := u.q

	COMP := u.in.NComp()

	//~ apply windowing
	for ii := 0; ii < COMP; ii++ {
		gpu.Mul(q.Component(ii), qin.Component(ii), window)
	}
	//~ dot fft
	for ii := 0; ii < COMP; ii++ {
		u.out.Multiplier()[ii] *= u.norm
		u.plan.Forward(q.Component(ii), qout.Component(ii))
	}
}
func (u *DFUpdater) Update() {

	// Account for msat0T0 multiplier, because it is a mask
	u.Qmagn.Multiplier()[0] = u.msat0T0.Multiplier()[0]
	// Account for - 2.0 * 0.5 * mu0
	u.Qmagn.Multiplier()[0] *= -Mu0
	// Account for multiplier in H_eff
	u.Qmagn.Multiplier()[0] *= u.Heff.Multiplier()[0]
	// Account for multiplier in R that should always be equal to the gyromagnetic ratio. Moreover the R is reduced to [1/s] units
	u.Qmagn.Multiplier()[0] *= u.R.Multiplier()[0]

	gpu.Dot(u.Qmagn.Array(),
		u.Heff.Array(),
		u.R.Array())

	// Finally. do Qmag = Qmag * msat0T0(r) to account spatial properties of msat0T0 that are hidden in the definition of the relaxation constants
	if !u.msat0T0.Array().IsNil() {
		gpu.Mul(u.Qmagn.Array(),
			u.Qmagn.Array(),
			u.msat0T0.Array())
	}
}