mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Resolving review comments: adding doxygen param lists, cleaning up references/pointers
This commit is contained in:
parent
a9641b8e2a
commit
5af41ce3c3
7 changed files with 49 additions and 42 deletions
|
|
@ -15,31 +15,46 @@ namespace openmc {
|
|||
// are brought over
|
||||
|
||||
//! \brief samples particle behavior after a collision event.
|
||||
//! \param p Particle to operate on
|
||||
//! \param energy_bin_avg Average energy within each energy bin
|
||||
//! \param material_xs The cross section cache for the current material
|
||||
extern "C" void
|
||||
collision_mg(Particle* p, const double* energy_bin_avg,
|
||||
const MaterialMacroXS& material_xs);
|
||||
const MaterialMacroXS* material_xs);
|
||||
|
||||
//! \brief samples a reaction type.
|
||||
//!
|
||||
//! Note that there is special logic when suvival biasing is turned on since
|
||||
//! fission and disappearance are treated implicitly.
|
||||
//! \param p Particle to operate on
|
||||
//! \param energy_bin_avg Average energy within each energy bin
|
||||
//! \param material_xs The cross section cache for the current material
|
||||
void
|
||||
sample_reaction(Particle* p, const double* energy_bin_avg,
|
||||
const MaterialMacroXS& material_xs);
|
||||
const MaterialMacroXS* material_xs);
|
||||
|
||||
//! \brief Samples the scattering event
|
||||
//! \param p Particle to operate on
|
||||
//! \param energy_bin_avg Average energy within each energy bin
|
||||
void
|
||||
scatter(Particle* p, const double* energy_bin_avg);
|
||||
|
||||
//! \brief Determines the average total, prompt and delayed neutrons produced
|
||||
//! from fission and creates the appropriate bank sites.
|
||||
//! \param p Particle to operate on
|
||||
//! \param bank_array The particle bank to populate
|
||||
//! \param size_bank Number of particles currently in the bank
|
||||
//! \param bank_array_size Allocated size of the bank
|
||||
//! \param material_xs The cross section cache for the current material
|
||||
void
|
||||
create_fission_sites(Particle* p, Bank* bank_array, int64_t& size_bank,
|
||||
const int64_t& bank_array_size, const MaterialMacroXS& material_xs);
|
||||
create_fission_sites(Particle* p, Bank* bank_array, int64_t* size_bank,
|
||||
int64_t bank_array_size, const MaterialMacroXS* material_xs);
|
||||
|
||||
//! \brief Handles an absorption event
|
||||
//! \param p Particle to operate on
|
||||
//! \param material_xs The cross section cache for the current material
|
||||
void
|
||||
absorption(Particle* p, const MaterialMacroXS& material_xs);
|
||||
absorption(Particle* p, const MaterialMacroXS* material_xs);
|
||||
|
||||
} // namespace openmc
|
||||
#endif // OPENMC_PHYSICS_MG_H
|
||||
|
|
|
|||
|
|
@ -2986,7 +2986,7 @@ contains
|
|||
|
||||
! Check if material is fissionable
|
||||
if (nuclides(materials(i) % nuclide(j)) % fissionable) then
|
||||
call materials(i) % set_fissionable(logical(.true., C_BOOL))
|
||||
call materials(i) % set_fissionable(.true.)
|
||||
end if
|
||||
end do
|
||||
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ extern "C" {
|
|||
|
||||
bool material_fissionable(Material* mat) {return mat->fissionable;}
|
||||
|
||||
void material_set_fissionable(Material* mat, bool fissionable, int32_t index)
|
||||
void material_set_fissionable(Material* mat, bool fissionable)
|
||||
{
|
||||
mat->fissionable = fissionable;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -161,9 +161,9 @@ contains
|
|||
end function material_fissionable
|
||||
|
||||
subroutine material_set_fissionable(this, fissionable)
|
||||
class(Material), intent(in) :: this
|
||||
logical(C_BOOL), intent(in) :: fissionable
|
||||
call material_set_fissionable_c(this % ptr, fissionable)
|
||||
class(Material),intent(in) :: this
|
||||
logical, intent(in) :: fissionable
|
||||
call material_set_fissionable_c(this % ptr, logical(fissionable, C_BOOL))
|
||||
end subroutine material_set_fissionable
|
||||
|
||||
function material_set_density(this, density) result(err)
|
||||
|
|
|
|||
|
|
@ -90,8 +90,8 @@ contains
|
|||
end if
|
||||
end do NUCLIDE_LOOP
|
||||
|
||||
call mat % set_fissionable(query_fissionable_c(mat % n_nuclides, &
|
||||
mat % nuclide))
|
||||
call mat % set_fissionable( &
|
||||
logical(query_fissionable_c(mat % n_nuclides, mat % nuclide)))
|
||||
|
||||
end do MATERIAL_LOOP
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ namespace openmc {
|
|||
|
||||
void
|
||||
collision_mg(Particle* p, const double* energy_bin_avg,
|
||||
const MaterialMacroXS& material_xs)
|
||||
const MaterialMacroXS* material_xs)
|
||||
{
|
||||
// Add to the collision counter for the particle
|
||||
p->n_collision++;
|
||||
|
|
@ -39,7 +39,7 @@ collision_mg(Particle* p, const double* energy_bin_avg,
|
|||
|
||||
void
|
||||
sample_reaction(Particle* p, const double* energy_bin_avg,
|
||||
const MaterialMacroXS& material_xs)
|
||||
const MaterialMacroXS* material_xs)
|
||||
{
|
||||
// Create fission bank sites. Note that while a fission reaction is sampled,
|
||||
// it never actually "happens", i.e. the weight of the particle does not
|
||||
|
|
@ -52,18 +52,18 @@ sample_reaction(Particle* p, const double* energy_bin_avg,
|
|||
int64_t result_bank_size;
|
||||
// Get pointer to fission bank from Fortran side
|
||||
openmc_fission_bank(&result_bank, &result_bank_size);
|
||||
create_fission_sites(p, result_bank, n_bank, result_bank_size,
|
||||
create_fission_sites(p, result_bank, &n_bank, result_bank_size,
|
||||
material_xs);
|
||||
} else if ((settings::run_mode == RUN_MODE_FIXEDSOURCE) &&
|
||||
(settings::create_fission_neutrons)) {
|
||||
create_fission_sites(p, p->secondary_bank, p->n_secondary,
|
||||
create_fission_sites(p, p->secondary_bank, &(p->n_secondary),
|
||||
MAX_SECONDARY, material_xs);
|
||||
}
|
||||
}
|
||||
|
||||
// If survival biasing is being used, the following subroutine adjusts the
|
||||
// weight of the particle. Otherwise, it checks to see if absorption occurs.
|
||||
if (material_xs.absorption > 0.) {
|
||||
if (material_xs->absorption > 0.) {
|
||||
absorption(p, material_xs);
|
||||
} else {
|
||||
p->absorb_wgt = 0.;
|
||||
|
|
@ -105,24 +105,18 @@ scatter(Particle* p, const double* energy_bin_avg)
|
|||
}
|
||||
|
||||
void
|
||||
create_fission_sites(Particle* p, Bank* bank_array, int64_t& size_bank,
|
||||
const int64_t& bank_array_size,
|
||||
const MaterialMacroXS& material_xs)
|
||||
create_fission_sites(Particle* p, Bank* bank_array, int64_t* size_bank,
|
||||
int64_t bank_array_size, const MaterialMacroXS* material_xs)
|
||||
{
|
||||
// TODO: Heat generation from fission
|
||||
|
||||
// If uniform fission source weighting is turned on, we increase or decrease
|
||||
// the expected number of fission sites produced
|
||||
double weight;
|
||||
if (settings::ufs_on) {
|
||||
weight = ufs_get_weight(p);
|
||||
} else {
|
||||
weight = 1.;
|
||||
}
|
||||
double weight = settings::ufs_on ? ufs_get_weight(p) : 1.0;
|
||||
|
||||
// Determine the expected number of neutrons produced
|
||||
double nu_t = p->wgt / openmc_keff * weight * material_xs.nu_fission /
|
||||
material_xs.total;
|
||||
double nu_t = p->wgt / openmc_keff * weight * material_xs->nu_fission /
|
||||
material_xs->total;
|
||||
|
||||
// Sample the number of neutrons produced
|
||||
int nu = static_cast<int>(nu_t);
|
||||
|
|
@ -133,7 +127,7 @@ create_fission_sites(Particle* p, Bank* bank_array, int64_t& size_bank,
|
|||
// Check for the bank size getting hit. For fixed source calculations, this
|
||||
// is a fatal error; for eigenvalue calculations, it just means that k-eff
|
||||
// was too high for a single batch.
|
||||
if (size_bank + nu > bank_array_size) {
|
||||
if (*size_bank + nu > bank_array_size) {
|
||||
if (settings::run_mode == RUN_MODE_FIXEDSOURCE) {
|
||||
throw std::runtime_error{"Secondary particle bank size limit reached."
|
||||
" If you are running a subcritical multiplication problem,"
|
||||
|
|
@ -151,16 +145,15 @@ create_fission_sites(Particle* p, Bank* bank_array, int64_t& size_bank,
|
|||
|
||||
// Begin banking the source neutrons
|
||||
// First, if our bank is full then don't continue
|
||||
if ((nu == 0) || (size_bank == bank_array_size)) return;
|
||||
if ((nu == 0) || (*size_bank == bank_array_size)) return;
|
||||
|
||||
// Initialize the counter of delayed neutrons encountered for each delayed
|
||||
// group.
|
||||
double nu_d[MAX_DELAYED_GROUPS] = {0.};
|
||||
|
||||
p->fission = true;
|
||||
// TODO: +1 for start?
|
||||
for (size_t i = static_cast<size_t>(size_bank);
|
||||
i < static_cast<size_t>(std::min(size_bank + nu, bank_array_size)); i++) {
|
||||
for (size_t i = static_cast<size_t>(*size_bank);
|
||||
i < static_cast<size_t>(std::min(*size_bank + nu, bank_array_size)); i++) {
|
||||
// Bank source neutrons by copying the particle data
|
||||
bank_array[i].xyz[0] = p->coord[0].xyz[0];
|
||||
bank_array[i].xyz[1] = p->coord[0].xyz[1];
|
||||
|
|
@ -200,7 +193,7 @@ create_fission_sites(Particle* p, Bank* bank_array, int64_t& size_bank,
|
|||
}
|
||||
|
||||
// Increment number of bank sites
|
||||
size_bank = std::min(size_bank + nu, bank_array_size);
|
||||
*size_bank = std::min(*size_bank + nu, bank_array_size);
|
||||
|
||||
// Store the total weight banked for analog fission tallies
|
||||
p->n_bank = nu;
|
||||
|
|
@ -211,11 +204,11 @@ create_fission_sites(Particle* p, Bank* bank_array, int64_t& size_bank,
|
|||
}
|
||||
|
||||
void
|
||||
absorption(Particle* p, const MaterialMacroXS& material_xs)
|
||||
absorption(Particle* p, const MaterialMacroXS* material_xs)
|
||||
{
|
||||
if (settings::survival_biasing) {
|
||||
// Determine weight absorbed in survival biasing
|
||||
p->absorb_wgt = p->wgt * material_xs.absorption / material_xs.total;
|
||||
p->absorb_wgt = p->wgt * material_xs->absorption / material_xs->total;
|
||||
|
||||
// Adjust weight of particle by the probability of absorption
|
||||
p->wgt -= p->absorb_wgt;
|
||||
|
|
@ -223,13 +216,13 @@ absorption(Particle* p, const MaterialMacroXS& material_xs)
|
|||
|
||||
// Score implicit absorpion estimate of keff
|
||||
#pragma omp atomic
|
||||
global_tally_absorption += p->absorb_wgt * material_xs.nu_fission /
|
||||
material_xs.absorption;
|
||||
global_tally_absorption += p->absorb_wgt * material_xs->nu_fission /
|
||||
material_xs->absorption;
|
||||
} else {
|
||||
if (material_xs.absorption > prn() * material_xs.total) {
|
||||
if (material_xs->absorption > prn() * material_xs->total) {
|
||||
#pragma omp atomic
|
||||
global_tally_absorption += p->wgt * material_xs.nu_fission /
|
||||
material_xs.absorption;
|
||||
global_tally_absorption += p->wgt * material_xs->nu_fission /
|
||||
material_xs->absorption;
|
||||
p->alive = false;
|
||||
p->event = EVENT_ABSORB;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ module tracking
|
|||
use nuclide_header
|
||||
use particle_header
|
||||
use physics, only: collision
|
||||
! use physics_mg, only: collision_mg
|
||||
use random_lcg, only: prn, prn_set_stream
|
||||
use settings
|
||||
use simulation_header
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue