Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi,
This is a first stab at adding the time varying custom Quantities functionality I mentioned in #384. It's split into 3 PRs for easier review, but they're intended to be used together. Sorry for not lumping it in with the other changes, I expected this to take longer. This should be the last PR for a bit on mumax3, I know I've dumped a lot on you all at once. 😅 As always, feel free to decline/request changes/take your time reviewing etc.
Combined with CustomQuantities #384 , this should allow a user to build Quantities that are both spatially and time dependent. Currently, mumax3 is limited to separable functions f(x,y,z) * g(t). This should allow for functions that can't be separated like e.g. a Gaussian wave packet e^((x-v*t)^2/ (2 * sigma)). This PR adds 2 things:
A wrapper that promotes the Time variable into a Quantity. This Quantity automatically updates as the Time changes. I actually found two different implementations: One uses the existing NewVectorField/NewScalarField functions, and one uses a little struct wrapper similar to CustomQuantities. As far as I can tell, they're essentially equivalent - Do you have a preference?
For convenience, there are 2 new functions ScalarFuncQ and VectorFuncQ. This allows the user to give a function input (e.g. "VectorFuncQ(sin(t), 0, cos(t))"). This is mostly redundant with the other functionality in these PRs, so I'm not sure if it's worth including. The 2 potential benefits:
Included is a test file. To compare, I tested it against mumax's built in B_ext.add(), comparing sin(kx-wt) to the (using trig identities, sin(kx-wt)=sin(kx)cos(wt)-cos(kx)sin(wt) ) separable version. It seems to match well. The test file requires Custom Quantities, this Time Quantity, and the unary math kernels in the 2nd PR to run.