Commit c665cb31 authored by Daniel Brown's avatar Daniel Brown

Further fixes for the mirror and beamsplitter refractive index bug for misalignments

parent 9b6116da
......@@ -1096,8 +1096,9 @@ typedef struct beamsplitter {
double alpha_1; //!< angle of incidence set by user [deg]
double alpha_2; //!< angle of incidence on side 2 calculated during ABCD calculations [deg]
double ir1; //!< refractive index side 1 computed during ABCD calculations
double ir2; //!< refractive index side 2 computed during ABCD calculations
// ddb - These values shouldn't be stored. Should use the values from the spaces
//double ir1; //!< refractive index side 1 computed during ABCD calculations
//double ir2; //!< refractive index side 2 computed during ABCD calculations
transfer_func_t *mech_tf; // index of mechanical transfer function applied to this mirror
......
......@@ -1776,7 +1776,6 @@ int set_k_beamsplitter(int bs_index) {
int node1_index, node2_index, node3_index, node4_index;
bitflag astigmatism = 0;
double nr1 = 1.0, nr2 = 1.0;
char buf[LINE_LEN];
complex_t qx1, qy1, qx2, qy2, qx3, qy3, qx4, qy4;
......@@ -1797,14 +1796,14 @@ int set_k_beamsplitter(int bs_index) {
node3_index = bs->node3_index;
node4_index = bs->node4_index;
nr1 = bs->ir1;
nr2 = bs->ir2;
node1 = inter.node_list[node1_index];
node2 = inter.node_list[node2_index];
node3 = inter.node_list[node3_index];
node4 = inter.node_list[node4_index];
double nr1 = 1, nr2 = 1;
bs_get_nr(bs, &nr1, &nr2);
if (NOT node1.gnd_node) {
node1 = inter.node_list[node1_index];
if (node1.component_index == component) {
......@@ -3027,7 +3026,7 @@ int set_k_modulator(int modulator_index) {
* appendix C.11 and C.12.
**/
{
complex_t q1, q2;
complex_t q1 = complex_0, q2 = complex_0;
if (!node1.gnd_node) {
// q at node 1 calculated is that of the mode coming into the
......@@ -4325,9 +4324,6 @@ void set_ABCD_beamsplitter(int bs_index) {
n2 = ir[0];
}
bs->ir1 = n1;
bs->ir2 = n2;
si1 = sin(bs->alpha_1 * RAD);
si2 = n1 / n2*si1;
if (fabs(si2) > 1) { // fabs 290402
......
......@@ -758,6 +758,50 @@ int is_xaxis_tuned(void *var, void **rtn, int *type){
return 0;
}
void bs_get_nr(beamsplitter_t *bs, double *nr1, double *nr2){
assert(bs != NULL);
assert(nr1 != NULL);
assert(nr2 != NULL);
node_t *node1 = &inter.node_list[bs->node1_index];
node_t *node2 = &inter.node_list[bs->node2_index];
node_t *node3 = &inter.node_list[bs->node3_index];
node_t *node4 = &inter.node_list[bs->node4_index];
assert(node1 != NULL);
assert(node2 != NULL);
assert(node3 != NULL);
assert(node4 != NULL);
if(!node1->gnd_node && !node2->gnd_node){
if((*node1->n != *node2->n)){
gerror("Refractive indices at node 1 and node 2 do not match for %s\n", bs->name);
}
}
if(!node3->gnd_node && !node4->gnd_node){
if((*node3->n != *node4->n)){
gerror("Refractive indices at node 3 and node 4 do not match for %s\n", bs->name);
}
}
if(!node1->gnd_node){
*nr1 = *node1->n;
} else if(!node2->gnd_node){
*nr1 = *node2->n;
} else {
*nr1 = 1;
}
if(!node3->gnd_node) {
*nr2 = *node3->n;
} else if(!node4->gnd_node) {
*nr2 = *node4->n;
} else {
*nr2 = 1;
}
}
int is_put_tuned(void *var, void **put, int *type) {
int i;
......
......@@ -41,6 +41,7 @@ void endTimer(int id);
void closeTimerFile();
void file_MD5(FILE *mapfile, unsigned char *hash);
void bs_get_nr(beamsplitter_t *bs, double *nr1, double *nr2);
bool is_tuned(double *var, double **source, void **rtn, int *type);
bool is_var_tuned(double *var);
......
......@@ -1302,8 +1302,12 @@ void fill_mirror_signal_rhs(signal_t *signal, ifo_matrix_vars_t* M_car, ifo_matr
}
}
// In the case we have an infinite mass mirror
if((signal->type == SIG_AMP || signal->type == SIG_PHS || signal->type == SIG_Z) && mirror->mass == 0){
for(f=0; f<M_sig->num_frequencies; f++){
// for each signal frequency compute the generated
// sidebands on reflection and transmission
frequency_t *f_sig = M_sig->frequencies[f];
double phase = (90.0 + f_sig->order * signal->phase);
double factor = signal->amplitude * EPSILON * 0.5; //Epsilon/2 for fsig
......@@ -1318,9 +1322,9 @@ void fill_mirror_signal_rhs(signal_t *signal, ifo_matrix_vars_t* M_car, ifo_matr
int sidx = M_sig->node_rhs_idx_1[node1->list_index] + get_node_rhs_idx(2, f, 0, M_sig->num_frequencies);
// get the incoming field at the mirror as we then have to compute the purely
// reflected part of the field by multiplying with the mirror knm matrix. We can't use
// the reflected carrier field as this will contain the non-reflected tranmitted field too
// the reflected carrier field as this will contain the non-reflected tranmitted carrier field too
int cidx = M_car->node_rhs_idx_1[node1->list_index] + get_node_rhs_idx(1, f_sig->carrier->index, 0, M_car->num_frequencies);
// idea is we compute: signal fields = factor*exp(i*phase)) * (knm * carrier fields)
complex_t *sig_vec = &(((complex_t*)M_sig->rhs_values)[sidx]);
complex_t *car_vec = &(((complex_t*)M_car->rhs_values)[cidx]);
......
......@@ -207,7 +207,7 @@ void compute_mirror_bayer_helms_knm(mirror_t *mirror, double nr1, double nr2) {
, mirror->knm_q.qyt2_21
, knm_BH->k21
, -(1 - nr2/nr1) * mirror->beta_x
, -(1 - nr2/nr1) * mirror->beta_y
, (1 - nr2/nr1) * mirror->beta_y
, nr1
, MR21
, mirror->knm_flags);
......@@ -301,7 +301,6 @@ void _bs_compute_bayer_helms_sub_call(complex_t qxt, complex_t qyt, complex_t qx
* @return Returns true if the Bayer-Helms knm should be calculated in the integral
*/
bool compute_bs_bayer_helms_knm(beamsplitter_t *bs, double nr1, double nr2) {
// check if we should integrate the bayer_helms knm's. If we do there is no
// need to calculate the rest of this function
if (bs->knm_flags & INT_BAYER_HELMS) {
......@@ -389,8 +388,8 @@ bool compute_bs_bayer_helms_knm(beamsplitter_t *bs, double nr1, double nr2) {
qy1 = bs->knm_q.qyt1_13;
qy2 = bs->knm_q.qyt2_13;
knm = bs->knm_bayer_helms.k13;
gamma_x = 0;
gamma_y = 0;
gamma_x = -(1 - nr1/nr2) * bs->beta_x;
gamma_y = -(1 - nr1/nr2) * bs->beta_y;
nr = nr2;
break;
case BS31:
......@@ -399,8 +398,8 @@ bool compute_bs_bayer_helms_knm(beamsplitter_t *bs, double nr1, double nr2) {
qy1 = bs->knm_q.qyt1_31;
qy2 = bs->knm_q.qyt2_31;
knm = bs->knm_bayer_helms.k31;
gamma_x = 0;
gamma_y = 0;
gamma_x = -(1 - nr2/nr1) * bs->beta_x;
gamma_y = (1 - nr2/nr1) * bs->beta_y;
nr = nr1;
break;
case BS24:
......@@ -409,8 +408,8 @@ bool compute_bs_bayer_helms_knm(beamsplitter_t *bs, double nr1, double nr2) {
qy1 = bs->knm_q.qyt1_24;
qy2 = bs->knm_q.qyt2_24;
knm = bs->knm_bayer_helms.k24;
gamma_x = 0;
gamma_y = 0;
gamma_x = -(1 - nr1/nr2) * bs->beta_x;
gamma_y = -(1 - nr1/nr2) * bs->beta_y;
nr = nr2;
break;
case BS42:
......@@ -419,8 +418,8 @@ bool compute_bs_bayer_helms_knm(beamsplitter_t *bs, double nr1, double nr2) {
qy1 = bs->knm_q.qyt1_42;
qy2 = bs->knm_q.qyt2_42;
knm = bs->knm_bayer_helms.k42;
gamma_x = 0;
gamma_y = 0;
gamma_x = -(1 - nr2/nr1) * bs->beta_x;
gamma_y = (1 - nr2/nr1) * bs->beta_y;
nr = nr1;
break;
}
......@@ -429,8 +428,11 @@ bool compute_bs_bayer_helms_knm(beamsplitter_t *bs, double nr1, double nr2) {
, qx2
, qy2
, knm
, gamma_x,gamma_y
, nr, (KNM_BS_NODE_DIRECTION_t)k, bs->knm_flags);
, gamma_x
, gamma_y
, nr
, (KNM_BS_NODE_DIRECTION_t)k
, bs->knm_flags);
}
}
......
......@@ -104,14 +104,14 @@ void solve_matrix(int matrix_type) {
void get_refl_q_in_out_bs(beamsplitter_t *bs, bs_knm_q_t *knm_q){
int component = get_overall_component_index(BEAMSPLITTER, bs->comp_index);
double nr1 = bs->ir1;
double nr2 = bs->ir2;
node_t *node1 = &inter.node_list[bs->node1_index];
node_t *node2 = &inter.node_list[bs->node2_index];
node_t *node3 = &inter.node_list[bs->node3_index];
node_t *node4 = &inter.node_list[bs->node4_index];
double nr1=1, nr2=1;
bs_get_nr(bs, &nr1, &nr2);
complex_t qx1, qx2, qy1, qy2;
complex_t qx3, qx4, qy3, qy4;
......@@ -810,8 +810,8 @@ void fill_bs_field_to_rot_motion(motion_type_t type, beamsplitter_t *bs, complex
bs_knm_q_t knm_q = {{0}};
get_refl_q_in_out_bs(bs, &knm_q);
double nr1 = bs->ir1;
double nr2 = bs->ir2;
double nr1=1, nr2=1;
bs_get_nr(bs, &nr1, &nr2);
// compute knm values with reverse gouy already applied, i.e don't add it in the
// first place...
......
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