Commit 7432b9e8 authored by Daniel Brown's avatar Daniel Brown
Browse files

fixing coupling for modulator when using reduced order coupling with quantum output

parent f9cbfaa1
......@@ -795,10 +795,10 @@ typedef struct mirror {
complex_t ****a1o_x; /** incoming beam outgoing at a1 contribution to mirror motion, matrix of [sig freq][mode] */
complex_t ****a2o_x; /** incoming beam outgoing at a2 contribution to mirror motion, matrix of [sig freq][mode] */
complex_t *ic_a1i_x;
complex_t *ic_a1o_x;
complex_t *ic_a2i_x;
complex_t *ic_a2o_x;
complex_t *ic_a1i_x; /** Internal coupling of motion DOF */
complex_t *ic_a1o_x; /** Internal coupling of motion DOF */
complex_t *ic_a2i_x; /** Internal coupling of motion DOF */
complex_t *ic_a2o_x; /** Internal coupling of motion DOF */
/** Stores the coupling coefficients without applying reverse gouy or phase command options*/
mirror_knm_t knm_no_rgouy;
......
......@@ -604,7 +604,8 @@ complex_t S_g(complex_t X, complex_t XS, complex_t F, complex_t FS,
}
void __print_coupling_info_line(const char* name, coupling_info_t *c){
//message("%10.10s %.5.5s max=%i \n", name, c->coupling_off ? "off" : "on", c->max_coupling_order);
if(inter.debug)
message("%10.10s %5.5s max=%i \n", name, c->coupling_off ? "off" : "on", c->max_coupling_order);
}
void __set_no_reduce_coupling_info(coupling_info_t *c){
......@@ -627,6 +628,12 @@ void set_coupling_info() {
int max = inter.tem;
if(inter.debug && options.use_coupling_reduction) {
message("-----------------------------------\n");
message("Reduced order coupling information\n");
message("-----------------------------------\n");
}
for(i=0; i<inter.num_mirrors; i++){
mirror_t *mirror = &inter.mirror_list[i];
......@@ -820,6 +827,9 @@ void set_coupling_info() {
}
}
if(inter.debug && options.use_coupling_reduction) {
message("-----------------------------------\n");
}
}
/**
......
......@@ -2722,8 +2722,12 @@ void fill_matrix_modulator_elements_quantum(ifo_matrix_vars_t *matrix){
mod = &(inter.modulator_list[i]);
complex_t tmp;
int nj, mj, nk, mk;
// field amplitudes
for(fin = 0; fin < matrix->num_frequencies; fin++){
bool do_conj = (matrix->type == SIGNAL_QCORR && matrix->frequencies[fin]->order == -1) ? true : false;
for(fout = 0; fout < matrix->num_frequencies; fout++){
// only compute if we have set these frequencies to couple
if(matrix->mod_f_couple_allocd[i][fin][fout]){
......@@ -2733,17 +2737,27 @@ void fill_matrix_modulator_elements_quantum(ifo_matrix_vars_t *matrix){
tmp = complex_0;
for (j = 0; j < inter.num_fields; j++) {
get_tem_modes_from_field_index(&nj, &mj, j);
for (k = 0; k < inter.num_fields; k++) {
if (mod->a12f[f_offset+fin][f_offset+fout][j][k] != NULL) {
*(mod->a12f[f_offset+fin][f_offset+fout][j][k]) = tmp;
} else if(matrix->mod_does_f_couple[i][fin][fout])
bug_error("No elements were got for modulator %s for coupling between frequency %i and %i", mod->name, fin, fout);
if (mod->a21f[f_offset+fin][f_offset+fout][j][k] != NULL) {
*(mod->a21f[f_offset+fin][f_offset+fout][j][k]) = tmp;
} else if(matrix->mod_does_f_couple[i][fin][fout])
bug_error("No elements were got for modulator %s for coupling between frequency %i and %i", mod->name, fin, fout);
get_tem_modes_from_field_index(&nk, &mk, k);
if(include_mode_coupling(&mod->a_cplng_12, nj, nk, mj, mk)){
if (mod->a12f[f_offset+fin][f_offset+fout][j][k] != NULL) {
*(mod->a12f[f_offset+fin][f_offset+fout][j][k]) = tmp;
if(do_conj) mod->a12f[f_offset+fin][f_offset+fout][j][k]->im *= -1;
} else if(matrix->mod_does_f_couple[i][fin][fout])
bug_error("No elements were got for modulator %s for coupling between frequency %i and %i, direction 12", mod->name, fin, fout);
}
if(include_mode_coupling(&mod->a_cplng_21, nj, nk, mj, mk)){
if (mod->a21f[f_offset+fin][f_offset+fout][j][k] != NULL) {
*(mod->a21f[f_offset+fin][f_offset+fout][j][k]) = tmp;
if(do_conj) mod->a12f[f_offset+fin][f_offset+fout][j][k]->im *= -1;
} else if(matrix->mod_does_f_couple[i][fin][fout])
bug_error("No elements were got for modulator %s for coupling between frequency %i and %i, direction 21", mod->name, fin, fout);
}
}
}
}
......@@ -2848,7 +2862,7 @@ void fill_matrix_modulator_elements_new(ifo_matrix_vars_t *matrix) {
*(mod->a12f[f_offset+fin][f_offset+fout][j][k]) = z_by_x(z_by_z(tmp, mod->k12[j][k]), -1.0);
if(do_conj) mod->a12f[f_offset+fin][f_offset+fout][j][k]->im *= -1;
} else if(matrix->mod_does_f_couple[i][fin][fout])
bug_error("No elements were got for modulator %s for coupling between frequency %i and %i", mod->name, fin, fout);
bug_error("No elements were got for modulator %s for coupling between frequency %i and %i, direction 12", mod->name, fin, fout);
}
if(include_mode_coupling(&mod->a_cplng_21, nj, nk, mj, mk)){
......@@ -2856,7 +2870,7 @@ void fill_matrix_modulator_elements_new(ifo_matrix_vars_t *matrix) {
*(mod->a21f[f_offset+fin][f_offset+fout][j][k]) = z_by_x(z_by_z(tmp, mod->k21[j][k]), -1.0);
if(do_conj) mod->a21f[f_offset+fin][f_offset+fout][j][k]->im *= -1;
} else if(matrix->mod_does_f_couple[i][fin][fout])
bug_error("No elements were got for modulator %s for coupling between frequency %i and %i", mod->name, fin, fout);
bug_error("No elements were got for modulator %s for coupling between frequency %i and %i, direction 21", mod->name, fin, fout);
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment