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

Update susceptibility.cpp #238

Closed
wants to merge 1 commit into from
Closed

Conversation

fesc3555
Copy link

Added checks in update_P: check, whether there is a diagonal element before you add contributions from off-diagonal elements. This avoids instabilities at boundaries for non-diagonal sigma.

Added checks in update_P: check, whether there is a diagonal element before you add contributions from off-diagonal elements. This avoids instabilities at boundaries for non-diagonal sigma.
LOOP_OVER_VOL_OWNED(gv, c, i) {
LOOP_OVER_VOL_OWNED(gv, c, i) if(s[i]!=0) {
//"if" to avoid instabilities coming from yee-grid shifts of off-diagnal elements
+ //FIXME: this prevents materials with pure off-diagonal sigma from working
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't a purely off-diagonal sigma matrix be indefinite, and hence lead to both loss and gain?

realnum pcur = p[i];
p[i] = gamma1inv * (pcur * (2 - omega0dtsqr_denom)
- gamma1 * pp[i]
+ omega0dtsqr * (s[i] * w[i]
+ OFFDIAG(s1,w1,is1,is)
+ OFFDIAG(s2,w2,is2,is)));
pp[i] = pcur;
}else{
p[i]=0; //seems unnecessary, but no harm is done here
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete the else clause, since p[i] is initialized to zero anyway.

@stevengj
Copy link
Collaborator

I just merged a PR #662 that reformats everything with clang-format, which creates lots of conflicts.

To rebase this PR onto master without having to deal manually with these formatting conflicts, follow the exact procedure given in the instructions of #662.

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.

2 participants