From 69751567118310043feb0209765d641981f5a642 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 26 Nov 2024 10:48:20 +0200 Subject: [PATCH] Implementd contribution from muitlpe sources, and verified al working with DAGMC --- Dockerfile | 4 ++-- include/openmc/particle_data.h | 1 + src/source.cpp | 1 + src/tallies/tally_scoring.cpp | 36 +++++++++++++++------------------- 4 files changed, 20 insertions(+), 22 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4a94e3c0b11..7f6602bb3c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -182,8 +182,8 @@ FROM dependencies AS build ENV HOME=/root -ARG openmc_branch=master -ENV OPENMC_REPO='https://github.com/openmc-dev/openmc' +ARG openmc_branch=deploy +ENV OPENMC_REPO='https://github.com/itay-space/openmc.git' ARG compile_cores ARG build_dagmc diff --git a/include/openmc/particle_data.h b/include/openmc/particle_data.h index 7addc38df49..610f49da49f 100644 --- a/include/openmc/particle_data.h +++ b/include/openmc/particle_data.h @@ -52,6 +52,7 @@ struct SourceSite { ParticleType particle; int64_t parent_id; int64_t progeny_id; + int source_index; }; //! State of a particle used for particle track files diff --git a/src/source.cpp b/src/source.cpp index 48d9699a377..99b782a41f7 100644 --- a/src/source.cpp +++ b/src/source.cpp @@ -635,6 +635,7 @@ SourceSite sample_external_source(uint64_t* seed) site.E = data::mg.num_energy_groups_ - site.E - 1.; } site.ext = true; + site.source_index = i; return site; } diff --git a/src/tallies/tally_scoring.cpp b/src/tallies/tally_scoring.cpp index 4496f3dd022..2e4619848bf 100644 --- a/src/tallies/tally_scoring.cpp +++ b/src/tallies/tally_scoring.cpp @@ -948,21 +948,17 @@ void score_general_ce_nonanalog(Particle& p, int i_tally, int start_index, if (i_nuclide >= 0) { const auto& micro = p.photon_xs(i_nuclide); - double xs = (score_bin == COHERENT) - ? micro.coherent - : (score_bin == INCOHERENT) ? micro.incoherent - : (score_bin == PHOTOELECTRIC) - ? micro.photoelectric - : micro.pair_production; + double xs = (score_bin == COHERENT) ? micro.coherent + : (score_bin == INCOHERENT) ? micro.incoherent + : (score_bin == PHOTOELECTRIC) ? micro.photoelectric + : micro.pair_production; score = xs * atom_density * flux; } else { - double xs = (score_bin == COHERENT) - ? p.macro_xs().coherent - : (score_bin == INCOHERENT) - ? p.macro_xs().incoherent - : (score_bin == PHOTOELECTRIC) - ? p.macro_xs().photoelectric - : p.macro_xs().pair_production; + double xs = (score_bin == COHERENT) ? p.macro_xs().coherent + : (score_bin == INCOHERENT) ? p.macro_xs().incoherent + : (score_bin == PHOTOELECTRIC) + ? p.macro_xs().photoelectric + : p.macro_xs().pair_production; score = xs * flux; } break; @@ -2631,7 +2627,7 @@ void score_point_tally_from_source(const SourceSite* src) Direction u_lab_unit = u_lab / u_lab.norm(); // normalize // Get the angle distribution double pdf_mu_det = 0; - Source& mysource = *(model::external_sources[0]); + Source& mysource = *(model::external_sources[src->source_index]); if (auto* independentSource = dynamic_cast(&mysource)) // Check if the actual type is IndependentSource { @@ -2673,13 +2669,13 @@ void score_point_tally_from_source(const SourceSite* src) // Direction my_u_ref = angleDistribution->u_ref_; // fmt::print("uref = {0} , {1} , // {2}\n",my_u_ref.x,my_u_ref.y,my_u_ref.z); - } + Particle ghost_particle = Particle(); + ghost_particle.initilze_ghost_particle_from_source(src, u_lab_unit); - Particle ghost_particle = Particle(); - ghost_particle.initilze_ghost_particle_from_source(src, u_lab_unit); - // if (std::isnan(flux)) {std::cout << "flux nan from source " << - // std::endl;flux=0;} - score_ghost_particle(ghost_particle, pdf_mu_det, i_tally); + // if (std::isnan(flux)) {std::cout << "flux nan from source " << + // std::endl;flux=0;} + score_ghost_particle(ghost_particle, pdf_mu_det, i_tally); + } } }