-
Notifications
You must be signed in to change notification settings - Fork 509
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
created get pdf value and didnt use it
- Loading branch information
Showing
6 changed files
with
93 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,4 +95,37 @@ double AngleDistribution::sample(double E, uint64_t* seed) const | |
return mu; | ||
} | ||
|
||
double AngleDistribution::get_pdf_value(double E,double mu, uint64_t* seed) const | ||
{ | ||
This comment has been minimized.
Sorry, something went wrong.
Itay-max
Author
|
||
// Determine number of incoming energies | ||
auto n = energy_.size(); | ||
|
||
// Find energy bin and calculate interpolation factor -- if the energy is | ||
// outside the range of the tabulated energies, choose the first or last bins | ||
int i; | ||
double r; | ||
if (E < energy_[0]) { | ||
i = 0; | ||
r = 0.0; | ||
} else if (E > energy_[n - 1]) { | ||
i = n - 2; | ||
r = 1.0; | ||
} else { | ||
i = lower_bound_index(energy_.begin(), energy_.end(), E); | ||
r = (E - energy_[i]) / (energy_[i + 1] - energy_[i]); | ||
} | ||
|
||
// Sample between the ith and (i+1)th bin | ||
if (r > prn(seed)) | ||
++i; | ||
|
||
// Sample i-th distribution | ||
double pdf = distribution_[i]->get_pdf_value(mu,seed); | ||
|
||
// Make sure pdf > 0 and return | ||
if (std::abs(pdf) < 0) | ||
fmt::print("pdf = {} <1",pdf); | ||
return pdf; | ||
} | ||
|
||
} // namespace openmc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 comment
on commit 8269657
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrote AngleDistribution::get_pdf_value(E,mu) and Tabular::get_pdf_value(x) in order to find the mu dependent scatter probabiliy.
get the tabular data value at point x