Hi Evan,
This looks like a good general approach and a good start at an implementation. Here are a couple suggestions:
1) Instead of trying to extract parameters by re-parsing the RHS expressions, you can use the ‘atoms’ method to get the set of leaves in the operator tree, i.e. all fields and scalars present in the expression, and you could then directly examine the size of all of these to get a measure of the amplitude you want to compare to. Note this will also include numbers directly entered in the equations, which won’t be listed as parameters but whose amplitudes we still may want to check.
2) One thing to be really careful about is deadlocking under parallelization, specifically here making sure that different processes make the same decision about accepting or rejecting an expression, otherwise you may have some processes raising an error while others just continue and wait at the next MPI block. In particular, since the parameter data may be distributed in grid space, you’ll need to do an allreduce on the local maximum that each process computes for it’s local portion of the parameter data, test the local portion of each expression against this global amplitude, and then do another allreduce so that if any process finds data violating the tolerance, everyone else will be on the same page about raising the error. Note that this wasn’t necessary before, since the test "expr != 0” is just a test on the scalar value of the RHS, which unlike grid data, is constant across processes.
GENERAL QUESTION: Does anyone see issues with this tolerance-relative-to-RHS-parameters approach to doing the zero testing? Seems ok to me, but I haven’t been working with the complex RHS’s some of you guys have, where perhaps something funny could happen.
Again, looking good, and let me know if you’d like me to round out a few of these corners with parsing, MPI checks, etc., as I’d be happy to.
-Keaton
> --
> You received this message because you are subscribed to the Google Groups "Dedalus Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
dedalus-dev...@googlegroups.com.
> To post to this group, send email to
dedal...@googlegroups.com.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/dedalus-dev/15ed8689-4bb0-430f-92c9-864bdf5fdd3b%40googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.