Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug on non-diagonal tensor components of prisms #27

Merged
merged 20 commits into from
Dec 23, 2022

Conversation

santisoler
Copy link
Member

@santisoler santisoler commented Dec 2, 2022

Fix a bug on the non-diagonal tensor components of the prism due to a wrong
evaluation of the logarithmic function. Add two tests that catch the bug on the
g_en component. Correctly evaluate the log function present in the non-diagonal
tensor components when the shifted coordinate x of the vertex is negative and
it's equal to the negative of the distance r between the vertex and the
computation point. In that case the log(x + r) can be replaced by
-log(2|x|). Also, implement a modified version of the log function proposed
by Fukushima (2020) for cases where the shifted coordinate of the node is
negative but different than the negative of the distance: improves the accuracy
when evaluating the log function on very small values. Now the _safe_log
function takes two arguments instead of one: the shifted coordinate x and the
distance r.

The non-diagonal tensor components of the prism have a bug due to
a wrong evaluation of the logarithmic function. Add two tests that catch
the bug on the g_en component.
Implement a modified version of the log function proposed by Fukushima
(2020). It now takes both the shifted coordinate and the distance r
(instead of the whole argument of the log function) since it returns
slightly different things based on the value of those parameters.
@santisoler santisoler changed the title Solve bug on non-diagonal tensor components of prisms Fix bug on non-diagonal tensor components of prisms Dec 2, 2022
After evaluating the limit of g_en on points above the vertices I found
that it can be written as ln(|z1| / |z2|) which translates into
[- ln(|z2|) ] - [- ln(|z1|)]. So for x < 0 and r = -x i the safe_log
returns -ln(|x|).
Apply the new derived formula not from the limit, but directly from
inverting the z axis.
Instead of checking through directions, check with observation points
around the observation point that could have wrong results.
@santisoler santisoler marked this pull request as ready for review December 12, 2022 21:05
@santisoler
Copy link
Member Author

The additional tests corroborate that this PR fixes the bug. I'm merging this 🚀

@santisoler santisoler merged commit e55bca9 into main Dec 23, 2022
@santisoler santisoler deleted the prism-nondiag-tensor-bug branch December 23, 2022 20:18
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