Skip to content

(draft) Random Quantities functionality#399

Draft
jplauzie wants to merge 1 commit into
mumax:devfrom
jplauzie:Qrand
Draft

(draft) Random Quantities functionality#399
jplauzie wants to merge 1 commit into
mumax:devfrom
jplauzie:Qrand

Conversation

@jplauzie
Copy link
Copy Markdown
Contributor

Part 3 (and last part) of #393.

This is a function that allows a user to build a Quantity of random noise. The idea is a user could add some random noise/variation to a parameter like a K anisotropy value or something. This was meant to go with the other math functions, but ended up a bit more complex due to needing curand, but I tried to follow the templating of the temperature function. This allows the user to make a Quantity of random values using either a normal distribution with user chosen mean and std dev, or a uniform (I added a generator for uniform noise, copying the existing normal generator) distribution from (0,1). There is also a flag that allows the user to keep this distribution static after it's been initially generated, or to change every time step.

I tried to account for pitfalls like in temperature, but this one probably needs a bit of extra scrutiny. They do have the undo on bad time step functionality like temperature does (but currently, no rescaling based on dt. I don't think that's needed since they're not explicitly based on dt like temp is?),to preserve FSAL for the solvers. But the temperature paper has some warnings about stochastic terms, so there might be other pitfalls I wasn't aware of.

If this gets kept, this still needs a test file. I couldn't really think of anything appropriate and meaningful, to verify it during development I ended up editing the solver itself.

Edit: if you happen to use VSCode, i did have to force it to manually regenerate the CGo flags otherwise it complained about the new generator. Seems to a VSCode/Gopls specific thing

Qrand functionality
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant