mumax / 3

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

Field normalization in fieldOp #256

Closed DeSanz closed 4 years ago

DeSanz commented 4 years ago

Hello,

I am trying to use fieldOP (customfield.go) to get a unit vector in the direction of some of the fields in the system (like B_exch or B_demag) but there seems to be no way of doing it using the available methods in customfield.go (Add, Dot, Div, etc...). Does this functionality exists somewhere already that I have missed?

If not, could you help me with adding some function to allow this? e.g. the sqrt() of a float64 so that I can do something like B_exch_norm = Div(B_exch, Sqrt(Dot(B_exch, B_exch))). I have looked through the code to search where I could add this but I don't see a clear way.

Many thanks in advance

Dedalo

JeroenMulkers commented 4 years ago

This functionality did not exist until now (see commit 31c47142).

Thank you for the suggestion!