Skip to content

Commit

Permalink
fix region dependent dind
Browse files Browse the repository at this point in the history
(backported to 3.9.3 by barnex)
  • Loading branch information
Jeroen Mulkers authored and barnex committed Sep 30, 2016
1 parent 6df8d0a commit 79e2750
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
16 changes: 8 additions & 8 deletions cuda/dmi.cu
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ adddmi(float* __restrict__ Hx, float* __restrict__ Hy, float* __restrict__ Hz,
m1.z = m0.z + (-cx * (0.5f*D1/A1) * m0.x);
}
h += (2.0f*A1/(cx*cx)) * (m1 - m0); // exchange
h.x += (D1/cx)*(m0.z - m1.z); // DM (first 1/2 contribution, 2*D * deltaM / (2*c))
h.z -= (D1/cx)*(m0.x - m1.x);
h.x += (D1/cx)*(- m1.z);
h.z -= (D1/cx)*(- m1.x);
}

{
Expand All @@ -67,8 +67,8 @@ adddmi(float* __restrict__ Hx, float* __restrict__ Hy, float* __restrict__ Hz,
m2.z = m0.z + (cx * (0.5f*D2/A2) * m0.x);
}
h += (2.0f*A2/(cx*cx)) * (m2 - m0);
h.x += (D2/cx)*(m2.z - m0.z);
h.z -= (D2/cx)*(m2.x - m0.x);
h.x += (D2/cx)*(m2.z);
h.z -= (D2/cx)*(m2.x);
}

// y derivatives (along height)
Expand All @@ -86,8 +86,8 @@ adddmi(float* __restrict__ Hx, float* __restrict__ Hy, float* __restrict__ Hz,
m1.z = m0.z + (-cy * (0.5f*D1/A1) * m0.y);
}
h += (2.0f*A1/(cy*cy)) * (m1 - m0);
h.y += (D1/cy)*(m0.z - m1.z);
h.z -= (D1/cy)*(m0.y - m1.y);
h.y += (D1/cy)*(- m1.z);
h.z -= (D1/cy)*(- m1.y);
}

{
Expand All @@ -104,8 +104,8 @@ adddmi(float* __restrict__ Hx, float* __restrict__ Hy, float* __restrict__ Hz,
m2.z = m0.z + (cy * (0.5f*D2/A2) * m0.y);
}
h += (2.0f*A2/(cy*cy)) * (m2 - m0);
h.y += (D2/cy)*(m2.z - m0.z);
h.z -= (D2/cy)*(m2.y - m0.y);
h.y += (D2/cy)*(m2.z);
h.z -= (D2/cy)*(m2.y);
}

// only take vertical derivative for 3D sim
Expand Down
3 changes: 0 additions & 3 deletions engine/exchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ func AddExchangeField(dst *data.Slice) {
case !inter && !bulk:
cuda.AddExchange(dst, M.Buffer(), lex2.Gpu(), regions.Gpu(), M.Mesh())
case inter && !bulk:
// DMI kernel has space-dependent parameters, but
// correct averaging between regions not yet clear nor tested, so disallow.
util.AssertMsg(allowUnsafe || (Msat.IsUniform() && Aex.IsUniform() && Dind.IsUniform()), "DMI: Msat, Aex, Dex must be uniform")
cuda.AddDMI(dst, M.Buffer(), lex2.Gpu(), din2.Gpu(), regions.Gpu(), M.Mesh()) // dmi+exchange
case bulk && !inter:
util.AssertMsg(allowUnsafe || (Msat.IsUniform() && Aex.IsUniform() && Dbulk.IsUniform()), "DMI: Msat, Aex, Dex must be uniform")
Expand Down

0 comments on commit 79e2750

Please sign in to comment.