From e937e9c951d70aae41ae935f7c4e98307af2e685 Mon Sep 17 00:00:00 2001 From: John Tramm Date: Mon, 6 Jan 2020 21:35:50 +0000 Subject: [PATCH] Unified history-based and event-based logic. Also removed extra python/dagmc tests from travis.yml --- .travis.yml | 18 +++++++++-------- src/simulation.cpp | 50 +++++++++++++++++++++++++++++++++++++--------- 2 files changed, 51 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index ef634dbbc..8e0d1eb57 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,18 +31,20 @@ env: - NUMPY_EXPERIMENTAL_ARRAY_FUNCTION=0 matrix: include: - - python: "3.5" - env: OMP=n MPI=n PHDF5=n - - python: "3.6" - env: OMP=n MPI=n PHDF5=n - - python: "3.7" - env: OMP=n MPI=n PHDF5=n + # - python: "3.5" + # env: OMP=n MPI=n PHDF5=n + # - python: "3.6" + # env: OMP=n MPI=n PHDF5=n + # - python: "3.7" + # env: OMP=n MPI=n PHDF5=n - python: "3.7" env: OMP=y MPI=n PHDF5=n - - python: "3.7" - env: OMP=n MPI=y PHDF5=n - python: "3.7" env: OMP=n MPI=y PHDF5=y + - python: "3.7" + env: OMP=y MPI=y PHDF5=y + # - python: "3.7" + # env: OMP=n MPI=y PHDF5=y notifications: webhooks: https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN install: diff --git a/src/simulation.cpp b/src/simulation.cpp index e137f70bf..763add5d7 100644 --- a/src/simulation.cpp +++ b/src/simulation.cpp @@ -306,6 +306,7 @@ void process_advance_particle_events() Particle * p = particles + advance_particle_queue[i].idx; //p->trace_ == (p->id_ == 0); + /* // Sample a distance to collision double d_collision; if (p->type_ == Particle::Type::electron || @@ -367,8 +368,29 @@ void process_advance_particle_events() if (!model::active_tallies.empty()) { score_track_derivative(p, distance); } + */ + p->event_advance(); + if( p->collision_distance_ > p->boundary_.distance ) + { + int idx; + #pragma omp atomic capture + idx = surface_crossing_queue_length++; + surface_crossing_queue[idx].idx = advance_particle_queue[i].idx; + surface_crossing_queue[idx].E = p->E_; + surface_crossing_queue[idx].material = p->material_; + surface_crossing_queue[idx].type = p->type_; + } + else + { + int idx; + #pragma omp atomic capture + idx = collision_queue_length++; + collision_queue[idx].idx = advance_particle_queue[i].idx; + collision_queue[idx].E = p->E_; + collision_queue[idx].material = p->material_; + collision_queue[idx].type = p->type_; + } } - advance_particle_queue_length = 0; } @@ -378,6 +400,7 @@ void process_surface_crossing_events() #pragma omp parallel for schedule(dynamic, DYNAMIC_SIZE) for (int i = 0; i < surface_crossing_queue_length; i++) { Particle * p = particles + surface_crossing_queue[i].idx; + /* // Set surface that particle is on and adjust coordinate levels p->surface_ = p->boundary_.surface_index; p->n_coord_ = p->boundary_.coord_level; @@ -408,11 +431,13 @@ void process_surface_crossing_events() if (!p->alive_ && !p->secondary_bank_.empty()) { revive_particle_from_secondary(p); } + */ + p->event_cross_surface(); if (p->alive_) - { - dispatch_xs_event(surface_crossing_queue[i].idx); - } + { + dispatch_xs_event(surface_crossing_queue[i].idx); + } } surface_crossing_queue_length = 0; @@ -424,6 +449,7 @@ void process_collision_events() #pragma omp parallel for schedule(dynamic,DYNAMIC_SIZE) for (int i = 0; i < collision_queue_length; i++) { Particle * p = particles + collision_queue[i].idx; + /* //std::cout << "Beginning collision of particle id " << collision_queue[i] << " with energy E = " << p->E_ << std::endl; // Score collision estimate of keff if (settings::run_mode == RUN_MODE_EIGENVALUE && @@ -497,18 +523,24 @@ void process_collision_events() // Score flux derivative accumulators for differential tallies. if (!model::active_tallies.empty()) score_collision_derivative(p); + */ + p->event_collide(); //if (!p->alive_ && !simulation::secondary_bank.empty()) { + /* if (!p->alive_ && !p->secondary_bank_.empty()) { revive_particle_from_secondary(p); } + */ + + p->event_revive_from_secondary(); if (p->alive_) - { - dispatch_xs_event(collision_queue[i].idx); - //std::cout << "Ended collision of particle id " << collision_queue[i] << " with energy E = " << p->E_ << std::endl; - assert(std::isfinite(p->E_) ); - } + { + dispatch_xs_event(collision_queue[i].idx); + //std::cout << "Ended collision of particle id " << collision_queue[i] << " with energy E = " << p->E_ << std::endl; + //assert(std::isfinite(p->E_) ); + } } collision_queue_length = 0;