-
Notifications
You must be signed in to change notification settings - Fork 18
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
Add optional process support for biased sampling (for focus, point detectors, etc). #175
Comments
Based on my own musings + discussions with @marquezj, @dddijulio, @willend, here are a few ideas for how such interfaces would look. The first (towards a particular mu=cos(scatangle)) would work best with processes where XS varies smoothly, while the latter (towards a mu range) would be needed to deal with other processes (e.g. bragg diffraction) -- and would need either the neutron flight path or the detector extend to be something more than a point. I am not sure yet if the //If processType is Scatter and materialType is Isotropic, it *might* be
//possible to query the sampling (this can be used to implement biasing,
//focusing, or efficient tallying). Not all processes might support this,
//as indicated by the canSampleTowardsXXX() methods - and using the
//sampleTowardsXXX(..) methods might consequently result in exceptions
//being raised.
//Get the scattering contribution towards a particular direction (mu), and
//sample up to N outgoing energy values in that direction. While the
//actual number of resulting energy values will typically be the requested
//N, it might be lower. In particular it should be 0 if there is no
//probability to scatter in that direction (so also the weight will 0),
//and if there is only one possible outgoing energy value (e.g. an elastic
//process), only a single entry might be returned. It is OK to specify
//N=0, if only the weight is desired.
struct ScatOutcomesIsotropic_TowardsMu {
double weight; // p(mu)?, or also include cross section? Should the unit be barn? (i.e. CrossSect?)
SmallVector<NeutronEnergy,16> ekin;
};
virtual bool canSampleTowardsMu() const = 0;
virtual ScatOutcomesIsotropic_TowardsMu sampleTowardsMu( CachePtr&, RNG&,
NeutronEnergy,
CosineScatAngle target_mu,
std::size_t N = 1 ) const = 0;
//Similar, but considering a range of mu values. This form is also
//suitable for sharply peaked differential cross sections (e.g. Bragg
//diffraction has delta-functions in p(mu).
struct ScatOutcomesIsotropic_TowardsMuRange {
double weight;//p(mu_min<=mu<=mu_max)??
SmallVector<ScatterOutcomeIsotropic,16> outcomes;//list of sampled (mu,ekin) values
};
virtual bool canSampleTowardsMuRange() const = 0;
virtual ScatOutcomesIsotropic_TowardsMu sampleTowardsMuRange( CachePtr&, RNG&,
NeutronEnergy,
CosineScatAngle target_mu_min,
CosineScatAngle target_mu_max,
std::size_t N = 1 ) const = 0; |
I am also not super happy with the potential memory allocation in case |
This is related to the issue of "differential cross sections", but loosely speaking (ignoring non-isotropic materials for now) one of the two variables (E,mu) is sampled and the other is used as a differential cross section.
Such features could be used for biasing in our "mini stepping mc" (#101), adding focusing to McStas components, implementing "point detectors", etc.
The features would need new virtual functions on the basic process interface classes, and thus break ABI. It might be an idea to add them when we add other ABI breaking changes (e.g. adding vectorized versions of cross section evaluations, etc).
The text was updated successfully, but these errors were encountered: