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

Band source #11

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
5681225
Enabled --prefix= option passed by autogen.sh - important for experim…
FilipDominec Apr 10, 2014
2816586
Fixed bicgstab according to Wu http://permalink.gmane.org/gmane.comp.…
FilipDominec Apr 10, 2014
746ca70
Added support for a source with rectangular spectrum (see http://fzu.…
FilipDominec Apr 10, 2014
39ddb68
Fixing autogen.sh to upstream
FilipDominec Feb 5, 2015
fc1e135
update for merge
FilipDominec Feb 5, 2015
cb97476
Fixed bicgstab according to Wu http://permalink.gmane.org/gmane.comp.…
FilipDominec Apr 10, 2014
f9685b9
Added support for a source with rectangular spectrum (see http://fzu.…
FilipDominec Apr 10, 2014
72c3085
Added support for a source with rectangular spectrum (see http://fzu.…
FilipDominec Apr 10, 2014
89e3c8a
merged the band_source with upstream changes
FilipDominec Feb 6, 2015
49d5085
Merge remote-tracking branch 'origin/master'
FilipDominec Feb 6, 2015
115f45c
update namespace std:: in meep header
FilipDominec Feb 6, 2015
c5043fd
update namespace std:: in meep header (+whitespace fix)
FilipDominec Feb 6, 2015
0e59578
Merge remote-tracking branch 'origin/master'
FilipDominec Feb 6, 2015
3f58eee
Lorentzian stability check should write a warning only (suspected to …
FilipDominec Feb 6, 2015
33429ce
removing the Lorentzian stability check (it is wrong)
FilipDominec Feb 23, 2015
e12f3fb
lorentzian_unstable() changed to a start-up warning only
FilipDominec Feb 23, 2015
6ae68bd
cleaned the instability printout
FilipDominec Feb 23, 2015
00285d7
Merge branch 'master' of https://github.com/stevengj/meep
FilipDominec Feb 22, 2016
d04b471
lorentzian pole printout
FilipDominec Feb 23, 2016
8853142
Merge branch 'master' of https://github.com/FilipDominec/meep
FilipDominec Feb 23, 2016
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
Prev Previous commit
Next Next commit
lorentzian_unstable() changed to a start-up warning only
FilipDominec committed Feb 23, 2015
commit e12f3fb7f90a4a070e92dee1424e92da63741004
36 changes: 20 additions & 16 deletions src/susceptibility.cpp
Original file line number Diff line number Diff line change
@@ -111,6 +111,21 @@ void *lorentzian_susceptibility::new_internal_data(
return (void*) d;
}


/* Return true if the discretized Lorentzian ODE is intrinsically unstable,
i.e. if it corresponds to a filter with a pole z outside the unit circle.
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. */
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);
double b = (1 - w2/2) / (1 + g2), c = (1 - g2) / (1 + g2);
return b*b > c && 2*b*b - c + 2*fabs(b)*sqrt(b*b - c) > 1;
}


void lorentzian_susceptibility::init_internal_data(
realnum *W[NUM_FIELD_COMPONENTS][2],
double dt, const grid_volume &gv, void *data) const {
@@ -128,6 +143,11 @@ void lorentzian_susceptibility::init_internal_data(
P += 2*ntot;
P_prev += 2*ntot;
}
master_printf("CHECKING LORENTZIAN STABILITY\n");
if (!no_omega_0_denominator && gamma >= 0
&& lorentzian_unstable(omega_0, gamma, dt))
master_printf("Lorentzian expected unstable by the Von Neumann stability analysis (omega_0=%g, gamma=%g, dt=%g)\n", omega_0, gamma, dt);
master_printf("END CHECKING LORENTZIAN STABILITY\n");
}

void *lorentzian_susceptibility::copy_internal_data(void *data) const {
@@ -147,18 +167,6 @@ void *lorentzian_susceptibility::copy_internal_data(void *data) const {
return (void*) dnew;
}

/* Return true if the discretized Lorentzian ODE is intrinsically unstable,
i.e. if it corresponds to a filter with a pole z outside the unit circle.
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. */
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);
double b = (1 - w2/2) / (1 + g2), c = (1 - g2) / (1 + g2);
return b*b > c && 2*b*b - c + 2*fabs(b)*sqrt(b*b - c) > 1;
}

#define SWAP(t,a,b) { t SWAP_temp = a; a = b; b = SWAP_temp; }

@@ -177,10 +185,6 @@ 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);

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