geodynamics / vq

Virtual Quake is a boundary element code designed to investigate long term fault system behavior and interactions between faults through stress transfer.
Other
12 stars 24 forks source link

Question about sum_greens.py test #114

Closed tjesser-ucdavis-edu closed 8 years ago

tjesser-ucdavis-edu commented 8 years ago

I was looking through the Virtual Quake tests and noticed something that looked a little odd. Unfortunately, I don't know the code that well, so I can't be sure this is an actual error.

In sum_greens.py, line 39's normal_err might be being tested against the wrong number.

normal_ok = (normal_err<1e5 or normal_diff<1e-6)

The code says that normal_err is a geometric error which I wouldn't expect to be 1e5 (100000). And there are comments below it, (line 42), that suggest that it should be testing against 1e-5 instead.

If the test is correct, then I don't understand the normal_diff test, as that will always be false when the normal_err test is false only be false when the normal_err test is true. (Edit: Whoops, got mixed up.)

These comments also apply to the shear_err test.

markyoder commented 8 years ago

tyler - good question. i'm pretty sure that the code checks out (but i've been wrong before). the changes there come from an original unit test that often failed. basically, the error between the measured and expected greens functions should be small, and originally "small" was defined with respect to the greens values (aka, err ~ dx/x). BUT, that was problematic for values that were already small, so we basically said the number needs to be small (>x0) or relatively small (dx/x < x0), and it's a bit sloppy and imprecise, but it's also not a super critical check. to my knowledge, that test works pretty well within its expected context, but i've been wrong before.

tjesser-ucdavis-edu commented 8 years ago

Then is the normal_diff test just leftover code? It will never cause the test to fail.

markyoder commented 8 years ago

Basically left over. I'm not looking at the code, but the basic idea is two tests: one for very small numbers, one for larger numbers. Don't recall if one always trumps the other, but usually the test is not terribly important.

On Thursday, November 12, 2015, Tyler Esser notifications@github.com wrote:

Then is the normal_diff test just leftover code? It will never cause the test to fail.

— Reply to this email directly or view it on GitHub https://github.com/geodynamics/vq/issues/114#issuecomment-156275569.

Mark Yoder, PhD 805 451 8750 https://www.linkedin.com/pub/mark-yoder/11/855/300

"If you bore me, you lose your soul..." ~belly