Skip to content

Commit

Permalink
Implementd contribution from muitlpe sources, and verified al working…
Browse files Browse the repository at this point in the history
… with DAGMC
  • Loading branch information
Your Name committed Nov 26, 2024
1 parent 77b53dc commit 6975156
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 22 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions include/openmc/particle_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
36 changes: 16 additions & 20 deletions src/tallies/tally_scoring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<IndependentSource*>(&mysource))
// Check if the actual type is IndependentSource
{
Expand Down Expand Up @@ -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);
}
}
}

Expand Down

0 comments on commit 6975156

Please sign in to comment.