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

replace stability error with warning message in Lorentzian susceptibilities #150

Merged
merged 3 commits into from
Dec 22, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/susceptibility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ void *lorentzian_susceptibility::copy_internal_data(void *data) const {
Note that the pole satisfies the quadratic equation:
(z + 1/z - 2)/dt^2 + g*(z - 1/z)/(2*dt) + w^2 = 0
where w = 2*pi*omega_0 and g = 2*pi*gamma. It is just a little
algebra from this to get the condition for a root with |z| > 1. */
algebra from this to get the condition for a root with |z| > 1.

FIXME: this test seems to be too conservative (issue #12) */
static bool lorentzian_unstable(double omega_0, double gamma, double dt) {
double w = 2*pi*omega_0, g = 2*pi*gamma;
double g2 = g*dt/2, w2 = (w*dt)*(w*dt);
Expand All @@ -177,10 +179,8 @@ void lorentzian_susceptibility::update_P
const double omega0dtsqr_denom = no_omega_0_denominator ? 0 : omega0dtsqr;
(void) W_prev; // unused;

if (!no_omega_0_denominator && gamma >= 0
&& lorentzian_unstable(omega_0, gamma, dt))
abort("Lorentzian pole at too high a frequency %g for stability with dt = %g: reduce the Courant factor, increase the resolution, or use a different dielectric model\n", omega_0, dt);

// TODO: add back lorentzian_unstable(omega_0, gamma, dt) if we can improve the stability test

FOR_COMPONENTS(c) DOCMP2 if (d->P[c][cmp]) {
const realnum *w = W[c][cmp], *s = sigma[c][component_direction(c)];
if (w && s) {
Expand Down