mumax / 3

GPU-accelerated micromagnetic simulator
Other
447 stars 150 forks source link

Feature/regionwise gammaLL #315

Open jsampaio opened 1 year ago

jsampaio commented 1 year ago

This commit implements a regionwise gyromagnetic factor (gammaLL). For backwards-compatibility reasons, this is done with an additional user-accessible parameter, GFactor (default value 1.0). The material's gyromagnetic factor is then the product of the global parameter gammaLL and the region-wise parameter GFactor.

Additionally, a bug was corrected in the calculation of the Zhang-Li torque. Previously, cuda/zhangli.cu used a hard-wired value of gamma (defined in cuda/constants.h), which leads to a wrong calculation in simulations where the user changes the value of GammaLL.

Further improvements

It would perhaps be more elegant to leave only a single parameter user accessible (the region-wise one). But GammaLL is used internally by Mumax3 to normalise the timestep, and so a global parameter with a value of the order of 1.76e11 is required, even if it could be hidden from the user. The solution could be to set gammaLL to mu_B/hbar=0.879e11 and use GFactor as the Landé g-factor (default value 2.0), but this would not be backwards compatible.

Modifications

  1. Removal of ‘submarine’ definition of the gyromagnetic ratio GAMMA0 (defined in constants.h and used in zhangli.cu). Changed zhangli to use the user-defined gammaLL. Affected files:
  1. Added gFactor as a region-wise user parameter. The physical gamma is GammaLL*gFactor. Torques are scaled up by gFactor. Affected files:
  1. Changed the temperature to account for the region-wise scale factor of gamma. Affected files:
jsampaio commented 10 months ago

That problem, I think, occurs because you haven’t recompiled the cuda files. Run “make realclean” and then “make” to force the recompilation of the cuda kernels. I hope that solves it! J.

On 31 Aug 2023, at 06:14, dzly1019 @.***> wrote:

Please help me. After modifying the source code according to your method, it prompts two errors. 1../../cuda/lltorque.go:28:2: undefined: k_scalegamma_async 2../../cuda/temperature.go:16:25: too many arguments in call to k_settemperature2_async ../../cuda/zhangli.go:14:27: too many arguments in call to k_addzhanglitorque2_async

— Reply to this email directly, view it on GitHub https://github.com/mumax/3/pull/315#issuecomment-1700341806, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACI3WSGT3Y7MJOR2GYD7M4LXYAFSLANCNFSM6AAAAAARWKXNXY. You are receiving this because you authored the thread.

dzly1019 commented 10 months ago

That problem, I think, occurs because you haven’t recompiled the cuda files. Run “make realclean” and then “make” to force the recompilation of the cuda kernels. I hope that solves it! J. On 31 Aug 2023, at 06:14, dzly1019 @.***> wrote: Please help me. After modifying the source code according to your method, it prompts two errors. 1../../cuda/lltorque.go:28:2: undefined: k_scalegamma_async 2../../cuda/temperature.go:16:25: too many arguments in call to k_settemperature2_async ../../cuda/zhangli.go:14:27: too many arguments in call to k_addzhanglitorque2_async — Reply to this email directly, view it on GitHub <#315 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACI3WSGT3Y7MJOR2GYD7M4LXYAFSLANCNFSM6AAAAAARWKXNXY. You are receiving this because you authored the thread.

That problem, I think, occurs because you haven’t recompiled the cuda files. Run “make realclean” and then “make” to force the recompilation of the cuda kernels. I hope that solves it! J. On 31 Aug 2023, at 06:14, dzly1019 @.***> wrote: Please help me. After modifying the source code according to your method, it prompts two errors. 1../../cuda/lltorque.go:28:2: undefined: k_scalegamma_async 2../../cuda/temperature.go:16:25: too many arguments in call to k_settemperature2_async ../../cuda/zhangli.go:14:27: too many arguments in call to k_addzhanglitorque2_async — Reply to this email directly, view it on GitHub <#315 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACI3WSGT3Y7MJOR2GYD7M4LXYAFSLANCNFSM6AAAAAARWKXNXY. You are receiving this because you authored the thread.

I have solved the problem, thank you very much!