diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2016-05-13 16:36:44 -0400 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2016-05-13 16:36:44 -0400 |
commit | cf496ed1cf48e34716a08bb38f1f065027b5805a (patch) | |
tree | d00fb8f05628a8d74943c90668c907d67cc6ff20 | |
parent | 837fc24b4fb586f8c32c93affc9e941b2b061c63 (diff) | |
download | noisy_eit_xmds-cf496ed1cf48e34716a08bb38f1f065027b5805a.tar.gz noisy_eit_xmds-cf496ed1cf48e34716a08bb38f1f065027b5805a.zip |
bug fix: make initial E-field vector noise velocity independent
-rw-r--r-- | MOR_5_levels_with_doppler_and_propagation/Nlevels_with_MOR.xmds | 51 |
1 files changed, 30 insertions, 21 deletions
diff --git a/MOR_5_levels_with_doppler_and_propagation/Nlevels_with_MOR.xmds b/MOR_5_levels_with_doppler_and_propagation/Nlevels_with_MOR.xmds index 86aa117..a55cf6b 100644 --- a/MOR_5_levels_with_doppler_and_propagation/Nlevels_with_MOR.xmds +++ b/MOR_5_levels_with_doppler_and_propagation/Nlevels_with_MOR.xmds @@ -180,28 +180,37 @@ <components>EdL EdR EpL EpR</components> <initialisation> <![CDATA[ - // Initial (at starting 'z' position) electromagnetic field does not depend on detuning - // as well as time - // constant input - /* - EdL=EdLo; - EdR=EdRo; - EpL=EpLo; - EpR=EpRo; - */ - - // amplitude noise modulated - double r1 = 2.0*(1.0*rand()/RAND_MAX) - 1.0; // random number -1 .. +1 - double r2 = 2.0*(1.0*rand()/RAND_MAX) - 1.0; // random number -1 .. +1 - double r3 = 2.0*(1.0*rand()/RAND_MAX) - 1.0; // random number -1 .. +1 - double common_ampl_noise_frac = 1+commAmplNoise*r1; - double one_phot_noise_frac = onePhotonPhaseNoise*r2; - double two_phot_noise_frac = twoPhotonPhaseNoise*r3; - EdL=EdLo * common_ampl_noise_frac * exp(i*one_phot_noise_frac); - EdR=EdRo * common_ampl_noise_frac * exp(i*one_phot_noise_frac); - EpL=EpLo * common_ampl_noise_frac * exp(i*one_phot_noise_frac) * exp(i*two_phot_noise_frac); - EpR=EpRo * common_ampl_noise_frac * exp(i*one_phot_noise_frac) * exp(i*two_phot_noise_frac); + // amplitude and phase noise modulation to the E-fields + if ( _index_v == 0 ) { + double r1 = 2.0*(1.0*rand()/RAND_MAX) - 1.0; // random number -1 .. +1 + double r2 = 2.0*(1.0*rand()/RAND_MAX) - 1.0; // random number -1 .. +1 + double r3 = 2.0*(1.0*rand()/RAND_MAX) - 1.0; // random number -1 .. +1 + double common_ampl_noise_frac = 1+commAmplNoise*r1; + double one_phot_noise_frac = onePhotonPhaseNoise*r2; + double two_phot_noise_frac = twoPhotonPhaseNoise*r3; + EdL=EdLo * common_ampl_noise_frac * exp(i*one_phot_noise_frac); + EdR=EdRo * common_ampl_noise_frac * exp(i*one_phot_noise_frac); + EpL=EpLo * common_ampl_noise_frac * exp(i*one_phot_noise_frac) * exp(i*two_phot_noise_frac); + EpR=EpRo * common_ampl_noise_frac * exp(i*one_phot_noise_frac) * exp(i*two_phot_noise_frac); + } else { + // Initial E-fields are velocity independent + // via xmds magic we are accessing 0th velocity element of E-fields + // and assigning it to all velocity components of the E-fields + long old_tv_E_field_index_pointer = _tv_E_field_index_pointer; + _tv_E_field_index_pointer = old_tv_E_field_index_pointer - _index_v * _tv_E_field_ncomponents; + complex EdL_v0 = EdL; + complex EdR_v0 = EdR; + complex EpL_v0 = EpL; + complex EpR_v0 = EpR; + + _tv_E_field_index_pointer = old_tv_E_field_index_pointer; + + EdR = EdR_v0; + EdL = EdL_v0; + EpR = EpR_v0; + EpL = EpL_v0; + } // Temporary pulse in all fields /* |