Skip to content
Snippets Groups Projects
Commit ee668a18 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

rm scalar tanh|NC source pairs

parent 1dfd7e1e
No related branches found
No related tags found
1 merge request!214Core: get rid of ISpecularStrategy hierarchy
// ************************************************************************************************
//
// BornAgain: simulate and fit reflection and scattering
//
//! @file Resample/Specular/SpecularScalarNCStrategy.cpp
//! @brief Implements class SpecularScalarNCStrategy.
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2018
//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
// ************************************************************************************************
#include "Resample/Specular/SpecularScalarNCStrategy.h"
#include <Eigen/Dense>
std::pair<complex_t, complex_t> SpecularScalarNCStrategy::transition(complex_t kzi, complex_t kzi1,
double sigma) const
{
complex_t roughness_diff = 1;
complex_t roughness_sum = 1;
if (sigma > 0.0) {
roughness_diff = std::exp(-(kzi1 - kzi) * (kzi1 - kzi) * sigma * sigma / 2.);
roughness_sum = std::exp(-(kzi1 + kzi) * (kzi1 + kzi) * sigma * sigma / 2.);
}
const complex_t kz_ratio = kzi1 / kzi;
const complex_t a00 = 0.5 * (1. + kz_ratio) * roughness_diff;
const complex_t a01 = 0.5 * (1. - kz_ratio) * roughness_sum;
return {a00, a01};
}
// ************************************************************************************************
//
// BornAgain: simulate and fit reflection and scattering
//
//! @file Resample/Specular/SpecularScalarNCStrategy.h
//! @brief Defines class SpecularScalarNCStrategy.
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2018
//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
// ************************************************************************************************
#ifdef SWIG
#error no need to expose this header to Swig
#endif
#ifndef USER_API
#ifndef BORNAGAIN_RESAMPLE_SPECULAR_SPECULARSCALARNCSTRATEGY_H
#define BORNAGAIN_RESAMPLE_SPECULAR_SPECULARSCALARNCSTRATEGY_H
#include "Resample/Specular/SpecularScalarStrategy.h"
//! Implements Nevot-Croce roughness for a scaler computation.
//!
//! Implements the transition function that includes Nevot-Croce roughness
//! in the computation of the coefficients for coherent wave propagation
//! in a multilayer by applying modified Fresnel coefficients.
class SpecularScalarNCStrategy : public SpecularScalarStrategy {
private:
//! Roughness is modelled by a Gaussian profile, i.e. Nevot-Croce factors for the
//! reflection coefficients.
//! Implementation follows A. Gibaud and G. Vignaud, in X-ray and Neutron Reflectivity, edited
//! by J. Daillant and A. Gibaud, volume 770 of Lecture Notes in Physics (2009)
std::pair<complex_t, complex_t> transition(complex_t kzi, complex_t kzi1, double sigma) const;
};
#endif // BORNAGAIN_RESAMPLE_SPECULAR_SPECULARSCALARNCSTRATEGY_H
#endif // USER_API
// ************************************************************************************************
//
// BornAgain: simulate and fit reflection and scattering
//
//! @file Resample/Specular/SpecularScalarTanhStrategy.cpp
//! @brief Implements class SpecularScalarTanhStrategy.
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2018
//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
// ************************************************************************************************
#include "Resample/Specular/SpecularScalarTanhStrategy.h"
#include "Base/Math/Constants.h"
#include "Base/Math/Functions.h"
#include <Eigen/Dense>
std::pair<complex_t, complex_t>
SpecularScalarTanhStrategy::transition(complex_t kzi, complex_t kzi1, double sigma) const
{
complex_t roughness = 1;
if (sigma > 0.0) {
const double sigeff = std::pow(M_PI_2, 1.5) * sigma;
roughness = std::sqrt(Math::tanhc(sigeff * kzi1) / Math::tanhc(sigeff * kzi));
}
const complex_t inv_roughness = 1.0 / roughness;
const complex_t kz_ratio = kzi1 / kzi * roughness;
const complex_t a00 = 0.5 * (inv_roughness + kz_ratio);
const complex_t a01 = 0.5 * (inv_roughness - kz_ratio);
return {a00, a01};
}
// ************************************************************************************************
//
// BornAgain: simulate and fit reflection and scattering
//
//! @file Resample/Specular/SpecularScalarTanhStrategy.h
//! @brief Defines class SpecularScalarTanhStrategy.
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2018
//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
// ************************************************************************************************
#ifdef SWIG
#error no need to expose this header to Swig
#endif
#ifndef USER_API
#ifndef BORNAGAIN_RESAMPLE_SPECULAR_SPECULARSCALARTANHSTRATEGY_H
#define BORNAGAIN_RESAMPLE_SPECULAR_SPECULARSCALARTANHSTRATEGY_H
#include "Resample/Specular/SpecularScalarStrategy.h"
//! Implements an tanh transition function to model roughness in a scaler computation.
//!
//! Implements the transition function that includes the analytical roughness model
//! of an tanh interface transition in the computation of the coefficients for
//! coherent wave propagation in a multilayer by applying modified Fresnel coefficients.
class SpecularScalarTanhStrategy : public SpecularScalarStrategy {
private:
//! Roughness is modelled by tanh profile
//! [e.g. Bahr, Press, et al, Phys. Rev. B, vol. 47 (8), p. 4385 (1993)].
std::pair<complex_t, complex_t> transition(complex_t kzi, complex_t kzi1, double sigma) const;
};
#endif // BORNAGAIN_RESAMPLE_SPECULAR_SPECULARSCALARTANHSTRATEGY_H
#endif // USER_API
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment